28.12.2010, 00:20
pawn Code:
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
}
}
}