tessék:
#include <a_samp>
new Text:HealthBar[MAX_PLAYERS];
new Text:ArmourBar[MAX_PLAYERS];
new Text:VehHealthBar[MAX_PLAYERS];
new Text:VehHealthBox1[MAX_PLAYERS];
new Text:VehHealthBox3[MAX_PLAYERS];
new Text:VehHealthBox2[MAX_PLAYERS];
public OnFilterScriptInit()
{
print(\"\\n|==========================================================|\");
print(\"| Elet \");
print(\"| Betoltve! \");
print(\"|==========================================================|\\n\");
return 1;
}
public OnPlayerConnect(playerid)
{
HealthBar[playerid] = TextDrawCreate(548.000000, 66.000000, \"100\");
TextDrawBackgroundColor(HealthBar[playerid], 255);
TextDrawFont(HealthBar[playerid], 1);
TextDrawLetterSize(HealthBar[playerid], 0.280000, 1.000000);
TextDrawColor(HealthBar[playerid], -1);
TextDrawSetOutline(HealthBar[playerid], 1);
TextDrawSetProportional(HealthBar[playerid], 1);
ArmourBar[playerid] = TextDrawCreate(548.000000, 43.000000, \"100\");
TextDrawBackgroundColor(ArmourBar[playerid], 255);
TextDrawFont(ArmourBar[playerid], 1);
TextDrawLetterSize(ArmourBar[playerid], 0.290000, 1.100000);
TextDrawColor(ArmourBar[playerid], -1);
TextDrawSetOutline(ArmourBar[playerid], 1);
TextDrawSetProportional(ArmourBar[playerid], 1);
VehHealthBox1[playerid] = TextDrawCreate(547.000000, 9.000000, \"..........\");
TextDrawBackgroundColor(VehHealthBox1[playerid], 255);
TextDrawFont(VehHealthBox1[playerid], 3);
TextDrawLetterSize(VehHealthBox1[playerid], 0.599999, 3.999999);
TextDrawColor(VehHealthBox1[playerid], 255);
TextDrawSetOutline(VehHealthBox1[playerid], 1);
TextDrawSetProportional(VehHealthBox1[playerid], 1);
VehHealthBox2[playerid] = TextDrawCreate(549.000000, 22.000000, \"~g~..........\");
TextDrawBackgroundColor(VehHealthBox2[playerid], 912665855);
TextDrawFont(VehHealthBox2[playerid], 3);
TextDrawLetterSize(VehHealthBox2[playerid], 0.560000, 2.200000);
TextDrawColor(VehHealthBox2[playerid], -1);
TextDrawSetOutline(VehHealthBox2[playerid], 1);
TextDrawSetProportional(VehHealthBox2[playerid], 1);
VehHealthBox3[playerid] = TextDrawCreate(549.000000, 22.000000, \"~g~~h~.........\");
TextDrawBackgroundColor(VehHealthBox3[playerid], 1369064191);
TextDrawFont(VehHealthBox3[playerid], 3);
TextDrawLetterSize(VehHealthBox3[playerid], 0.560000, 2.200000);
TextDrawColor(VehHealthBox3[playerid], -1);
TextDrawSetOutline(VehHealthBox3[playerid], 1);
TextDrawSetProportional(VehHealthBox3[playerid], 1);
VehHealthBar[playerid] = TextDrawCreate(548.000000, 32.000000, \"100\");
TextDrawBackgroundColor(VehHealthBar[playerid], 255);
TextDrawFont(VehHealthBar[playerid], 1);
TextDrawLetterSize(VehHealthBar[playerid], 0.290000, 1.100000);
TextDrawColor(VehHealthBar[playerid], -1);
TextDrawSetOutline(VehHealthBar[playerid], 1);
TextDrawSetProportional(VehHealthBar[playerid], 1);
return 1;
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid,HealthBar[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox1[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox2[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox3[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBar[playerid]);
TextDrawShowForPlayer(playerid,ArmourBar[playerid]);
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
TextDrawHideForPlayer(playerid,HealthBar[playerid]);
TextDrawHideForPlayer(playerid,VehHealthBox1[playerid]);
TextDrawHideForPlayer(playerid,VehHealthBox2[playerid]);
TextDrawHideForPlayer(playerid,VehHealthBox3[playerid]);
TextDrawHideForPlayer(playerid,VehHealthBar[playerid]);
TextDrawHideForPlayer(playerid,ArmourBar[playerid]);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
TextDrawSetString(HealthBar[playerid],\"Meghaltal!\");
return 1;
}
public OnPlayerUpdate(playerid)
{
new Float:Health;
new HealthString[15];
GetPlayerHealth(playerid,Health);
format(HealthString, 15, \" %d\",floatround(Health));
TextDrawSetString(HealthBar[playerid],HealthString);
TextDrawShowForPlayer(playerid,HealthBar[playerid]);
new Float:Armour;
GetPlayerArmour(playerid,Armour);
if(Armour > 0)
{
new ArmourString[15];
format(ArmourString, 15, \" %d\",floatround(Armour));
TextDrawSetString(ArmourBar[playerid],ArmourString);
TextDrawShowForPlayer(playerid,ArmourBar[playerid]);
}
else
{
TextDrawHideForPlayer(playerid,ArmourBar[playerid]);
}
if(IsPlayerInAnyVehicle(playerid))
{
new Float:VehHealth;
new TrueVehHealth;
new VehHealthString[15];
GetVehicleHealth(GetPlayerVehicleID(playerid),VehHealth);
TrueVehHealth = floatround(floatround(VehHealth - 250)/ 7.5);
format(VehHealthString, 15, \" %d\",floatround(TrueVehHealth));
TextDrawSetString(VehHealthBar[playerid],VehHealthString);
if (TrueVehHealth == -33)
{
TextDrawSetString(VehHealthBar[playerid],\"Halal\");
TextDrawSetString(VehHealthBox3[playerid],\"~g~~h~\");
TextDrawShowForPlayer(playerid,VehHealthBox1[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox2[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox3[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBar[playerid]);
}
else if (TrueVehHealth < 1)
{
TextDrawSetString(VehHealthBar[playerid],\"Tuz!\");
TextDrawSetString(VehHealthBox3[playerid],\"~g~~h~\");
TextDrawShowForPlayer(playerid,VehHealthBox1[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox2[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox3[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBar[playerid]);
}
else if (TrueVehHealth < 10)
{
TextDrawSetString(VehHealthBox3[playerid],\"~g~~h~.\");
TextDrawShowForPlayer(playerid,VehHealthBox1[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox2[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox3[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBar[playerid]);
}
else if (TrueVehHealth < 20)
{
TextDrawSetString(VehHealthBox3[playerid],\"~g~~h~..\");
TextDrawShowForPlayer(playerid,VehHealthBox1[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox2[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox3[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBar[playerid]);
}
else if (TrueVehHealth < 30)
{
TextDrawSetString(VehHealthBox3[playerid],\"~g~~h~...\");
TextDrawShowForPlayer(playerid,VehHealthBox1[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox2[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox3[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBar[playerid]);
}
else if (TrueVehHealth < 40)
{
TextDrawSetString(VehHealthBox3[playerid],\"~g~~h~....\");
TextDrawShowForPlayer(playerid,VehHealthBox1[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox2[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox3[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBar[playerid]);
}
else if (TrueVehHealth < 50)
{
TextDrawSetString(VehHealthBox3[playerid],\"~g~~h~.....\");
TextDrawShowForPlayer(playerid,VehHealthBox1[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox2[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox3[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBar[playerid]);
}
else if (TrueVehHealth < 60)
{
TextDrawSetString(VehHealthBox3[playerid],\"~g~~h~......\");
TextDrawShowForPlayer(playerid,VehHealthBox1[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox2[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox3[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBar[playerid]);
}
else if (TrueVehHealth < 70)
{
TextDrawSetString(VehHealthBox3[playerid],\"~g~~h~.......\");
TextDrawShowForPlayer(playerid,VehHealthBox1[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox2[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox3[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBar[playerid]);
}
else if (TrueVehHealth < 80)
{
TextDrawSetString(VehHealthBox3[playerid],\"~g~~h~........\");
TextDrawShowForPlayer(playerid,VehHealthBox1[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox2[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox3[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBar[playerid]);
}
else if (TrueVehHealth < 90)
{
TextDrawSetString(VehHealthBox3[playerid],\"~g~~h~.........\");
TextDrawShowForPlayer(playerid,VehHealthBox1[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox2[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox3[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBar[playerid]);
}
else if (TrueVehHealth < 100)
{
TextDrawSetString(VehHealthBox3[playerid],\"~g~~h~..........\");
TextDrawShowForPlayer(playerid,VehHealthBox1[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox2[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox3[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBar[playerid]);
}
else if (TrueVehHealth == 100)
{
TextDrawSetString(VehHealthBox3[playerid],\"~g~~h~..........\");
TextDrawShowForPlayer(playerid,VehHealthBox1[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox2[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBox3[playerid]);
TextDrawShowForPlayer(playerid,VehHealthBar[playerid]);
}
}
else
{
TextDrawHideForPlayer(playerid,VehHealthBox1[playerid]);
TextDrawHideForPlayer(playerid,VehHealthBox2[playerid]);
TextDrawHideForPlayer(playerid,VehHealthBox3[playerid]);
TextDrawHideForPlayer(playerid,VehHealthBar[playerid]);
}
return 1;
}
public OnFilterScriptExit()
{
for(new i; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
TextDrawDestroy(VehHealthBox1);
TextDrawDestroy(VehHealthBox2);
TextDrawDestroy(VehHealthBox3);
TextDrawDestroy(VehHealthBar);
TextDrawDestroy(HealthBar);
TextDrawDestroy(ArmourBar);
}
}
return 1;
}