MuhammadZeeshan

checkban function and baninfo cmd

Dec 13th, 2016
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. function CheckBan( player )
  2. {
  3.  
  4. local q = QuerySQL( db, "SELECT * FROM Bans WHERE UID='" + player.UniqueID + "' COLLATE NOCASE" );
  5. local uid = GetSQLColumnData( q, 5 ), b_time =GetSQLColumnData( q, 1 ), b_exp = GetSQLColumnData(q, 2 );
  6.  
  7. if ( uid )
  8. {
  9. if ( time() - b_time >= b_exp )
  10. {
  11. QuerySQL( db, "DELETE FROM Bans WHERE UID=" + player.UniqueID + "'" );
  12. MessagePlayer("Your ban has been expired, stick to the rules.", player );
  13. EchoMessage1(ICOL_BLUE+"> "+player.Name+"'s UID was unbanned." );
  14. }
  15. else
  16. {
  17. local t_left = time() - b_time;
  18. local t_left_ = b_exp - t_left;
  19.  
  20. ServerMessage( "Auto kicking "+player.Name+" as he is currently banned in server, Timeleft: "+Duration( t_left_ )+"." );
  21. EchoMessage( ICOL_RED+"Auto kicking "+player.Name+" as he is currently banned in server. Timeleft: "+Duration( t_left_ )+"." );
  22. EchoMessage1( ICOL_RED+"Auto kicking "+player.Name+" as he is currently banned in server. Timeleft: "+Duration( t_left_ )+"." );
  23. SendMessage( "Banned by: [ "+GetSQLColumnData(q, 4)+" ] Reason: [ "+GetSQLColumnData(q, 3)+" ] For unban appeals apply on forum, Forum: " +Forum+ ".", player );
  24. KickPlayer( player );
  25. }
  26. }
  27. FreeSQLQuery( q );
  28. }
  29.  
  30. else if ( cmd == "!baninfo" )
  31. {
  32. if ( level < 2 ) EchoNotice1( user, ICOL_RED + "Error - Your level is not high enough to use that command." );
  33. else if ( !text ) EchoNotice1( user, ICOL_RED + "Error - Syntax: " + cmd + " <FullNick> ");
  34. local q = QuerySQL( db, "SELECT * FROM Bans WHERE Name='" + text + "' COLLATE NOCASE" );
  35. if ( !GetSQLColumnData( q, 0 ) ) EchoNotice1( user, ICOL_RED + "Error "+text+" -is not in our banlist ");
  36. else
  37. {
  38. local b_time = GetSQLColumnData( q, 1 ), b_exp = GetSQLColumnData( q, 2 );
  39. local t_left = time() - b_time;
  40. local t_left_ = b_exp - t_left;
  41. EchoNotice1( user, "Player [ " +text+ " ] Banned by: [ " +GetSQLColumnData(q, 4 )+ " ] for Reason: [ " +GetSQLColumnData(q, 3 )+ " ] TimeLeft: [ " +Duration( t_left_ )+ " ]." );
  42. GetSQLNextRow( q );
  43.  
  44. }
  45. }
Add Comment
Please, Sign In to add comment