Car HP
#1

Hi all,
I have this problem with this code. I want the code to get the cars health so that when the car is about to blow up they get a message and they get kicked out of the car.
Код:
 Above OnGameModeInit
forward Carhp(playerid, vehicleid);
new car;

public Carhp(playerid, vehicleid)
{
  car = GetPlayerVehicleID(playerid);
	new Float:vehhp = GetVehicleHealth(car,vehhp);
	if(vehhp <= 250)
	{
	SendClientMessage(playerid,COLOR_BLUE,"GET OUT!");
       RemovePlayerFromVehicle(playerid);
	}
	return 1;
}
Thx for all help
Reply
#2

pawn Код:
SetTimer("Carhp",1000,1);
pawn Код:
public Carhp()
{
  for(new i=0; i<MAX_PLAYERS; i++)
  {
    if(IsPlayerInAnyVehicle(i))
    {
      new Float:chealth;
      GetVehicleHealth(GetPlayerVehicleID(i),chealth);
           
      if(chealth <= 250)
      {
        SendClientMessage(i,COLOR_BLUE,"GET OUT!");
        RemovePlayerFromVehicle(i);
      }
    }
  }
}
Reply
#3

Thx so much bro
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)