SA-MP Forums Archive
Hi , help me . I want the name that appears in " RANK " also appears on the head of the player. - 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: Hi , help me . I want the name that appears in " RANK " also appears on the head of the player. (/showthread.php?tid=589386)



Hi , help me . I want the name that appears in " RANK " also appears on the head of the player. - FACCOESRIO - 18.09.2015

Hi , help me . I want the name that appears in " RANK " also appears on the head of the player.

Code:
#include <a_samp>

new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
new rank[ MAX_PLAYERS ];

public OnFilterScriptInit()
{
	Textdraw0 = TextDrawCreate(41.600021, 291.359832, "Score:~g~");
	TextDrawBackgroundColor(Textdraw0, 255);
	TextDrawFont(Textdraw0, 2);
	TextDrawLetterSize(Textdraw0, 0.420398, 2.831994);
	TextDrawColor(Textdraw0, 16777215);
	TextDrawSetOutline(Textdraw0, 1);
	TextDrawSetProportional(Textdraw0, 1);

	Textdraw1 = TextDrawCreate(41.600021, 311.359832, "Money:~g~");
	TextDrawBackgroundColor(Textdraw1, 255);
	TextDrawFont(Textdraw1, 2);
	TextDrawLetterSize(Textdraw1, 0.420398, 2.831994);
	TextDrawColor(Textdraw1, 16777215);
	TextDrawSetOutline(Textdraw1, 1);
	TextDrawSetProportional(Textdraw1, 1);

	Textdraw2 = TextDrawCreate(41.600021, 271.359832, "Patente:~g~");
	TextDrawBackgroundColor(Textdraw2, 255);
	TextDrawFont(Textdraw2, 2);
	TextDrawLetterSize(Textdraw2, 0.420398, 2.831994);
	TextDrawColor(Textdraw2, 16777215);
	TextDrawSetOutline(Textdraw2, 1);
	TextDrawSetProportional(Textdraw2, 1);
	return 1;
}

public OnPlayerSpawn( playerid )
{
	TextDrawShowForPlayer( playerid, Textdraw0 );
	TextDrawShowForPlayer( playerid, Textdraw1 );
	TextDrawShowForPlayer( playerid, Textdraw2 );
	return 1;
}

public OnPlayerUpdate( playerid )
{
	new string[ 128 ];
	new score;
    score = GetPlayerScore(playerid);
	format( string, sizeof string, "Score:~g~ %d", score );
    TextDrawSetString(Textdraw0, string);
	new cash;
	cash = GetPlayerMoney( playerid );
	format( string, sizeof string, "Money:~g~ %d", cash );
	TextDrawSetString(Textdraw1, string );
	if(GetPlayerScore(playerid) >= 800) rank[ playerid ] = 6;
	else if(GetPlayerScore(playerid) >= 500) rank[ playerid ] = 5;
	else if(GetPlayerScore(playerid) >= 300) rank[ playerid ] = 4;
	else if(GetPlayerScore(playerid) >= 150) rank[ playerid ] = 3;
	else if(GetPlayerScore(playerid) >= 100) rank[ playerid ] = 2;
	else if(GetPlayerScore(playerid) >= 50) rank[ playerid ] = 1;
	else if(GetPlayerScore(playerid) >= 0) rank[ playerid ] = 0;
	switch(rank[playerid])
{
case 0: TextDrawSetString( Textdraw2, "Rank:~r~ Novato");
case 1: TextDrawSetString( Textdraw2, "Rank:~y~ Mediano");
case 2: TextDrawSetString( Textdraw2, "Rank:~g~ Bom");
case 3: TextDrawSetString( Textdraw2, "Rank:~g~ Reliquia");
case 4: TextDrawSetString( Textdraw2, "Rank:~g~ Avancado");
case 5: TextDrawSetString( Textdraw2, "Rank:~g~ Brabo");
case 6: TextDrawSetString( Textdraw2, "Rank:~g~ Profissional");
}
	return 1;
}
thanks in advance



Re: Hi , help me . I want the name that appears in " RANK " also appears on the head of the player. - HydraHumza - 18.09.2015

Create 3d text label simple


Re: Hi , help me . I want the name that appears in " RANK " also appears on the head of the player. - FACCOESRIO - 18.09.2015

Quote:
Originally Posted by Humza
View Post
Create 3d text label simple
I can not create Humza could help me ?


Re: Hi , help me . I want the name that appears in " RANK " also appears on the head of the player. - nezo2001 - 18.09.2015

PHP Code:
 new Text3D:TextIDCreate3DTextLabel(text[], colorFloat:XFloat:YFloat:ZFloat:DrawDistancevirtualworldtestLOS);
Attach3DTextLabelToPlayer(TextIDplayerid0.00.00.7); 



Re: Hi , help me . I want the name that appears in " RANK " also appears on the head of the player. - JordanZaundd - 18.09.2015

PHP Code:
new tmp[64];
format(tmpsizeof(tmp), "[RANK %d] %s"rankGetPlayerName(playerid));
SetPlayerName(playeridtmp); 
It will show up on your nametag as "[RANK 3] Jordan Zaundd"


Re: Hi , help me . I want the name that appears in " RANK " also appears on the head of the player. - FACCOESRIO - 19.09.2015

Quote:
Originally Posted by JordanZaundd
View Post
Code:
new tmp[64];
format(tmp, sizeof(tmp), "[RANK %d] %s", rank, GetPlayerName(playerid)); <-----------------------------------
SetPlayerName(playerid, tmp);
2 Warnings. number of arguments does not match definition

Because you gave error on that line?


Re: Hi , help me . I want the name that appears in " RANK " also appears on the head of the player. - FACCOESRIO - 21.09.2015

Someone help me? Please


Re: Hi , help me . I want the name that appears in " RANK " also appears on the head of the player. - nezo2001 - 21.09.2015

which line


Re: Hi , help me . I want the name that appears in " RANK " also appears on the head of the player. - FACCOESRIO - 21.09.2015

I think I'm having trouble passing the correct information help I ask.

1. I want the name of "rank" also appear on the head of the player, for all players know the "rank" of his rival.

2 . in-game to TextDraw owned a bug / error, I do not know'm not specify connoisseur, the bug is that the Score, Rank, Money is changing when some other player logs.

When you enter another player on the server, it is appearing altering my score and the score of the other player, and so with Rank and Money
----------------------------------------------------

Thank you all, and I ask you to help me as fast as they can because my server is online and I could only see the bug when he began entering the players.


Re: Hi , help me . I want the name that appears in " RANK " also appears on the head of the player. - Sasino97 - 21.09.2015

Quote:
Originally Posted by FACCOESRIO
View Post
2 Warnings. number of arguments does not match definition

Because you gave error on that line?
Because GetPlayerName has 3 arguments, but the guy typed wrong code
Code:
new tmp[64];
format(tmp, sizeof(tmp), "[RANK %d] %s", rank, GetPlayerName(playerid));
SetPlayerName(playerid, tmp);
to

Code:
new tmp[64], name[24];
GetPlayerName(playerid, name, 24);
format(tmp, sizeof(tmp), "[RANK %d] %s", rank, name);
SetPlayerName(playerid, tmp);