SA-MP Forums Archive
Oban cmd - 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: Oban cmd (/showthread.php?tid=572619)



Oban cmd - Shady - 30.04.2015

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



Re: Oban cmd - SecretBoss - 30.04.2015

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


Re: Oban cmd - trablon - 30.04.2015

Код:
`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.


Re: Oban cmd - SecretBoss - 30.04.2015

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


Re: Oban cmd - Ghazal - 30.04.2015

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.


Re: Oban cmd - trablon - 30.04.2015

Ohh i thought it was boolean type, my bad.


Re: Oban cmd - SecretBoss - 02.05.2015

oh you can also add some dialogs