13.10.2009, 14:58
hi i need help with finding how to make it so the script can detect the vehicle health and if its below 900.00 it fixes it.
thanks in advance.
-
meegan1
thanks in advance.
-
meegan1
Originally Posted by GaGlets
Whot u give for it ?
|
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, 0xFFFFFFAA, "SERVER: You must be in the vehicle.");
return 1;
}
else
{
new Float:health, vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehicleid, health);
if(health < 900)
{
RepairVehicle(vehicleid);
SendClientMessage(playerid, 0xFFFFFFAA, "SERVER: Your vehicle is repaired.");
}
else
{
SendClientMessage(playerid, 0xFFFFFFAA, "SERVER: Your vehicle's health is not below 900, so you can't repair it.");
}
}
forward repaircar() public OnGameModeInit() { SetTimer("repaircar",3000,1); } public repaircar() { for(new i=0; i < MAX_PLAYERS; i++) { new Float:hp[MAX_PLAYERS]; GetVehicleHealth(GetPlayerVehicleID(i),hp[i]); if (hp[i] < 900) { SetVehicleHealth(GetPlayerVehicleID(i),1000); GameTextForPlayer(i,"~w~Vehicle~g~ Repaired",3000,3); } } }