3dtextlabel help
#1

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
Reply
#2

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.
Reply
#3

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
Reply
#4

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.
Reply
#5

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
Reply
#6

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

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.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)