On Player Spawn problem
#1

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.
Reply
#2

Remove the return 1; under it
Reply
#3

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;
}
Reply
#4

Thanks man, it worked.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)