Problem with stats textdraw
#1

Sup folks,

I'm currently creating a stats textdraw but im having some trouble.

I use strings to show your name/if youre muted/vip name/
But instead of showing ie. Muted: No.
It shows Muted: 78
This also happens @ vip name and at Name: it shows name: 66
Can somebody help me please? I will +REP!

This is the code:

Код:
CMD:stats(playerid, params[])
{
	if(gPlayerLogged[playerid] == 1)
	{
	 	new string[128];
     	new name[MAX_PLAYER_NAME];
		GetPlayerName(playerid, name, sizeof(name));
		new cash =  GetPlayerMoney(playerid);
		new atext[20];
		if(PlayerInfo[playerid][pMuted] == 0)
		{ atext = "No"; }
		else if(PlayerInfo[playerid][pMuted] == 1)
		{ atext = "Yes"; }
		new drank[20];
		if(PlayerInfo[playerid][pVip] == 1)
		{ drank = "Bronze Donator"; }
		else if(PlayerInfo[playerid][pVip] == 2)
		{ drank = "Silver Donator"; }
		else if(PlayerInfo[playerid][pVip] == 3)
		{ drank = "Gold Donator"; }
		else if(PlayerInfo[playerid][pVip] == 4)
		{ drank = "Platinum Donator"; }
		else { drank = "None"; }
		new warns = PlayerInfo[playerid][pWarns];
		new skin = PlayerInfo[playerid][pModel];
		format(string,sizeof(string),"~G~- ~Y~Name: %d",name);
	    TextDrawSetString(Text:StatsText2,string);
	    
	    format(string,sizeof(string),"~G~- ~Y~Kills: %d",PlayerInfo[playerid][pKills]);
	    TextDrawSetString(Text:StatsText3,string);

		format(string,sizeof(string),"~G~- ~Y~Deaths: %d",PlayerInfo[playerid][pDeaths]);
		TextDrawSetString(Text:StatsText4,string);
		
		format(string,sizeof(string),"~G~- ~Y~Money: %d",cash);
		TextDrawSetString(Text:StatsText6,string);
		
		format(string,sizeof(string),"~G~- ~Y~Skin: %d",skin);
		TextDrawSetString(Text:StatsText7,string);
		
		format(string,sizeof(string),"~G~- ~Y~VIP: %d",drank);
		TextDrawSetString(Text:StatsText8,string);
		
		format(string,sizeof(string),"~G~- ~Y~Muted: %d",atext);
		TextDrawSetString(Text:StatsText10,string);
		
		format(string,sizeof(string),"~G~- ~Y~Warnings: %d",warns);
		TextDrawSetString(Text:StatsText11,string);
		
		TextDrawShowForPlayer(playerid, StatsText0);
		TextDrawShowForPlayer(playerid, StatsText1);
		TextDrawShowForPlayer(playerid, StatsText2);
		TextDrawShowForPlayer(playerid, StatsText3);
		TextDrawShowForPlayer(playerid, StatsText4);
		TextDrawShowForPlayer(playerid, StatsText5);
		TextDrawShowForPlayer(playerid, StatsText6);
		TextDrawShowForPlayer(playerid, StatsText7);
		TextDrawShowForPlayer(playerid, StatsText8);
		TextDrawShowForPlayer(playerid, StatsText9);
		TextDrawShowForPlayer(playerid, StatsText10);
		TextDrawShowForPlayer(playerid, StatsText11);
		TextDrawShowForPlayer(playerid, StatsText13);
	}
	else
	{
		SCM(playerid, COLOR_GREY,"You are not logged in!");
	}
	return 1;
}
Reply
#2

If its a string, you need "%s" not "%d".
The %d marker is for an integer, like %f is for a float..

Thats it simple thing, replace the %d with a %s where your var is a string and your fine..
Reply
#3

Ah glad to hear!
Will try it out mate

EDIT:
Works perfect now! Thanks mate! +REPPED
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)