On Player Spawn problem -
alainchaccour - 29.08.2011
I am adding a FS to save weapons when the player logs, I am copying the stuff from it and put it in the GM.
Everything worked fine but this warning OnPlayerSpawn
C:\Users\Chaccour\Desktop\Work\filterscripts\eurp8 .pwn(12217) : warning 225: unreachable code
That is my On Player Spawn
Код:
public OnPlayerSpawn(playerid)
{
if (!AlreadyGiveWeapons[playerid]) SetTimerEx("LoadWeaponsToFile",250,false,"i",playerid);
return 1;
if(!IsPlayerNPC(playerid) && gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "This server requires you to login before spawn, you have been kicked.");
Kick(playerid);
return 1;
}
if(PlayerInfo[playerid][pClothes] != 0)
{
SetPlayerSkin(playerid, PlayerInfo[playerid][pClothes]);
}
else
{
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
}
if(!gPlayerAnimLibsPreloaded[playerid])
{
PreloadAnimLib(playerid,"BOMBER");
PreloadAnimLib(playerid,"RAPPING");
PreloadAnimLib(playerid,"SHOP");
PreloadAnimLib(playerid,"BEACH");
PreloadAnimLib(playerid,"SMOKING");
PreloadAnimLib(playerid,"FOOD");
PreloadAnimLib(playerid,"ON_LOOKERS");
PreloadAnimLib(playerid,"DEALER");
PreloadAnimLib(playerid,"CRACK");
PreloadAnimLib(playerid,"CARRY");
PreloadAnimLib(playerid,"COP_AMBIENT");
PreloadAnimLib(playerid,"PARK");
PreloadAnimLib(playerid,"INT_HOUSE");
PreloadAnimLib(playerid,"FOOD");
PreloadAnimLib(playerid,"PED");
PreloadAnimLib(playerid,"GANGS");
gPlayerAnimLibsPreloaded[playerid] = 1;
}
SetPlayerWeapons(playerid);
SetPlayerSpawn(playerid);
PlayerFixRadio(playerid);
gPlayerSpawned[playerid] = 1;
return 1;
}
And the warning is at that line:
if (!AlreadyGiveWeapons[playerid]) SetTimerEx("LoadWeaponsToFile",250,false,"i",playe rid);
return 1;
Could you help me please?
Thank you.
Re: On Player Spawn problem -
Johndaonee - 29.08.2011
Remove the return 1; under it
Re: On Player Spawn problem -
HyperZ - 29.08.2011
Try this:
pawn Код:
public OnPlayerSpawn(playerid)
{
if (!AlreadyGiveWeapons[playerid])
{
SetTimerEx("LoadWeaponsToFile",250,false,"i",playerid);
}
if(!IsPlayerNPC(playerid) && gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "This server requires you to login before spawn, you have been kicked.");
Kick(playerid);
return 1;
}
if(PlayerInfo[playerid][pClothes] != 0)
{
SetPlayerSkin(playerid, PlayerInfo[playerid][pClothes]);
}
else
{
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
}
if(!gPlayerAnimLibsPreloaded[playerid])
{
PreloadAnimLib(playerid,"BOMBER");
PreloadAnimLib(playerid,"RAPPING");
PreloadAnimLib(playerid,"SHOP");
PreloadAnimLib(playerid,"BEACH");
PreloadAnimLib(playerid,"SMOKING");
PreloadAnimLib(playerid,"FOOD");
PreloadAnimLib(playerid,"ON_LOOKERS");
PreloadAnimLib(playerid,"DEALER");
PreloadAnimLib(playerid,"CRACK");
PreloadAnimLib(playerid,"CARRY");
PreloadAnimLib(playerid,"COP_AMBIENT");
PreloadAnimLib(playerid,"PARK");
PreloadAnimLib(playerid,"INT_HOUSE");
PreloadAnimLib(playerid,"FOOD");
PreloadAnimLib(playerid,"PED");
PreloadAnimLib(playerid,"GANGS");
gPlayerAnimLibsPreloaded[playerid] = 1;
}
SetPlayerWeapons(playerid);
SetPlayerSpawn(playerid);
PlayerFixRadio(playerid);
gPlayerSpawned[playerid] = 1;
return 1;
}
Re: On Player Spawn problem -
alainchaccour - 29.08.2011
Thanks man, it worked.