SA-MP Forums Archive
(if)PlayerIsSpawned, how to add this command? Plugin/pawno addon? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: (if)PlayerIsSpawned, how to add this command? Plugin/pawno addon? (/showthread.php?tid=341429)



(if)PlayerIsSpawned, how to add this command? Plugin/pawno addon? - MartinJ1 - 10.05.2012

How may i add this so ican make (if)playerisspawned inside pawno
Thank you for helping me


Re: (if)PlayerIsSpawned, how to add this command? Plugin/pawno addon? - TheGamer! - 10.05.2012

pawn Код:
new PlayerSpawned[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
    PlayerSpawned[playerid]=true;
    return 1;
}

if(PlayerSpawned[playerid]) ...



Re: (if)PlayerIsSpawned, how to add this command? Plugin/pawno addon? - MartinJ1 - 10.05.2012

COMMAND:cop(playerid, params[])
{
(140) if(PlayerSpawned[playerid]) return SendClientMessage(playerid,COLOR_WHITE,"You are already on the cop team, relog to change team.");
(141) SetSpawnInfo( playerid, 0, 285, 2047.1105,-2625.3525,13, 26, 29, 28, 150, 0, 0,0 );
(142) SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"You are now a cop!");
SendClientMessage(playerid,COLOR_VIP,"To see all the commands type /help, /rules for rules.");
SpawnPlayer(playerid);
return 1;
}




ERRORS:

C:\Users\Martin\Desktop\samp\gamemodes\martin.pwn( 140) : error 017: undefined symbol "PlayerSpawned"
C:\Users\Martin\Desktop\samp\gamemodes\martin.pwn( 140) : warning 215: expression has no effect
C:\Users\Martin\Desktop\samp\gamemodes\martin.pwn( 140) : error 001: expected token: ";", but found "]"
C:\Users\Martin\Desktop\samp\gamemodes\martin.pwn( 140) : error 029: invalid expression, assumed zero
C:\Users\Martin\Desktop\samp\gamemodes\martin.pwn( 140) : fatal error 107: too many error messages on one line


Re: (if)PlayerIsSpawned, how to add this command? Plugin/pawno addon? - Yuryfury - 10.05.2012

You need to compare the array to an actual number, in this case, 1(true).

pawn Код:
if(PlayerSpawned[playerid]==1) return SendClientMessage(playerid,COLOR_WHITE,"You are already on the cop team, relog to change team.");
Alternatively, you can make it a function (which is what I think you wanted to do)

pawn Код:
stock IsPlayerSpawned(playerid)
{
    if(PlayerSpawned[playerid]==1) return true;
    return false;
}



Re: (if)PlayerIsSpawned, how to add this command? Plugin/pawno addon? - Snipa - 11.05.2012

Or this?

pawn Код:
stock IsPlayerSpawned(playerid)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_SPAWNED) {
        return true;
    }
    else {
        return false;
    }
   
}



Re: (if)PlayerIsSpawned, how to add this command? Plugin/pawno addon? - SuperViper - 11.05.2012

pawn Код:
IsPlayerSpawned(playerid)
{
    return ((GetPlayerState(playerid) >= 1 && GetPlayerState(playerid) <= 6) || GetPlayerState(playerid) == 8) ? 1 : 0;
}



Re: (if)PlayerIsSpawned, how to add this command? Plugin/pawno addon? - MartinJ1 - 11.05.2012

C:\Users\Martin\Desktop\samp\gamemodes\martin.pwn( 140) : error 017: undefined symbol "IsPlayerSpawned"


Re: (if)PlayerIsSpawned, how to add this command? Plugin/pawno addon? - SuperViper - 11.05.2012

Are you sure you added the function somewhere in the script?