unban problem(same as kokia)

Started by KAKAN, Jul 23, 2015, 08:29 AM

Previous topic - Next topic

KAKAN

    else if ( cmd == "unban" )
    {
       if ( stats[ player.ID ].Level < 4 ) MessagePlayer( "Error - You don't have access to it.", player);
       else if ( !text ) MessagePlayer( "Error - Syntax: /unban <player name>", player);
       else
       {       
         local query = QuerySQL( sqliteDB, "SELECT * FROM Bans WHERE Name='" + text + "'" );
         if( GetSQLColumnData( query, 0 ) ) Unban( text );
         else MessagePlayer( "This nick isn't banned. Please type the banned nick.", player );
         FreeSQLQuery( query );
       }
    }

Every time I try to unban anyone, it shows "This nick isn't banned. Please type the banned nick.", I need help tho
oh no

Thijn

Are you actually banned? Check your database.

KAKAN

I tried to ban myself and then I banned it, its in the db file, but I can't unban me from /unban cmd, if no ways are there then i'll have to unban myself using DB
oh no

Thijn


KAKAN

LOL, I posted it in codes, see the topic xD
anyways here it is:-
    else if ( cmd == "unban" )
    {
       if ( stats[ player.ID ].Level < 4 ) MessagePlayer( "Error - You don't have access to it.", player);
       else if ( !text ) MessagePlayer( "Error - Syntax: /unban <player name>", player);
       else
       {       
         local query = QuerySQL( sqliteDB, "SELECT * FROM Bans WHERE Name='" + text + "'" );
         if( GetSQLColumnData( query, 0 ) ) Unban( text );
         else MessagePlayer( "This nick isn't banned. Please type the banned nick.", player );
         FreeSQLQuery( query );
       }
    }
oh no

Thijn


KAKAN

Oh sorry I mistaken it, sorry
here is the code:-
    else if ( cmd == "ban" )
    {
       if ( stats[ player.ID ].Level < 4 ) MessagePlayer( "Error - You don't have access to it.", player);
       else if ( !text ) MessagePlayer( "Error - Syntax: /ban <player> <reason>", player);
       else
       {
         local plr = GetPlayer( GetTok( text, " ", 1 ) );
         if ( !plr ) MessagePlayer( "Error - Unknown player.", player);
         else
         {
           local reason = GetTok( text, " ", 2 );
           if ( !reason ) reason = "None";
           Ban( plr, reason );
   kick.plr();
         }
       }
    }

Sorry :(
oh no

Thijn

Post your Ban function as well :P

KAKAN

k
here it is:-
function Ban( player, reason )
{
    QuerySQL( sqliteDB, "INSERT INTO Bans VALUES('" + player.Name.tolower() + "', '" + player.IP + "', '" + player.UniqueID + "', '" + reason + "')" );
    Message( "" + player.Name + " have been banned from the server. Reason: " + reason + "." );
}
oh no

Thijn

In that case you should fix that SQL query in your unban function to use Name='" + text.tolower() + "'

KAKAN

oh no