Quote:
Originally Posted by lonako45
PHP код:
if(activity == 0) return SendClientMessage(playerid,White,"No Activity !");
if(ActivityTeleports == 0) return SendClientMessage(playerid,White,"The Teleports closed!");
if(JoinTime2[playerid] == 1) return SendClientMessage(playerid,White,"You Need wait one Minute");
format(string1, sizeof(string1),"The Player %s%d want join to activity",GetName(playerid),playerid);
SendAdminsMessage(0x8e0c9ff,string1);
SendClientMessage(playerid,0x8e0c9ff,"You ask the admin to join !");
GameTextForPlayer(playerid,"~r~Activity ~b~ Join !~<~",20,1);
JoinTime[playerid] = SetTimerEx("JoinTime1", 60000, 0, "i", playerid);
for(new i = 0; i<MAX_PLAYERS; i++) if(IsPlayerConnected(i)) JoinTime2[i] = 1;
return 1;
}
PHP код:
public JoinTime1(playerid)
{
SendClientMessage(playerid,0x48c14ff,"You Can use again the command /a j !");
JoinTime2[playerid] = 0;
return 1;
}
Now help ?
|
The problem is that you are setting the JoinTime2 value to 1 for everyone, instead of just the person who did the command.
Replace this:
pawn Код:
for(new i = 0; i<MAX_PLAYERS; i++) if(IsPlayerConnected(i)) JoinTime2[i] = 1;
With this:
Then you will only be restricting that players ability to do the command.
Also I would suggest using a GetTickCount system for determining when the player can execute a command again instead of timers.
For example:
pawn Код:
JoinTime2[playerid] = GetTickCount();
Then when you want to limit the player from doing it before, 60 seconds for example:
pawn Код:
if((GetTickCount() - 60000) < JoinTime2[playerid]) // Player has not waited 60 seconds
Absolutely no need for timers then.