2024-03-10, 02:08 AM
Try this
PHP Code:
new TimeFix[MAX_PLAYERS];
CMD:godcar(playerid, params[])
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "You need to be the driver!");
if(Active[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "Godcar already enabled!");
return 1;
}
TimeFix[playerid] = SetTimerEx("Fix", 200, true, "i", playerid);
SendClientMessage(playerid, COLOR_WHITE, "Godcar enabled!");
Active[playerid] = 1;
return 1;
}
forward Fix(playerid);
public Fix(playerid)
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 0;
if(Active[playerid] != 1) return 0;
// Flatten tires
tires(playerid, "");
// Add other self-repair actions if needed
return 1;
}
CMD:tires(playerid, params[])
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "You need to be the driver!");
new panels, doors, lights, tires;
new vehicleid = GetPlayerVehicleID(playerid);
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, 5);
return 1;
}