Car trobles - 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: Car trobles (
/showthread.php?tid=415871)
Car trobles -
xXRealLegitXx - 15.02.2013
Hello. I recently added a script, thank you to my fellow sampers for helping me, that shuts the vehicle off when reaches 400.0 or below health
I added a "SendClientMessage"
At first, it spammed my chat when the vehicle took damage
Second, after I moved it, it spammed my chat when I was in it and it was working.
Can someone fit
Код:
SendClientMessage(playerid, yellow, "Your vehicle has taken too much damage and refuses to move! ((Find a Mechanic))");
into
Код:
public OnPlayerUpdate(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
new Float:fVehicleHealth; GetVehicleHealth(vehicleid, fVehicleHealth);
if(fVehicleHealth <= 400.0)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, false, lights, alarm, doors, bonnet, boot, objective);
}
}
return 1;
}
For me?
Re: Car trobles -
Neil. - 15.02.2013
My suggestion is to use a timer instead of OPU. To about 5000ms. It does not need to update that much often.
Re: Car trobles -
xXRealLegitXx - 15.02.2013
Quote:
Originally Posted by Ken97
My suggestion is to use a timer instead of OPU. To about 5000ms. It does not need to update that much often.
|
I want it to SendClientMessage ONCE when the vehicle is destroyed. Any way to to this
Re: Car trobles -
RajatPawar - 15.02.2013
Yes, as said above, set a timer, then once the vehicle health is below 400, SendClientMessage(..), and Kill the timer. Then, create a new timer and so on.
Re: Car trobles -
LarzI - 15.02.2013
- ignore -