Check car health help!
#1

How can i make when player exit vehicle...it check vehicle health and player need to pay how much the car health decreasing..
Reply
#2

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.
Reply
#3

Thx bro...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)