08.03.2014, 09:13
Hello, iv wondering if my functions working well,
CALL:
I meant the timer, it will keep repeating ? because iv tried SetTimerEX and it was keep repeating "MINIGUN EVENT ENDED"
Код:
CMD:minievent(playerid, params[])
{
#pragma unused params
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You must be an RCON Admin to use this command.");
if(MinigunEvent) return SendClientMessage(playerid, 0xFF0000FF, "There is already a minigun event running. Wait for it to finish.");
for(new i = 0; i < MAX_PLAYERS; i++) //Foreach is recommended here...
{
if(!IsPlayerConnected(i)) continue;
if(DMZone[i] < 1 && GodMode[i] == 0)
{
GivePlayerWeapon(i, 38, 50000); //Gives a minigun with 5000 ammo.
}
}
MinigunEvent = true;
SetTimer("ResetMinigunEvent", 60000, false); //Sets a timer for 60 seconds (1 minute).
SendClientMessageToAll(0xFFFF00FF, "A Minigun Event has begun. It will end in 1 minute.");
GameTextForAll("~N~~N~~N~~N~~N~~r~~h~MINIGUN~n~~h~Fight!",5000,5);
return 1;
}
Код:
forward ResetMinigunEvent();
public ResetMinigunEvent()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(DMZone[i] < 1 && GodMode[i] == 0)
{
if(!IsPlayerConnected(i)) continue;
SetPlayerAmmo(i,38, 0);
//RemovePlayerWeapon(i, 38);
}
}
MinigunEvent = false;
GameTextForAll("~N~~N~~N~~N~~r~~h~MINIGUN-EVENT ~R~ENDED",5000,5);
return 1;
}

