18.03.2011, 15:10
hey guys
so I want to make a command ...(/fix). that I can use every 60 seconds.so in this command Clearly I will have to use timers for playerid. so I tried to do the next thing :
up on the GM
if canRep is 0 then he can repair.if its 1 then he cant.(has to wait 60 secs)
now,OnPlayerConnect
then under onplayercommandtext
and i have the public
so I want to make a command ...(/fix). that I can use every 60 seconds.so in this command Clearly I will have to use timers for playerid. so I tried to do the next thing :
up on the GM
Код:
new canRep[MAX_PLAYERS]; forward FreeRepair(playerid);
now,OnPlayerConnect
Код:
canRap[playerid] = 0;
Код:
if (strcmp("/fix",cmdtext,true,10) == 0) //ElkaBlazer { for(new i = 0;i < MAX_PLAYERS;i++) { if(canRep[playerid] == 0) { if(IsPlayerInAnyVehicle(playerid)) { SetVehicleHealth(GetPlayerVehicleID(playerid),100.000); SendClientMessage(playerid,COLOR_ADMINS,"You have fixed the vehicle!"); canRep[playerid] = 1; SetTimerEx("FreeRepair",60000,0,"i"); } } } return 1; }
Код:
public FreeRepair(playerid) { canRep[playerid] = 0; }