31.05.2011, 14:24
okay this is what i have made so far.
pawn Код:
new autorepair[MAX_PLAYERS];
forward AutoR();
public AutoR()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
new Float:VHealth, vehicleid = GetPlayerVehicleID(i);
GetVehicleHealth(vehicleid,VHealth);
if(autorepair[i] == 1)
{
if (IsPlayerInAnyVehicle(i))
{
if(VHealth < 999)
{
RepairVehicle(i);
}
}
}
}
return 1;
}
//on game mode in it
SetTimer("AutoR", 1000, 1);
//onplayerconnect
autorepair[playerid] = 0;
// the command
CMD:autorepair(playerid, params[])
{
if(autorepair[playerid] == 1)
{
autorepair[playerid] = 0;
SendClientMessage(playerid, COLOR_GREEN, "( ! ) You turned off autorepair.");
}
else
if(autorepair[playerid] == 0)
{
autorepair[playerid] = 1;
SendClientMessage(playerid, COLOR_GREEN, "( ! ) You turned on autorepair.");
}
return 1;
}