Quote:
Originally Posted by jujuv
pawn Code:
public OnPlayerUpdate(playerid) { if(GetPlayerState(playerid) == 2) { new Float:vehHealth;// we crate a new var (type Float value 0.0) new Float:playerArmour; new curentVeh = GetPlayerVehicleID(playerid); GetVehicleHealth(curentVeh, vehHealth);//we get the vehicle damaged health and store the returned value in vehHealth(value returned e.g: 95.2) vehHealth = vehHealth/10; SetPlayerHealth(playerid, vehHealth);// we set the playerhealth at the value of vehHealth(value of VehHealth after passed in this function e.g : 95) if(GetPlayerArmour(playerid,playerArmour) != 0) { SetPlayerArmour(playerid,0); SetPlayerHealth(playerid, vehHealth); } }
}
It's works but i think it use more bandwich :/
|
That's probably because you call it whenever the player updates, which is like several times a second depending on what the player is doing. I guess he's driving a vehicle out from the information you gave us. Make a callback and a timer or something.