Make textdraw show rank - 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: Make textdraw show rank (
/showthread.php?tid=426080)
Make textdraw show rank -
Eminem 2ka9 - 27.03.2013
I want a text to appear under the wanted stars as "Rank: General" (Or whatever rankname)
This is the Rank Name Variable:
This is the text draw.
pawn Код:
RankStars = TextDrawCreate(499.000000, 122.000000, "Rank: ");
TextDrawBackgroundColor(RankStars, 255);
TextDrawFont(RankStars, 2);
TextDrawLetterSize(RankStars, 0.480000, 1.100000);
TextDrawColor(RankStars, -1);
TextDrawSetOutline(RankStars, 1);
TextDrawSetProportional(RankStars, 1);
This is the stock:
pawn Код:
stock RankName(playerid)
{
new rank = Rank(playerid);
new rankname[24];
if(rank == 1) rankname = RANK1NAME;
if(rank == 2) rankname = RANK2NAME;
if(rank == 3) rankname = RANK3NAME;
if(rank == 4) rankname = RANK4NAME;
if(rank == 5) rankname = RANK5NAME;
if(rank == 6) rankname = RANK6NAME;
if(rank == 7) rankname = RANK7NAME;
if(rank == 8) rankname = RANK8NAME;
if(rank == 9) rankname = RANK9NAME;
return rankname;
}
Re: Make textdraw show rank -
Glad2BeHere - 27.03.2013
pawn Код:
stock RankName(playerid)
{
new rank = GetPlayerScore(playerid); //change the value rank to suit....
new rankname[24];
if(rank == 1) format(rankname,sizeof(rankname),"%s", RANK1NAME);
if(rank == 2) format(rankname,sizeof(rankname),"%s", RANK2NAME);
if(rank == 3) format(rankname,sizeof(rankname),"%s", RANK3NAME);
if(rank == 4) format(rankname,sizeof(rankname),"%s", RANK4NAME);
if(rank == 5) format(rankname,sizeof(rankname),"%s", RANK5NAME);
if(rank == 6) format(rankname,sizeof(rankname),"%s", RANK6NAME);
if(rank == 7) format(rankname,sizeof(rankname),"%s", RANK7NAME);
if(rank == 8) format(rankname,sizeof(rankname),"%s", RANK8NAME);
if(rank == 9) format(rankname,sizeof(rankname),"%s", RANK9NAME);
return rankname;
}
//under on player update do this
new string[100];
format(string, 100, "%s", RankName(playerid));
TextDrawSetString(RankStars, string);
TextDrawShowForPlayer(playerid, RankStars);
Re: Make textdraw show rank -
Eminem 2ka9 - 27.03.2013
It works... but would it be possible to make it look as "Rank: General", because now it only says "General" on it's own, the "Rank: " wasn't added?
pawn Код:
public OnPlayerUpdate(playerid)
{
new string[100];
format(string, 100, "Rank: {FF0000}%s", RankName(playerid));
TextDrawSetString(RankStars, string);
TextDrawShowForPlayer(playerid, RankStars);
return 1;
}
Re: Make textdraw show rank -
Eminem 2ka9 - 27.03.2013
Ok, nevermind, works fine. Just that {FF0000} thing fucked it up lol.
Thanks all, great help. Glad2BeHere.