[HELP] When a vehicle loses life...
#1


Hello everybody!
I wish to know the following:
You can detect the amount of life that a vehicle lost?
Caution: The amount of lost life and not the amount of life that remains!
I wonder if there is a script that can detect it! If anyone knows and can help me I appreciate it!
Reply
#2

Код:
new Float:health, string[128];
GetVehicleHealth(GetPlayerVehicleID(playerid), health);
format(string, sizeof(string), "Vehicle Health Lost: %d" 1000-health);
SendClientMessage(playerid, -1, string);
Reply
#3

Quote:
Originally Posted by lelemaster
Посмотреть сообщение
Код:
new Float:health, string[128];
GetVehicleHealth(GetPlayerVehicleID(playerid), health);
format(string, sizeof(string), "Vehicle Health Lost: %d" 1000-health);
SendClientMessage(playerid, -1, string);
I tried this, but this mode only shows the total amount that he lost, but I wanted to beat that amount only, you know?

example:
I hit the car and now he was living with in 1000, he lost 100 and got 900, right? But if I hit him again and he lost only 50, see:

First hit: ... "Vehicle Health Lost: 100" 1000-health); / /All Right
Second hit: ... "Vehicle Health Lost: 150" 1000-health);/ / Wrong, because the second hit he lost only 50 and not 150!

Got it? But I appreciate your attempt and if anyone else knows ...
Reply
#4

Don't know if this one will work.
Код:
//top of your script

new Float:HealthOfCar[MAX_VEHICLES];

//In OnVehicleSpawn

HealthOfCar[vehicleid] = 1000;

//The function where you lose health

new Float:health, string[128];
GetVehicleHealth(GetPlayerVehicleID(playerid), health);
format(string, sizeof(string), "Vehicle Health Lost: %d" HealthOfCar[GetPlayerVehicleID(playerid)]-health);
SendClientMessage(playerid, -1, string);
HealthOfCar[GetPlayerVehicleID(playerid)] -= health;
Reply
#5

PHP код:
new Float:CarHealth[MAX_VEHICLES];

forward CarChecker(carid);
public 
CarChecker(carid)
{
    new 
Float:health,string[70];
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerInAnyVehicle(i))
        {
            
GetVehicleHealth(GetPlayerVehicleID(i), health);
            
format(stringsizeof(string), "Your car lost %f HP!"CarHealth(GetPlayerVehicleID(i))-health);
            
SendClientMessage(playerid, -1string);
            
CarHealth[GetPlayerVehicleID(i)] = health;
        }
    }

Then just set up a timer under OnGameModeInit.
Reply
#6

Thanks to all... I go testing this...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)