Oban cmd
#1

Hello, I'm trying to make oban but I don't know why It doesn't work

pawn Код:
COMMAND:oban(playerid, params[])
{
    if(playerData[playerid][playerLoggedIn])
    {
        if(playerData[playerid][playerLevel] >= 5)
        {
            new otherID[40];

            if(sscanf(params, "s[40]", otherID))
            {
                SendClientMessage(playerid, COLOR_ORANGE, "Usage: \"oban <playername/id>\"");
            }
            else
            {
                new oban[200];

                // Query
                format(oban, sizeof(oban), "SELECT * FROM `playerbans` WHERE `player_banned` = '%s'", otherID);
                mysql_query(oban, MYSQL_REMOVE_BAN, playerid, connection);
            }
        }
        else
        {
            return 0;
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}You must be logged in to use commands.");
    }

    return 1;
}
Reply
#2

Whats the errors? Or its just dont remove player's ban?
Reply
#3

Код:
`player_banned` = '%s'"
Really? You must use it as integer.

correct is:

Код:
`player_banned` = '%i'"
..and also if you are using sscanf, you don't have to use string, just "u"(user id or user name) if you want to ban him in online condition.
Reply
#4

pawn Код:
mysql_query(oban, MYSQL_REMOVE_BAN, playerid, connection);
This remove player's ban and you want to ban him offline so you have to use this one

pawn Код:
mysql_query(oban, MYSQL_ADD_BAN, playerid, connection);
I hope this helped you
Reply
#5

Quote:
Originally Posted by trablon
Посмотреть сообщение
Код:
`player_banned` = '%s'"
Really? You must use it as integer.

correct is:

Код:
`player_banned` = '%i'"
..and also if you are using sscanf, you don't have to use string, just "u"(user id or user name) if you want to ban him in online condition.
Nah, it should be %s.
player_banned is for getting the player banned name, not checking if he is banned or not.
Reply
#6

Ohh i thought it was boolean type, my bad.
Reply
#7

oh you can also add some dialogs
Reply


Forum Jump:


Users browsing this thread: