22.04.2011, 18:19
Whoh Nice ! But i need it for a car xD
You might be able to do it yourself by looking at the code. Do notice that the vehicle health decreases very rapidly when on fire, so you might wish not to execute the code there. You'll most probably need to find another callback, as there isn't anything like OnPlayerUpdate for vehicles.
|
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
new str[4];
new Float:Pos[3];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
format(str, 4, "%.1f", amount);
new Text3D:hitbar = Create3DTextLabel(str, 0xFF0000FF, Pos[0], Pos[1], Pos[2] + 0.6, 30.0, 0);
SetTimerEx("UpdateHitBar", 66, 0, "iffffii", playerid, amount, Pos[0], Pos[1], Pos[2] + 0.8, 16, 0xFF0000FF);
SetPVarInt(playerid, "hidbar_HitBar", _:hitbar + 1);
return 1;
}
new Float:Pos[3];
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
new str[4];
new Float:tPos[3];
GetPlayerPos(playerid, tPos[0], tPos[1], tPos[2]);
format(str, 4, "%.1f", amount);
new Text3D:hitbar = Create3DTextLabel(str, 0xFF0000FF, tPos[0], tPos[1], tPos[2] + 0.6, 30.0, 0);
SetTimerEx("UpdateHitBar", 66, 0, "iffffii", playerid, amount, tPos[0], tPos[1], tPos[2] + 0.8, 16, 0xFF0000FF);
SetPVarInt(playerid, "hidbar_HitBar", _:hitbar + 1);
return 1;
}
PHP Code:
|