one question - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: one question (
/showthread.php?tid=208328)
one question -
marrcko - 08.01.2011
Hi,
in what callback i should put script if i want to check vehicle healh all time?
Re: one question -
Kyosaur - 08.01.2011
OnPlayerUpdate is where you would put it (assuming no new callbacks for vehicle damage were added in 0.3c, i havent played with it yet :P). I would add scheduling code so your code isnt being called on every update though.
Re: one question -
marrcko - 08.01.2011
well, i will try it, thx
Re: one question -
marrcko - 08.01.2011
why its not work(yea im lol)
pawn Код:
public OnPlayerUpdate(playerid)
{
new
vehicleid = GetPlayerVehicleID(playerid);
if (vehicleDB[vehicleid][drausta])
{
if (GetVehicleHealth(vehicleid) < 400)
{
SetVehicleHealth(vehicleid,1000);
}
}
return 1;}
its dont do nothing
this works, i know couse i get message then i get in car....
pawn Код:
if (vehicleDB[vehicleid][drausta])
Re: one question -
Kyosaur - 08.01.2011
https://sampwiki.blast.hk/wiki/GetVehicleHealth
You're using GetVehicleHealth wrong.
Re: one question -
Joe Staff - 08.01.2011
https://sampwiki.blast.hk/wiki/OnVehicleDamageStatusUpdate
pawn Код:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
RepairVehicle(vehicleid);
return 1;
}
same as godmode
Re: one question -
Kyosaur - 08.01.2011
Quote:
Originally Posted by SilentHuntR
|
Sorry but this is probably the worst option, as this callback only gets called when a vehicle gets visibly damage, which not every vehicle can be (boats, planes, and any 2 wheel vehicle etc do not have visible elements that can be damaged). Test your code with an NRG500 or a plane for example.
Re: one question -
marrcko - 09.01.2011
thx Koysaur its working