04.02.2013, 15:17
Hey,
i have created an filterscript for showing 3d Bar life car but, when i see a player i look sandglass a left the name..
it's the OnPlayerUpdate() ?
i have created an filterscript for showing 3d Bar life car but, when i see a player i look sandglass a left the name..
it's the OnPlayerUpdate() ?
PHP код:
#define filterscripts
#include <a_samp>
new Text3D:CarLabel[MAX_VEHICLES];
new CarID[MAX_VEHICLES];
UpdateLife(playerid);
UpdateString(Float:Health, playerid);
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
CarID[playerid] = GetPlayerVehicleID(playerid);
CarLabel[playerid] = Create3DTextLabel("", -1, 0, 0, 1, 20.0, 0, 1);
Attach3DTextLabelToVehicle(CarLabel[playerid], CarID[playerid], 0, 0, 1);
UpdateLife(playerid);
}
else
{
Delete3DTextLabel(CarLabel[playerid]);
}
return 1;
}
public OnPlayerUpdate(playerid)
{
UpdateLife(playerid);
}
UpdateLife(playerid)
{
new Float:Health;
GetVehicleHealth(CarID[playerid], Health);
UpdateString(Health, playerid);
}
UpdateString(Float:Health, playerid)
{
new str[28];
if(Health == 1000) format(str,sizeof(str),"{00ff00}__________");
else if(Health >= 900) format(str,sizeof(str),"{66ff00}_________{ffffff}_");
else if(Health >= 800) format(str,sizeof(str),"{7fff00}________{ffffff}__");
else if(Health >= 700) format(str,sizeof(str),"{ccff00}_______{ffffff}___");
else if(Health >= 600) format(str,sizeof(str),"{f7f21a}______{ffffff}____");
else if(Health >= 500) format(str,sizeof(str),"{f4c430}_____{ffffff}_____");
else if(Health >= 400) format(str,sizeof(str),"{e49b0f}____{ffffff}______");
else if(Health >= 300) format(str,sizeof(str),"{e4650e}___{ffffff}_______");
else if(Health >= 250) format(str,sizeof(str),"{ff2400}__{ffffff}________");
else format(str,sizeof(str),"{ff2400}Boom!");
Update3DTextLabelText(CarLabel[playerid], -1, str);
}