Faction rank
#1

<fixed>
Reply
#2

Use strcat to copy strings:
pawn Код:
strcat(PlayerInfo[id][Rank], rank);
Edit: You also missed the string param in sscanf:
pawn Код:
"us[24]"
Reply
#3

try /setrank <playerid> <RankID> that's what you made that command for.
Reply
#4

<fixed>
Reply
#5

<fixed>
Reply
#6

If you're using dini, try this:

pawn Код:
CMD:setrank(playerid, params[])
{
    new id, rank[24];
   
    if(sscanf(params, "us[24]", id, rank)) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_DGREY"[CMD] / "#COL_SGREY"[PlayerID/PartOfName] [Rank]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_ORANGE"[ERROR]"#COL_LRED" Player not connected!");
   
    new name[24];
    GetPlayerName(id,name,24);
   
    if(udb_Exists(name(id)))
    {
        if(PlayerInfo[id][LoggedIn] == 1) // use ur logged in enum or delete this
        {
            dUserSetINT(name(id)).("Rank",rank);
        }
    }
    return 1;
}
If that doesn't work, try this:

pawn Код:
CMD:setrank(playerid, params[])
{
    new id, rank[24];
   
    if(sscanf(params, "us[24]", id, rank)) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_DGREY"[CMD] / "#COL_SGREY"[PlayerID/PartOfName] [Rank]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_ORANGE"[ERROR]"#COL_LRED" Player not connected!");
   
    new name[24];
    GetPlayerName(id,name,24);
   
    if(udb_Exists(name(id)))
    {
        if(PlayerInfo[id][LoggedIn] == 1) // use ur logged in enum or delete this
        {
            dUserSetINT(name(id)).("Rank",PlayerInfo[id][Rank]);
        }
    }
    return 1;
}
Reply
#7

PHP код:
CMD:setrank(playeridparams[])
{
    new 
        
id
        
rank[24];
        
    if(
sscanf(params"us[64]"idrank)) return SendClientMessage(playeridCOLOR_WHITE""#COL_DGREY"[CMD] / "#COL_SGREY"[PlayerID/PartOfName] [Rank]");
    
else if(id == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_WHITE""#COL_ORANGE"[ERROR]"#COL_LRED" Player not connected!");
    
{
        
PlayerInfo[id][Rank] = rank;
    }
    return 
1;

Reply
#8

pawn Код:
CMD:setrank(playerid, params[])
{
    new id, rank[24];
    if(sscanf(params, "us[24]", id, rank)) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_DGREY"[CMD] / "#COL_SGREY"[PlayerID/PartOfName] [Rank]");
    else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_ORANGE"[ERROR]"#COL_LRED" Player not connected!");

    format(PlayerInfo[id][Rank], 24, "%s", rank);
    return 1;
}
make sure you have in player enum defined rank like Rank[24] cos rank is string
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)