From all players to one player?
#1

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

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
Reply
#3

I only need convert this to playerid.
Reply
#4

you should remove the loop or if the loop is needed then make a check so the script knows you only want 1 playerid .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)