10.03.2017, 09:40
I found some FS about that, though of making my own. Somehow I made it but seems it's not working tho. It's not repairing car.
Edit:
PHP код:
new bool:Autorepair[MAX_PLAYERS];
forward AutoRepair();
CMD:af(playerid)
{
if(Autorepair[playerid])
{
Autorepair[playerid] = false;
SendClientMessage(playerid, COLOR_RED, "Pakistan Drift Zone: Auto Car Repair Disabled.");
}
else
{
Autorepair[playerid] = true;
SendClientMessage(playerid, COLOR_RED, "Pakistan Drift Zone: Auto Car Repair enabled.");
}
return 1;
}
public AutoRepair()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(!Autorepair[i])
{
return 0;
}
new float:gvh; // Get vehicle health
new gvid; // Get vehicle ID
if(IsPlayerInAnyVehicle(i))
{
gvid = GetPlayerVehicleID(i);
GetVehicleHealth(gvid, gvh);
if(gvh < 999)
{
SetVehicleHealth(gvid, 1000);
RepairVehicle(gvid);
}
}
}
}
return 1;
}
PHP код:
public OnPlayerConnect(playerid)
{
Autorepair[playerid] = false;
return 1;
}