SA-MP Forums Archive
changeable 3dtext above a players head - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: changeable 3dtext above a players head (/showthread.php?tid=178823)



changeable 3dtext above a players head - chaosnz - 24.09.2010

Im a bit stumped and i cant seem to find any posts to help me with what im looking for.

I was looking at the test_cmds.pwn file we get in the filterscripts folder as part of the server package and i was wondering about adding this particular code to my gamemode..

Код:
	if(strcmp(cmd, "/updateplayerlabel", true) == 0) {
	    UpdatePlayer3DTextLabelText(playerid, playertextid, 0xFFFFFFFF, "");
		return 1;
	}
Now, what im wondering is, when you type the above command, and say something after it for example.
"/updateplayerlabel testing" will it display "testing" or will it be blank?

If its going to be blank, what can i do to get it to actually show what the player types in after the command?

Any help would be appreciated greatly.


Re: changeable 3dtext above a players head - Voldemort - 24.09.2010

pawn Код:
UpdatePlayer3DTextLabelText(playerid, playertextid, 0xFFFFFFFF, "");
Text is Here
pawn Код:
UpdatePlayer3DTextLabelText(playerid, playertextid, 0xFFFFFFFF, "Hello World!");
Thats not a chat, its function to display text

EDIT: what you need to do is:
pawn Код:
new Player3DText:Text[MAX_PLAYERS];

CreatePlayer3DLabel(...

//and than with

format(string,sizeof(string),"%s says: %s",Playername,text);
UpdatePlayer3DTextLabelText(playerid, Text[playerid], 0xFFFFFFFF,string);
I just move you to right deriction, rest learn by self.


Re: changeable 3dtext above a players head - chaosnz - 26.09.2010

ok so heres what i tried..

Код:
	if(strcmp(cmd, "/label", true) == 0) {
        new tmp2[256];
		tmp2 = strtok(cmdtext,idx);
		new label;
		label =  Create3DTextLabel(strval(tmp2),COLOR_YELLOW,0,0,0,50,0);
		Attach3DTextLabelToPlayer(label,playerid,0,0,-0.1);
	    return 1;
	}
yet it wont compile. Can anyone please tell me what im doing wrong?


Re: changeable 3dtext above a players head - Shadow™ - 26.09.2010

pawn Код:
new tmp2[256];
        tmp2 = strtok(cmdtext,idx);
delete that, you don't need it.