Check car health help! - 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: Check car health help! (
/showthread.php?tid=436360)
Check car health help! -
Giroud12 - 11.05.2013
How can i make when player exit vehicle...it check vehicle health and player need to pay how much the car health decreasing..
Re: Check car health help! -
Private200 - 11.05.2013
I think something like this will be fine:
Under 'public OnPlayerExitVehicle(playerid, vehicleid)' you can just do the following code:
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
new Float:health;
health = GetVehicleHealth(vehicleid, health);
// Maximum of health for car is 1000, so we go scripting things like this:
if(health >= 400 && health < 500)
{
GivePlayerMoney(playerid, -250);
SendClientMessage(playerid, 0xFF0000FF, "You've paid 250$ for the car problems you made.");
}
else if(health >= 500 && health < 650)
{
GivePlayerMoney(playerid, -750);
SendClientMessage(playerid, 0xFF0000FF, "You've paid 750$ for the car problems you made.");
}
else if(health >= 650 && health < 800)
{
GivePlayerMoney(playerid, -1250);
SendClientMessage(playerid, 0xFF0000FF, "You've paid 1250$ for the car problems you made.");
}
else if(health >= 800)
{
GivePlayerMoney(playerid, -1500);
SendClientMessage(playerid, 0xFF0000FF, "You've paid 1500$ for the car problems you made.");
}
return 1;
}
I've made it here on the post, so don't except some grammar problems or whatever. Change the color to whatever you want and the prices to whatever you'd like.
Re: Check car health help! -
Giroud12 - 11.05.2013
Thx bro...