Talk:Scripting/Squirrel/Functions/BanIP

From Vice City Multiplayer
Revision as of 20:35, 21 March 2016 by Kennedyarz (talk | contribs) (→‎Funcion Ban ip: new section)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing

Funcion Ban ip

{

if ( cmd == "ban" )
       {
     if ( !text ) MessagePlayer( "[Syntax] - /" + cmd + " <Nick/ID> <Reason>", player );

else {

 local plr = FindPlayer( 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";
           ( "INSERT INTO SubBans ( Name, IP, Admin, Reason ) VALUES ( '" + plr.Name + "', '" + sub[0].tofloat() + "." + sub[1].tofloat() + "', '" + player.Name + "', '" + reason + "' )" );
           Message( "[#EE82EE]** Admin " + player.Name + " Banned " + plr.Name + " Reason: " + reason );
    BanPlayer( plr );
    }
    }
 }
}