SA-MP Forums Archive
Command help - 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: Command help (/showthread.php?tid=572338)



Command help - itachi - 27.04.2015

Please I help with /reapir on time.

if(strcmp(cmdtext, "/repair", true) == 0)
{
RepairVehicle(GetPlayerVehicleID(playerid));
new hrac[150];
GetPlayerName(playerid, hrac, sizeof(hrac));
format(hrac,sizeof(hrac), "**Player %s repair car", hrac); //sprava
SendClientMessageToAll(0xFF0000FF,hrac);

return 1;
}

this command use every five minutes.


Re: Command help - Rockyyy - 27.04.2015

Код:
new canrepair[MAX_PLAYERS];
Under onplayerconnect
Код:
canrepair[playerid] = 1;
Код:
if(strcmp(cmdtext, "/repair", true) == 0)
{
if(canrepair[playerid] == 1){
SetTimerEx("CanRepair", 60000*5, false, "i", playerid);
canrepair[playerid] = 0;
RepairVehicle(GetPlayerVehicleID(playerid));
new hrac[150];
GetPlayerName(playerid, hrac, sizeof(hrac));
format(hrac,sizeof(hrac), "**Player %s repair car", hrac); //sprava
SendClientMessageToAll(0xFF0000FF,hrac);}

return 1;
}
Код:
forward CanRepair(playerid);
public CanRepair(playerid)
{
canrepair[playerid] = 1;
return 1;}
If anything wrong with it say