SA-MP Forums Archive
Faction 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: Faction rank (/showthread.php?tid=287582)



XX - Kingunit - 03.10.2011

<fixed>


Re: Faction rank - [L3th4l] - 03.10.2011

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



Re: Faction rank - TheLazySloth - 03.10.2011

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


Re: Faction rank - Kingunit - 03.10.2011

<fixed>


Re: Faction rank - Kingunit - 03.10.2011

<fixed>


Re: Faction rank - grand.Theft.Otto - 03.10.2011

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;
}



Re: Faction rank - Kush - 03.10.2011

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;




Re: Faction rank - DRIFT_HUNTER - 03.10.2011

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