SA-MP Forums Archive
Spawn command - 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: Spawn command (/showthread.php?tid=411912)



Spawn command - DerickClark - 31.01.2013

i don't get dis how i make a spawn command?
like dis

You must Spawn to use dis command.


Re: Spawn command - u3ber - 31.01.2013

Quote:

i don't get dis how i make a spawn command?

with code...


Re: Spawn command - Roach_ - 31.01.2013

Like this:
pawn Код:
new bool:pSpawn[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    pSpawn[playerid] = false;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    pSpawn[playerid] = true;
    return 1;
}
And you use this to check if he spawned:
pawn Код:
if(!pSpawn[playerid]) return SendClientMessage(playerid, -1, "ERROR: You must Spawn to use this command.");



Re: Spawn command - Riddick94 - 31.01.2013

Quote:
Originally Posted by Roach_
Посмотреть сообщение
Like this:
pawn Код:
new bool:pSpawn[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    pSpawn[playerid] = false;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    pSpawn[playerid] = true;
    return 1;
}
And you use this to check if he spawned:
pawn Код:
if(!pSpawn[playerid]) return SendClientMessage(playerid, -1, "ERROR: You must Spawn to use this command.");
WHAT? You are using 32-bit variables which are useless because, they're holding only 1 and 0 values! That's a waste of a lot of memory! However if player died, he's not spawned then.

You can do this check by using player STATE.