textdraw not working
#1

Код:
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
Reply
#2

Use https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)