SA-MP Forums Archive
Help with textdraw - 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: Help with textdraw (/showthread.php?tid=321664)



Help with textdraw - John Rockie - 27.02.2012

Hello guys. I have provided a picture showing the problem.
Basically I am trying to show the player's rank to show as a textdraw. Ex: Private
But instead it shows a number.

Picture:


Code:
pawn Код:
//On Top
       new rank[MAX_PLAYERS][12];
       //Onplayerupdate
    new string[ 128 ];
   
    if(PlayerInfo[playerid][pKills] < 0) rank[playerid]="NONE";
        else if(PlayerInfo[playerid][pKills] < 50) rank[playerid]="Private";
    else if(PlayerInfo[playerid][pKills] < 300) rank[playerid]="Sergeant";
    else if(PlayerInfo[playerid][pKills] < 500) rank[playerid]="Major";
    else if(PlayerInfo[playerid][pKills] < 800) rank[playerid]="Lieuteant 1";
    else if(PlayerInfo[playerid][pKills] < 1200) rank[playerid]="Lieuteant 2";
    else if(PlayerInfo[playerid][pKills] < 1500) rank[playerid]="Captain";
    else if(PlayerInfo[playerid][pKills] < 3000) rank[playerid]="General";
    format( string, sizeof string, "%d", rank[ playerid ] );
    TextDrawSetString( Textdraw0, string );



Re: Help with textdraw - Vince - 27.02.2012

%d is for decimals only. Use %s for string.
Alternatively, you could just do:
pawn Код:
TextDrawSetString(Textdraw0, rank[playerid]);



Re: Help with textdraw - John Rockie - 27.02.2012

Haha. Never pages attention to that.