Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - Broly

#1
Well i give proper command but the function said  "Wrong format, day:hour:min (Numeric)"
What's wrong ?



function IRCAddBan( nick, player, expire, reason = "No Reason" )

{

try{

     //Equation = (DAYS*24*60*60) + (HOUR*60*60) + (MIN*60)

     local ban_Expire = split( expire, ":" ); //days:hours:minutes

if( NumTok( expire, ":" ) == 3 )

{

if( IsNum( ban_Expire[ 0 ] ) &&  IsNum( ban_Expire[ 1 ] ) && IsNum( ban_Expire[ 2 ] ) )

{

         if( ban_Expire[ 0 ].tointeger() <= 31 && ban_Expire[ 1 ].tointeger() <= 24 && ban_Expire[ 2 ].tointeger() <= 60 )

{

        local ban_Expires = ( (ban_Expire[ 0 ].tointeger()*24*60*60) + (ban_Expire[ 1 ].tointeger()*60*60) + (ban_Expire[ 2 ].tointeger()*60) ), 

                    Calc = ban_Expire[ 0 ] + " days " + ban_Expire[ 1 ] + " hours " + ban_Expire[ 2 ] + " minutes.",

                    query = QuerySQL( db, "INSERT INTO Tempban( ban_nick, ban_ip, ban_time, ban_expire, ban_expireratio, ban_admin, ban_reason ) VALUES ( '"+ player.Name.tostring() +"','"+ player.IP.tostring() +"','"+ time().tostring() +"', '"+ ban_Expires.tostring() +"', '" + expire.tostring() + "', '"+ nick.tostring() +"', '"+ reason.tostring() +"')");

Message( "Admin " + nick + " has tempbanned " + player.Name + " Reason: " + reason + " for " + Calc + "" );

StaffMessage( user, ICOL_RED + "You have tempbanned " + player.Name + " successfully!" );

StaffMessage( ICOL_RED + "[" + player.ID + "] " + player.Name + " left the Server. (Kicked)." );

KickPlayer( player );

}

}

else StaffMessage( ICOL_RED + "Time should be numeric (day:hour:min)" );

}

else StaffMessage( ICOL_RED + "Wrong format, day:hour:min (Numeric)" );

}

catch(e) print( "Tempban function Error: " + e );

}

 
and command

else if ( cmd == "tempban" )
     {
      try{
   local txt_Split;
          if ( FindLevel( nick, false )== "User" ) StaffMessage(  ICOL_RED + "You have to be admin to use this command." );
else if( text == "" ) {
StaffMessage(   ICOL_RED + "Syntax, !tempban <player/ID> <day:hour:min> <reason>");
return;
}else
                {
                if( NumTok( text, " " ) == 2 )
{
     txt_Split = split( text, " " );
local plr = GetPlayer( txt_Split[ 0 ] ), expire = txt_Split[ 1 ];
if( plr ) IRCAddBan( nick, plr, expire );
else StaffMessage(   ICOL_RED + "Error: Invalid player." );
}
else if( NumTok( text, " " ) >= 3 )
{
     txt_Split = split( text, " " );
                     local plr = GetPlayer( txt_Split[ 0 ] ), expire = txt_Split[ 1 ], reason = txt_Split[ 2 ];
if( plr ) IRCAddBan( nick, plr, expire, reason );
else StaffMessage( ICOL_RED + "Error: Invalid player." );
}
else StaffMessage(  ICOL_RED + "Syntax, !tempban <player/ID> <day:hour:min> <reason>");
  }
  }
   catch(e) print( "Tempban error: " + e );
     }
P.S
i use
else if( text == "" ) 
instead of
[code]if( !text )
#2
Hi friends
well first please don't laugh i am just a noob scripter ( beginner ) i am using this  Diego^ Alias System - IP/SUBNET/UID and trying to make Offline alias for irc  but its not work

else if ( cmd == "!ogetip" )
{

local q = QuerySQL(db, "SELECT * FROM Alias WHERE Name='" + text + "'");
  if ( !text ) StaffMessage(  ICOL_RED + "Syntax, " + cmd + " <full nickname>" );
else if ( GetSQLColumnData( q, 0 ) != text ) EchoMessage( ICOL_RED + "Error: This nickname is not registered." );
else if( (GetSQLColumnData( q, 0 ) == text ) || (GetSQLColumnData( q1, 0 ) == text ) )
{
 ShowAlias( text, plr, "ip" );
}

FreeSQLQuery( q );
}
}
and function
function ShowAlias( player, plr, option )
{
if ( option == "ip" )
{
local i = 0, a = Alias.len(), b;
while( i < a )
{
if ( plr.IP == Alias[i].IP && plr.Name != Alias[i].Nick )
{
if ( b ) b = b + ", " + Alias[i].Nick;
else b = Alias[i].Nick;
}
i ++;
}
if ( !b ) StaffMessage( " "+ plr.Name + " has no IP alias." );
else StaffMessage( "[IP-ALIAS] "+ plr.Name + "'s IP alias: " + b + "." );
}
else if ( option == "subnet" )
{
local i = 0, a = Alias.len(), b;
local getsub_1 = split( player.IP, "." ),
sub_1 = getsub_1[0] + getsub_1[1];
while( i < a )
{
local getsub_2 = split( Alias[i].IP, "." ),
sub_2 = getsub_2[0] + getsub_2[1];
if ( sub_1 == sub_2 && plr.Name != Alias[i].Nick )
{
if ( b ) b = b + ", " + Alias[i].Nick;
else b = Alias[i].Nick;
}
i ++;
}
if ( !b ) StaffMessage( "[Server] "+ plr.Name + " has no subnet alias." );
else StaffMessage( "[IP-ALIAS] "+ plr.Name + "'s IP alias: " + b + "." );
}
else if ( option == "uid" )
{
local i = 0, a = Alias.len(), b;
while( i < a )
{
if ( plr.UniqueID == Alias[i].UID && plr.Name != Alias[i].Nick )
{
if ( b ) b = b + ", " + Alias[i].Nick;
else b = Alias[i].Nick;
}
i ++;
}
if ( !b ) StaffMessage( "[Server]"+ plr.Name + " has no uid alias." );
else StaffMessage( "[IP-ALIAS] "+ plr.Name + "'s IP alias: " + b + "." );
}
}
Any help would appreciate
#3
Check the function please, is there any problem with it ? actually its showing wrong level on IRC i use  print( FindLevel(user, false) ) to find my real level in consel and it shows you're USER but i have ( ~ ) sign on IRC here's the code

else if ( EventID == "366" )
{
// A dynamic array to store each user's class instance in.
NickList <- [];

// Now, Lets parse the names query.
local
FindUsers = split( raw[ 0 ], ":" ),
users = split( FindUsers[ 1 ], " " );

// Iterate our parsed list of users.
for ( local i = 0; i < users.len(); i++ )
{
// Establish the level symbol.
local
Level = users[ i ].slice( 0, 1 );

if ( Level == "~" ) NickList.push( UserLevels( users[ i ].slice( 1, users[ i ].len() ), "Owner", 5 ) );
else if ( Level == "&" ) NickList.push( UserLevels( users[ i ].slice( 1, users[ i ].len() ), "SOP", 4 ) );
else if ( Level == "@" ) NickList.push( UserLevels( users[ i ].slice( 1, users[ i ].len() ), "AOP", 3 ) );
else if ( Level == "%" ) NickList.push( UserLevels( users[ i ].slice( 1, users[ i ].len() ), "HOP", 2 ) );
else if ( Level == "+" ) NickList.push( UserLevels( users[ i ].slice( 1, users[ i ].len() ), "VOP", 1 ) );
else NickList.push( UserLevels( users[ i ], "User", 0 ) );
}
}

picture