From all players to one player? - 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: From all players to one player? (
/showthread.php?tid=369755)
From all players to one player? -
Admigo - 18.08.2012
heey all,
I am using the Spikestrip unclude and edited something.
I made that one player can only spawn one spikestrip.
I tested on server and i see that only one player on the server can use it so its detecting not the playerid but all players.
Код:
for(new i = 0; i < sizeof(SpikeInfo); i++)
{
if(SpikeInfo[i][sCreated] == 0)
{
SpikeInfo[i][sCreated]=1;
SpikeInfo[i][sX]=x;
SpikeInfo[i][sY]=y;
SpikeInfo[i][sZ]=z-0.7;
SpikeInfo[i][sObject] = CreateObject(2899, x, y, z-0.9, 0, 0, Angle-90);
return 1;
}
else if(SpikeInfo[i][sCreated] == 1)
{
SpikeInfo[i][sCreated]=0;
SpikeInfo[i][sX]=0.0;
SpikeInfo[i][sY]=0.0;
SpikeInfo[i][sZ]=0.0;
DestroyObject(SpikeInfo[i][sObject]);
}
}
How can i change it to one player so every player can create one spikestrip?
Thanks Admigo
Re: From all players to one player? -
Ranama - 18.08.2012
well, you could just do a variable, like
Код:
HaveSetedSpike[MAX_PLAYERS];
//and in the command you are using you just put
HaveSettedSpike[playerid] = 1;
// and
HaveSettedSpike[playerid] = 0;
//and don't forget to remove the spike on player dissconnect and set their variable to 0
Just doing it as simple as that should work i think
Re: From all players to one player? -
Admigo - 18.08.2012
I only need convert this to playerid.
Re: From all players to one player? -
park4bmx - 18.08.2012
you should remove the loop or if the loop is needed then make a check so the script knows you only want 1 playerid .