[HELP] When a vehicle loses life... - 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: [HELP] When a vehicle loses life... (
/showthread.php?tid=385246)
[HELP] When a vehicle loses life... -
[DkS]JR_Junior - 15.10.2012
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!
Re : [HELP] When a vehicle loses life... -
lelemaster - 15.10.2012
Код:
new Float:health, string[128];
GetVehicleHealth(GetPlayerVehicleID(playerid), health);
format(string, sizeof(string), "Vehicle Health Lost: %d" 1000-health);
SendClientMessage(playerid, -1, string);
Re: Re : [HELP] When a vehicle loses life... -
[DkS]JR_Junior - 15.10.2012
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 ...
Re : [HELP] When a vehicle loses life... -
lelemaster - 15.10.2012
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;
Re: [HELP] When a vehicle loses life... -
JhnzRep - 15.10.2012
PHP код:
new Float:CarHealth[MAX_VEHICLES];
forward CarChecker(carid);
public CarChecker(carid)
{
new Float:health,string[70];
for(new i = 0; v < MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle(i))
{
GetVehicleHealth(GetPlayerVehicleID(i), health);
format(string, sizeof(string), "Your car lost %f HP!", CarHealth(GetPlayerVehicleID(i))-health);
SendClientMessage(playerid, -1, string);
CarHealth[GetPlayerVehicleID(i)] = health;
}
}
}
Then just set up a timer under OnGameModeInit.
Re: [HELP] When a vehicle loses life... -
[DkS]JR_Junior - 17.10.2012
Thanks to all... I go testing this...