Help with GetVehicleHealth
#1

i have problem if player finish on driveschool and if vehicle < 880 hp losse driveschool.

code:

Код:
function Finish(p) {

new veh,Float:HPV;
veh = GetPlayerVehicleID(p);
if(WarnCH[p] > 13 || GetVehicleHealth(veh,HPV) < 880)return LosseRace(p);// here my problem GetVehicleHealth(veh,HPV) < 880
DestroyVehicle(CarDriveSchool[p]);
SCM(p,-1,"You have succses finish drive school! now can you drive any car.");
DataAccount[p][DriveS] = 1;
DataAccount[p][XPs] += 25;
KillTimer(Timerr[p]);
DataAccount[p][Money] += 100;
CheckMoney(p);
SpawnPlayer(p);
DisableDrift[p] = 0;

return 1;
}
Reply
#2

https://sampwiki.blast.hk/wiki/GetVehicleHealth

You check if the function was successful or not. You need to get the vehicle's health and check if the health (stored to a variable) is less than 880.
Reply
#3

if player finish race can check it if vehicle hp < 880?
or i create new variable?
Reply
#4

my problem is if vehicle hp > or < 880 get losse driveschool

any help guys??
Reply
#5

You have to use the referenced variable.

pawn Код:
new Float:vehicleHealth;
GetVehicleHealth(vehicleid, vehicleHealth);

if(vHealth < 880)
{
    // Fail
}
Reply
#6

hm... again losse driveschool if vehhp > or < 880 -_-...

code now:

Код:
function Finish(p) {

new veh;
new Float:vHealth;
GetVehicleHealth(veh, vHealth);
veh = GetPlayerVehicleID(p);
if(WarnCH[p] > 13 || vHealth < 880)return LosseRace(p);
DestroyVehicle(CarDriveSchool[p]);
SCM(p,-1,"You have succses finish drive school! now can you drive any car.");
DataAccount[p][DriveS] = 1;
DataAccount[p][XPs] += 25;
KillTimer(Timerr[p]);
DataAccount[p][Money] += 100;
CheckMoney(p);
SpawnPlayer(p);
DisableDrift[p] = 0;

return 1;
}
Reply
#7

You need to use GetPlayerVehicleID BEFORE GetVehicleHealth..
Reply
#8

ohh yea xD -_- lol i fix it now thx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)