15.05.2010, 01:55
hey i was wondering if someone could make me a car auto repairer.. like every 30 secs it repairs the car or something... and i could type /r to repair it
#include <a_samp>
new Repair;
public OnFilterScriptInit()
{
Repair = SetTimer("Repairer",1000, true); // This is 1 second, if you want 30 seconds, change the number "1000" to "30000"
return 1;
}
public OnFilterScriptExit()
{
KillTimer(Repair);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/repair", cmdtext, true, 10) == 0)
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFFFFFAA,"You are not in vehicle!");
{
SendClientMessage(playerid,0xFFFFFFAA,"You repaired the car!");
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000);
}
return 1;
}
return 0;
}
forward Repairer();
public Repairer()
{
for(new i =0; i < MAX_PLAYERS; i++)
{
new car = GetPlayerVehicleID(i);
if(!IsPlayerInAnyVehicle(i)) return
SetVehicleHealth(GetPlayerVehicleID(i), 1000);
RepairVehicle(car);
}
return 1;
}


#include <a_samp>
new Repair;
public OnFilterScriptInit()
{
Repair = SetTimer("Repairer",5000, true);
return 1;
}
public OnFilterScriptExit()
{
KillTimer(Repair);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/r", cmdtext, true, 10) == 0)
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFFFFFAA,"You are not in vehicle!");
{
SendClientMessage(playerid,0xFFFFFFAA,"car repaired!");
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000);
}
return 1;
}
return 0;
}
forward Repairer();
public Repairer()
{
for(new i =0; i < MAX_PLAYERS; i++)
{
new car = GetPlayerVehicleID(i);
if(!IsPlayerInAnyVehicle(i)) return
SetVehicleHealth(GetPlayerVehicleID(i), 1000);
RepairVehicle(car);
}
return 1;
}