Simple Ban System From ( Jutt )

Started by Jutt, Oct 09, 2021, 01:27 PM

Previous topic - Next topic

Jutt

Add Him [ Commands.nut ]  ========= [][][][] :-\

if ( cmd == "aban" )
        {
     if ( !text ) MessagePlayer( "[#FDF13D][Syntax] - /" + cmd + " <Nick/ID> <Reason>", player );
else {
 local plr = GetPlayer( GetTok( text, " ", 1 ) );
    if ( !plr ) MessagePlayer( "[Error] - Unknown Player..", player );
    else {
            local reason = GetTok( text, " ", 2 NumTok( text, " " ) );
            local ip = plr.IP;
            local sub = split( ip, "." );
             if ( reason == null ) reason = "None";
             QuerySQL( db, "INSERT INTO SubBans ( Name, IP, Admin, Reason ) VALUES ( '" + plr.Name + "', '" + sub[0].tofloat() + "." + sub[1].tofloat() + "', '" + player.Name + "', '" + reason + "' )" );
            Message( "[#FD3D3D]** Admin " + player.Name + " Banned " + plr.Name + " Reason: " + reason );
    KickPlayer( plr );
    }
    }
 }

else if ( cmd == "aunban" )
 {
 local q = QuerySQL( db,  "SELECT * FROM SubBans WHERE Name='" + text + "'" );
     if ( !text ) MessagePlayer( "[Syntax] - /" + cmd + " <Nick Full>", player );
    else if ( GetSQLColumnData( q, 0 ) != text ) MessagePlayer( "[Error] - " + text + " is not Banned.", player );
    else {
    QuerySQL( db, "DELETE FROM SubBans WHERE Name='" + text + "'" );
    Message( "[#3DACFD]** Admin " + player.Name + " UnBanned Player [ [#FFA500]" + text + " [#EE82EE]]." );
 }
 }
}

==== Finish =======
Jutt

NicusorN5

I bet users are going to use this when they don't have the SubBans table created. This will cause shitton of errors.