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
Are you actually banned? Check your database.
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
Show your ban command.
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 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 :(
Post your Ban function as well :P
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 + "." );
}
In that case you should fix that SQL query in your unban function to use Name='" + text.tolower() + "'
Thanks, it worked!
Locked.