30.09.2013, 13:06
Try this:
pawn Code:
new bool:RepairedCar[MAX_PLAYERS]; //put this outside the command/function/callback
new RepairedCarTimer[MAX_PLAYERS]; //put this outside the command/function/callback
forward RepairedCarReset(playerid); //put this outside the command/function/callback
public RepairedCarReset(playerid) //put this outside the command/function/callback
{
if(RepairedCar[playerid])
{
RepairedCar[playerid] = false;
}
return 1;
}
if(IsPlayerInAnyVehicle(playerid))
{
if(newkeys & KEY_ANALOG_UP) // NumPad 8
{
if(!RepairedCar[playerid])
{
new vehicleid = GetPlayerVehicleID(playerid);
SetVehicleHealth(vehicleid, 1000.0);
RepairVehicle(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, 0x800080FF, "[ Server ] Vehicle repaired.");
RepairedCar[playerid] = true;
RepairedCarTimer[playerid] = SetTimerEx("RepairedCarReset",10000,false,"i",playerid); //10000 is the timer, it's set as 10seconds. After the command, they have to wait 10seconds to do it again. Change this to whatever you want. 25seconds would be 250000.
return 1;
}
else return SendClientMessage(playerid, 0x800080FF, "[ Server ] You cannot do this command yet!");
}