GetFactionRank
#1

I'm using this stock to get a certain faction's rank but it's not working(nothing is shown):

pawn Код:
GetFactionRank(playerid)
{
    new facrank[24];
    new string[24];
    if(PlayerInfo[playerid][pFactionRank] == 1)
    {
        format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank1]);
    }
    else if(PlayerInfo[playerid][pFactionRank] == 2)
    {
        format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank2]);
    }
    else if(PlayerInfo[playerid][pFactionRank] == 3)
    {
        format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank3]);
    }
    else if(PlayerInfo[playerid][pFactionRank] == 4)
    {
        format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank4]);
    }
    else if(PlayerInfo[playerid][pFactionRank] == 5)
    {
        format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank5]);
    }
    else if(PlayerInfo[playerid][pFactionRank] == 6)
    {
        format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank6]);
    }// hmm
    switch(PlayerInfo[playerid][pFactionRank])
    {
        case 1:
        facrank = string;
        case 2:
        facrank = string;
        case 3:
        facrank = string;
        case 4:
        facrank = string;
        case 5:
        facrank = string;
        case 6:
        facrank = string;
        default:
        facrank = "None";
    }
    return facrank;
}
Reply
#2

Try:
pawn Код:
GetFactionRank(playerid)
{
    new string[24];
    switch(PlayerInfo[playerid][pFactionRank])
    {
        case 1: format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank1]);
        case 2: format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank2]);
        case 3: format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank3]);
        case 4: format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank4]);
        case 5: format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank5]);
        case 6: format(string, sizeof(string), "%s", FacInfo[PlayerInfo[playerid][pFaction]][fRank6]);
        default: string = "None";
    }
    return string;
}
Reply
#3

Nope. Still don't work!
(When you type /radio IG it comes up: ** NAME: TEXT)
No rank name.
Reply
#4

You should really learn to use arrays instead of doing things like this:

pawn Код:
new var1;
new var2;
new var3;
new var4;
new var5;

// ->

new var[5];
Reply
#5

how u use it in your GM or FS?
Reply
#6

pawn Код:
CMD:r(playerid, params[])
{
    if(PlayerInfo[playerid][pFaction] == 1 || PlayerInfo[playerid][pFaction] == 2)
    {
        new string[128], text[70];
        if(sscanf(params, "s[70]", text)) return ShowInfoForPlayer(playerid, "~r~Error:~w~ /r [text]", 5000);
        format(string, sizeof(string), "(Radio) ** %s %s: %s", GetFactionRank(playerid), GetPlayerNameEx(playerid), text);
        SendClientMessageToLSPD(COLOR_BLUE, string);
    }
    else ShowInfoForPlayer(playerid, "~r~Error:~w~ You're not in a Law Enforcement Faction.", 5000);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)