if ( playerData[playerid][playerLevel] < Level_Here )
#14

Quote:
Originally Posted by Hammad123
View Post
Do you mean
pawn Code:
if(playerData[playerid][playerLevel] < Level_Here )
instead of this:
pawn Code:
if ( playerData[playerid][playerLevel] < Level_Here )
?
No, he's referring to
pawn Code:
if ( playerData[playerid][playerLevel] < 6 )
        return SendClientMessage(playerid, -1, "{F81414}[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command." );
        {
Which should be
pawn Code:
if ( playerData[playerid][playerLevel] < 6 )
{
        return SendClientMessage(playerid, -1, "{F81414}[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command." );
}
Or just the following, which I prefer.
pawn Code:
if ( playerData[playerid][playerLevel] < 6 ) return SendClientMessage(playerid, -1, "{F81414}[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command." );

Following, this is how I would simplify the command.

pawn Code:
COMMAND:playertokens(playerid, params[])
{
    if(!playerData[playerid][playerLoggedIn]) return 1; //assume this could be removed since player would not have playerLevel if not logged in?
    if(playerData[playerid][playerLevel] < 6) return SendClientMessage(playerid, -1, "{F81414}[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command." );
   
    new otherID;
    if(!sscanf(params, "u", otherID)) return SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}Usage: \"playertokens <playerid>\"");
    if(!IsPlayerConnected(otherID)) return SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not online!");
    if(!playerData[otherID][playerLoggedIn]) return SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not logged in!");  

    new message[128];          
    format(message, sizeof(message), "{B7B7B7}[INFO] {FFFFFF}%s(%i) has {FFDC2E}%i {FFFFFF}tokens.", playerData[otherID][playerNamee], otherID, playerData[otherID][rTokens]);
    SendClientMessage(playerid, COLOR_WHITE, message);
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)