Make textdraw show rank
#1

I want a text to appear under the wanted stars as "Rank: General" (Or whatever rankname)


This is the Rank Name Variable:
pawn Код:
RankName(playerid)

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

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);
Reply
#3

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

Ok, nevermind, works fine. Just that {FF0000} thing fucked it up lol.

Thanks all, great help. Glad2BeHere.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)