health problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: health problem (
/showthread.php?tid=370397)
health problem -
Gooday - 19.08.2012
pawn Код:
public OnPlayerUpdate(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:hp,vehicleid = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehicleid,hp);
if(hp < 270)
{
SetVehicleHealth(vehicleid,280);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, 0);
GameTextForPlayer(playerid, "~r~Vehicle Totalled", 3000, 4);
}
}
return 1;
}
When I enter EVERY vehicle, even with 1000hp it shows the GameText and blocks the car, why?
Re: health problem -
Shetch - 20.08.2012
Try this:
Код:
public OnPlayerUpdate(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:hp,vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(engine == -1)
{
engine = 0;
}
GetVehicleHealth(vehicleid,hp);
if(hp < 270 && engine == 1)
{
SetVehicleHealth(vehicleid,280);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, 0);
GameTextForPlayer(playerid, "~r~Vehicle Totalled", 3000, 4);
}
}
return 1;
}