CoEmu ( Spawncharacter.cs ) [problem]

03/01/2010 08:41 LegalConquer#1
When ever i change anything thing in Spawncharacter.cs
it allways highlights the top
Code:
public static byte[] SpawnCharacter(ClientSocket CSocket)
And says
Code:
Error	3	'CoEmu_v2_GameServer.Packets.ConquerPacket.SpawnCharacter(CoEmu_v2_GameServer.Connections.ClientSocket)': not all code paths return a value	C:.../SpawnCharacter.cs	22	30	CoEmu v2 GameServer
Where do i delete these paths any help :P
03/01/2010 09:29 pro4never#2
you are doing your return statement inside a if statement it sounds like.

byte[] indicates it is returning a value. It's easiest to explain with a bool example because there are only 2 values so I'll go with that.

If you are working with a public static bool you MUST return a value. The easiest way to do this would be...

public static bool TestFunction(int x, int y)

bool value = false;
{
if(x>y)
value = true;

return value
}

Notice it ALWAYS gets to the return statement and it ALWAYS has a value (because I assigned it one and then simply modified it based on the conditions)

You will need to check that you are returning a byte[] value properly in your code and NOT inside an if statement (because then if the if doesn't execute the statement will never be returned causing major fuckups.
03/01/2010 10:16 LegalConquer#3
Yh i fixed that now its because im updating the guilds now when i make a guild u can log off and on and it saves the guilds and loads but when i restart the server it cant load up guilds again. lol
doing my head in.
03/01/2010 17:23 pro4never#4
load all guilds from database on server restart so the server knows they exist.

Should be in nano.cs where everything else is loaded. Add something like Database.Database.LoadGuilds();
03/01/2010 17:35 LegalConquer#5
Quote:
Originally Posted by pro4never View Post
load all guilds from database on server restart so the server knows they exist.

Should be in nano.cs where everything else is loaded. Add something like Database.Database.LoadGuilds();
i think thats it XD

thanks its my fault for deleting the whole guild code and re creating it trying to get it more stable XD im just not used to how it all goes together :P