Posts: 188
Threads: 49
Joined: Jul 2011
Hello, with Create3DTextLabel i wanted to make a script that's it's show the health & armor number up our head can someone teach me how to do that? Example: Someone has half Health and up his head it's write something like 50.0 HP
Posts: 188
Threads: 49
Joined: Jul 2011
Quote:
Originally Posted by Kingunit
|
Can i change this to Label?
Code:
new Float:shealth;
GetPlayerHealth(giveplayerid,shealth);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "%s Health is: %.2f", giveplayer ,shealth);
SendClientMessage(playerid, COLOR_GRAD1, string);
Posts: 188
Threads: 49
Joined: Jul 2011
Quote:
Originally Posted by [L3th4l]
Here's a rough example:
pawn Code:
#include <a_samp>
new Text3D: gHPLabel[MAX_PLAYERS];
public OnFilterScriptInit() { SetTimer("UpdateLabels", 1000, true); return 1; }
public OnFilterScriptExit() { return 1; }
public OnPlayerConnect(playerid) { gHPLabel[playerid] = Create3DTextLabel(" ", -1, 0.0, 0.0, 0.0, 20.0, GetPlayerVirtualWorld(playerid), true); Attach3DTextLabelToPlayer(gHPLabel[playerid], playerid, 0.0, 0.0, 0.8); return 1; }
public OnPlayerDisconnect(playerid, reason) { Delete3DTextLabel(gHPLabel[playerid]); return 1; }
forward UpdateLabels(); public UpdateLabels() { for(new i = 0; i < MAX_PLAYERS; i++) //foreach(Player, i) { if(IsPlayerConnected(i) && !IsPlayerNPC(i)) { new iStr[30], Float: iHealth[2];
GetPlayerHealth(i, iHealth[0]); GetPlayerArmour(i, iHealth[1]);
format(iStr, sizeof(iStr), "Health: %.0f\nArmour: %.0f", iHealth[0], iHealth[1]); Update3DTextLabelText(gHPLabel[i], -1, iStr); } } }
|
I'll try that.
Posts: 188
Threads: 49
Joined: Jul 2011
Quote:
Originally Posted by KeeDee
I'll try that.
|
Dosen't Working