Global variable i think
#5

Quote:
Originally Posted by bleedis
Посмотреть сообщение
Sorry for double post, didnt work. It was the same, removed all spikes but that thing staid. Maybe i have to better explain. If someone uses spike command it makes this to go to 1
pawn Код:
spikes[playerid] = 1;
if someone already placed spikes then this happens -
pawn Код:
if (spikes[playerid] == 1) return SendClientMessage(playerid, 0xE01B4CFF, "{ff0000}** {C8D1CC}You already placed spikes!");
So if admin uses command to remove all players spikes on server, then how to get that spikes[playerid] = 1; goes to spikes[playerid] = 0; for everyone?
Well instead of setting spikes[playerid] = 0 you would need to do what the guy above said.

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
So when you use the command to set the spikes to 0 for all players. Instead of doing spikes[playerid] = 0 you would need to do spikes[i] = 0 . Then instead of just setting that variable to 0 for the player who used the command [playerid], it would go threw all the online players [i] and set that variable to 0 for them.

So when the player uses the command to set the spikes, you would do spikes[playerid] = 1 and the admin command to remove ALL spikes would have spikes[i] = 0 in the command with the for (new.. code before you use the [i].

Did that make any sense?
Reply


Messages In This Thread
Global variable i think - by bleedis - 31.05.2013, 04:17
Re: Global variable i think - by dubyabeast - 31.05.2013, 04:20
Re: Global variable i think - by bleedis - 31.05.2013, 04:22
Re: Global variable i think - by bleedis - 31.05.2013, 17:13
Re: Global variable i think - by Rillo - 31.05.2013, 17:49
Re: Global variable i think - by bleedis - 31.05.2013, 18:19

Forum Jump:


Users browsing this thread: 3 Guest(s)