public OnVehicleDamageStatusUpdate(vehicleid, playerid)///when a vehicle is damage
{
new Float:vehHealth;// we crate a new var (type Float value 0.0)
GetVehicleHealth(vehicleid, vehHealth);//we get the vehicle damaged health and store the returned value in vehHealth(value returned e.g: 95.2)
SetPlayerHealth(playerid, vehHealth);// we set the playerhealth at the value of vehHealth(value of VehHealth after passed in this function e.g : 95)
/*
NB: SetPlayerHealth() automaticaly transform vehHealth (Float) in an integer value
*/
}
public OnVehicleDamageStatusUpdate(vehicleid, playerid)///when a vehicle is damage
{
new Float:vehHealth;// we crate a new var (type Float value 0.0)
vehHealth = GetVehicleHealth(vehicleid, vehHealth);//we get the vehicle damaged health and store the returned value in vehHealth(value returned e.g: 95.2)
SetPlayerHealth(playerid, vehHealth);// we set the playerhealth at the value of vehHealth(value of VehHealth after passed in this function e.g : 95)
/*
NB: SetPlayerHealth() automaticaly transform vehHealth (Float) in an integer value
*/
}
public OnVehicleDamageStatusUpdate(vehicleid, playerid)///when a vehicle is damage
{
new Float:vehHealth;
new Float:vehHealth;// we crate a new var (type Float value 0.0)
vehHealth = GetVehicleHealth(vehicleid, vehHealth);//we get the vehicle damaged health and store the returned value in vehHealth(value returned e.g: 95.2)
SetPlayerHealth(playerid, vehHealth1);// we set the playerhealth at the value of vehHealth(value of VehHealth after passed in this function e.g : 95)
/*
NB: SetPlayerHealth() automaticaly transform vehHealth (Float) in an integer value
*/
}
new Float:vehHealth;
GetVehicleHealth(vehicleid, vehHealth);
SetPlayerHealth(playerid, vehHealth);
pawn Code:
you should write it in percents to get it working right. |
new Float:HP;
GetVehicleHealth(vehicleid, HP);
SetPlayerHealth(playerid, HP / 10);
public OnPlayerUpdate(playerid)// This is a part of a very simply script made by Jujuv
{
if(GetPlayerState(playerid) == 2)
{
new Float:vehHealth;// we crate a new var (type Float value 0.0)
new Float:playerArmour;//we create a new var (type floatvalue 0.0)
new curentVeh = GetPlayerVehicleID(playerid);//Get the vehicle (id) of the player (and store it in curentVeh)
GetVehicleHealth(curentVeh, vehHealth);//Get the vehicle health and store it in vehHealth(value returned e.g: 2500.2)
vehHealth = vehHealth/10;// we divide the value of vehHealth per 10
SetPlayerHealth(playerid, vehHealth);//Set the health of the vehicle at the health of the player(value e.g : 250)
if(GetPlayerArmour(playerid,playerArmour) != 0)// if the armour of the playerArmour is not equal at 0 (player have armour)
{
SetPlayerArmour(playerid,0);//Set the armour ofthe player at 0 ("delete his armour")
SetPlayerHealth(playerid, vehHealth);//Set the health of the vehicle at the health of the player
}
}
}
pawn Code:
|