Skip to content

Instantly share code, notes, and snippets.

@dennorske
Created January 22, 2013 17:11
Show Gist options
  • Save dennorske/4596349 to your computer and use it in GitHub Desktop.
Save dennorske/4596349 to your computer and use it in GitHub Desktop.
A code snippet
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/repair", cmdtext, true, 10) == 0)
{
if(denyrepair)
return SendClientMessage(playerid, -1, "You are not allowed to do this command again so fast!");
if(!IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid, 0xFF0000FF, "You are not in a vehicle!"); // Let the player know he's not inside a vehicle and let the server know that this was a valid command
// Fully repair the vehicle (damage value and bodywork)
SetTimerEx("Repair_CMD", 15000, false, "i", playerid);
SendClientMessage(playerid, 0xFF9900AA, "Assistance called . Your vehicle will be repaired in 15 minutes");
// RepairVehicle(GetPlayerVehicleID(playerid));
// Send the player a message to inform him that his vehicle has been repaired
//SendClientMessage(playerid, 0x00FF00FF, "Your vehicle has been successfully repaired!");
denyrepair = 1;
SetTimer("repairtime", 60000, 0); //one minute
return 1;
}
//PUT THIS ANYWHERE! (Best is to place it on the top);
new denyrepair = 0;
forward repairtime(playerid);
public repairtime(playerid)
{
denyrepair=0;
SendClientMessage(playerid, -1, "Repair is now allowed!");
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment