SA-MP Forums Archive
3dtextlabel help - 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: 3dtextlabel help (/showthread.php?tid=656996)



3dtextlabel help - Jing_Chan - 29.07.2018

pawn Код:
new Text3D:ranklabel = Create3DTextLabel("Rank", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
    Update3DTextLabelText(ranklabel, 0xFFFFFFFF, "%s", GetPlayerDMRank);
    Attach3DTextLabelToPlayer(ranklabel, playerid, 0.0, 0.0, 0.7);
Obviously this doesn't work, but I hope you can see the logic behind it. I have a stock function which works out their DM rank name, and I'd like to attach this rank to their head - can anyone help? Thanks


Re: 3dtextlabel help - Rufio - 29.07.2018

How can you even figure out the player's DM rank name without passing in the player ID to the function? GetPlayerDMRank simply won't work as you are not passing anything to the function.

That's unless GetPlayerDMRank is a local variable which you set to a string inside the function you're calling GetPlayerDMRank.


Re: 3dtextlabel help - Jing_Chan - 29.07.2018

Quote:
Originally Posted by Rufio
Посмотреть сообщение
How can you even figure out the player's DM rank name without passing in the player ID to the function? GetPlayerDMRank simply won't work as you are not passing anything to the function.

That's unless GetPlayerDMRank is a local variable which you set to a string inside the function you're calling GetPlayerDMRank.
pawn Код:
GetPlayerDMRank(playerid)
{
    new rankname[36];
   
    if(PlayerInfo[playerid][pScore] >= 100 && PlayerInfo[playerid][pScore] < 249) { rankname = "Beginner"; }
    else if(PlayerInfo[playerid][pScore] >= 250 && PlayerInfo[playerid][pScore] < 499) { rankname = "Advanced Beginner"; }
.. etc
That's the function


Re: 3dtextlabel help - Rufio - 29.07.2018

Change your code to this and it'll work;

pawn Код:
new Text3D:ranklabel = Create3DTextLabel("Rank", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
    Update3DTextLabelText(ranklabel, 0xFFFFFFFF, "%s", GetPlayerDMRank(playerid));
    Attach3DTextLabelToPlayer(ranklabel, playerid, 0.0, 0.0, 0.7);
You are using a function without passing in the required parameter.


Re: 3dtextlabel help - Jing_Chan - 29.07.2018

Quote:
Originally Posted by Rufio
Посмотреть сообщение
Change your code to this and it'll work;

pawn Код:
new Text3D:ranklabel = Create3DTextLabel("Rank", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
    Update3DTextLabelText(ranklabel, 0xFFFFFFFF, "%s", GetPlayerDMRank(playerid));
    Attach3DTextLabelToPlayer(ranklabel, playerid, 0.0, 0.0, 0.7);
You are using a function without passing in the required parameter.
Of course, literally completely forgot about (playerid) lmao - will test it


Re: 3dtextlabel help - d1git - 29.07.2018

PHP код:
new
     
string[32]
;
format(stringsizeof string"%s"GetPlayerDMRank(playerid));
Update3DTextLabelText(ranklabel0xFFFFFFFFstring); 



Re: 3dtextlabel help - Rufio - 29.07.2018

Quote:
Originally Posted by Jing_Chan
Посмотреть сообщение
Of course, literally completely forgot about (playerid) lmao - will test it
My bad, you also need to format your string. Like d1git said.