SA-MP Forums Archive
if joined == 1 Event is canceled - 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 joined == 1 Event is canceled (/showthread.php?tid=447727)



if joined == 1 Event is canceled - LyNeR - 01.07.2013

Hello. i make a new fs but I have a problem. I want the event to be canceled only 1 person joined. but I couldn't already. understand my problem now;

OnPlayerUpdate public;
Код:
if(EventAttend == 1 && EventStarted == 1 && GetPVarInt(playerid,"PlayerinEvent") == 1)
{
new string[256];
new name[30];
GetPlayerName(playerid,name,30);
format(string,sizeof(string),"%s won the event prcie: $5.000",name);
SendClientMessageToAll(-1,string);
 EventStarted= 0;
EventAttend = 0;
GivePlayerMoney(playerid,50000);
SpawnPlayer(playerid);
EventisFinished = 0;
KillTimer(timer);
}
Please help i want is player joined the event but the event joined user = 1 the event is automatic finished. Sorry my bad english.


Re: if joined == 1 Event is canceled - nike96 - 01.07.2013

Your variable is one for all player. Make variable: "new EventAttend[MAX_PLAYERS], EventStarted[MAX_PLAYERS];"
And you try this "if(EventAttend[playerid] == 1 && EventStarted[playerid] == 1 && GetPVarInt(playerid,"PlayerinEvent") == 1)"


Re: if joined == 1 Event is canceled - LyNeR - 01.07.2013

Quote:
Originally Posted by nike96
Посмотреть сообщение
Your variable is one for all player. Make variable: "new EventAttend[MAX_PLAYERS], EventStarted[MAX_PLAYERS];"
And you try this "if(EventAttend[playerid] == 1 && EventStarted[playerid] == 1 && GetPVarInt(playerid,"PlayerinEvent") == 1)"
Thank you. I try it