Wondering..
#1

Is it possible to have a check to be able to know how fast a car is going when it slams into a wall or other car and gets in a wreck or anything like that? I was just wondering since someone asked me and it's been on my mind every since. Thanks in advance!
Reply
#2

I don't understand you..
Reply
#3

Quote:
Originally Posted by MenaceX^
I don't understand you..
A check like if a player is driving their vehicle, and then they wreck, or hit something, the check would be able to see how fast they are going and how much damage was done to the car or something then as a result their car would not work if it was like a bad wreck or something. I am sorry if you don't understand what I mean as I am having trouble trying to get it into words as it is scrambled in my head!
Reply
#4

you mean if a vehicles healh is below a number, stop that vehicle from moving?


new vehiclehealth;
vehiclehealth = GetPlayerVehicleHealth(playerid);
if(vehiclehealth <= 500)
{
//do your stuff
}
Reply
#5

Quote:
Originally Posted by hazdog
you mean if a vehicles healh is below a number, stop that vehicle from moving?


new vehiclehealth;
vehiclehealth = GetPlayerVehicleHealth(playerid);
if(vehiclehealth <= 500)
{
//do your stuff
}
Actually yeah something like that could also work probably I'll try it out thanks!
Reply
#6

Where to put this?
in wich public?

pawn Код:
new vehiclehealth;
vehiclehealth = GetPlayerVehicleHealth(playerid);
if(vehiclehealth <= 500)
{
  //do your stuff
}
Reply
#7

You need to make a timer.
Reply
#8

Well i have one but it isnt working..

pawn Код:
forward CheckCarHealth();
pawn Код:
new checkcarhealthtimer;
pawn Код:
public OnGameModeInit()

    checkcarhealthtimer = SetTimer("CheckCarHealth", 10000, 1);
pawn Код:
public CheckCarHealth()
{
  new string[256];
  new sendername[MAX_PLAYER_NAME];
  for (new i=0; i < MAX_PLAYERS; i++)
  {
    if (IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
    {
       new Float:health;
       GetVehicleHealth(GetPlayerVehicleID(i),health);
       new newcar = GetPlayerVehicleID(i);
       if (health <= 500 && !IsABoat(newcar) && !IsABike(newcar) && !IsAPlane(newcar) && !IsATaxi(newcar) && !IsAHelicopter(newcar))
       {
         if(EngineStatus[GetPlayerVehicleID(i)] == 1)
         {
          if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
          {
            TogglePlayerControllable(i, 0);
                SendClientMessage(i, COLOR_RED, "O teu carro avariou.");
                EngineStatus[GetPlayerVehicleID(i)] = false;
                GetPlayerName(i, sendername, sizeof(sendername));
                format(string, sizeof(string), "O motor de %s vai abaixo.", sendername);
                        ProxDetector(20.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    }
                 }
       }
     }
  }
}
and i have a public to kill the timer

pawn Код:
public GameModeExitFunc()
{

    KillTimer(checkcarhealthtimer);
    GameModeExit();
}

whats wrong here?
Reply
#9

You need to keep track of the vehicle's speed, then if the movement of the vehicle stops suddenly and vehicle's health decreases at the same time, the vehicle has crashed into something and you can do whatever you like.
Reply
#10

So what i need to add more?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)