textdraw not working - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: textdraw not working (
/showthread.php?tid=609112)
textdraw not working -
alexanderjb918 - 08.06.2016
Код:
new Text:Health[MAX_PLAYERS];
new Text:Armour[MAX_PLAYERS];
new Text:Name[MAX_PLAYERS];
forward vitals(playerid);
public vitals(playerid)
{
new string[5];
new Float:pHealth, Float:pArmour;
GetPlayerHealth(playerid,pHealth);
GetPlayerArmour(playerid,pArmour);
format(string, sizeof(string), "%.0f%", pHealth);
TextDrawSetString(Health[playerid], string);
format(string, sizeof(string), "%.0f%", pArmour);
TextDrawSetString(Armour[playerid], string);
}
On ongamemodeinit
Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
Health[i] = TextDrawCreate(566.000000, 67.000000, "100%");
TextDrawBackgroundColor(Health[i], 255);
TextDrawFont(Health[i], 1);
TextDrawLetterSize(Health[i], 0.219999, 0.899999);
TextDrawColor(Health[i], -1);
TextDrawSetOutline(Health[i], 1);
TextDrawSetProportional(Health[i], 1);
Armour[i] = TextDrawCreate(566.000000, 44.000000, "100%");
TextDrawBackgroundColor(Armour[i], 255);
TextDrawFont(Armour[i], 1);
TextDrawLetterSize(Armour[i], 0.219999, 0.899999);
TextDrawColor(Armour[i], -1);
TextDrawSetOutline(Armour[i], 1);
TextDrawSetProportional(Armour[i], 1);
}
SetTimer("vitals",1000,1);
On player update
Код:
new Float:pArmour;
GetPlayerArmour(playerid, pArmour);
if(pArmour == 0)
{
TextDrawHideForPlayer(playerid, Armour[playerid]);
}
else
{
TextDrawShowForPlayer(playerid, Armour[playerid]);
}
Код:
TextDrawShowForPlayer(playerid, Health[playerid]);
It does not update the textdraw shows and stays at 100%? any idea.s
Re: textdraw not working -
Gammix - 08.06.2016
Use
https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw