Advertisement
iSmirnoff

[Filter Script] Sistema de Bans v1.0

Jun 10th, 2013
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.40 KB | None | 0 0
  1. // ======================================= //
  2. //               # Includes #              //
  3. // ======================================= //
  4. #include  A_SaMP   «
  5. #include   DoF2    «
  6. #include   zCmD    «
  7. #include  SSCanF2  «
  8.  
  9. #define xCor_AzulBB              0x33CCFFAA //
  10.  
  11. #define Kick(%0) SetTimerEx("Kicka", 100, false, "i", %0) // By Paulor
  12. #define Ban(%0) SetTimerEx("Bana", 100, false, "i", %0) // By Paulor
  13.  
  14. forward Bana(p); public Bana(p) {
  15.     #undef Ban
  16.     Ban(p);
  17.     #define Ban(%0) SetTimerEx("Bana", 100, false, "i", %0)
  18.     return 1;
  19. }
  20. forward Kicka(p); public Kicka(p) {
  21.     #undef Kick
  22.     Kick(p);
  23.     #define Kick(%0) SetTimerEx("Kicka", 100, false, "i", %0)
  24.     return 1;
  25. }
  26.  
  27. new
  28.     Segundo, Minuto, Hora, Dia, Mes, Ano ;
  29.  
  30. stock xNome ( playerid )
  31. {
  32.     new nOME [ 21 ] ;
  33.     GetPlayerName ( playerid, nOME, 21 ) ;
  34.     return nOME;
  35. }
  36.  
  37. public OnFilterScriptInit ()
  38. {
  39.     print ("# ============================= #") ;
  40.     print ("# Sistema de Bans By Smirnoff   #");
  41.     print ("# ============================= #");
  42.     return 1;
  43. }
  44.  
  45. public OnFilterScriptExit ()
  46. {
  47.     DOF2_Exit () ;
  48.     return 1;
  49. }
  50.  
  51. public OnPlayerRequestClass ( playerid, classid )
  52. {
  53.     new
  54.         xCelulas [ 180 ], xPastaxX [ 64 ], xPasta2 [ 64 ], xPasta3 [ 64 ], xIP [ 16 ] ;
  55.  
  56.     format ( xPasta3, 60, "AgendadosBan/%s.ini", xNome ( playerid ) ) ;
  57.  
  58.     if ( DOF2_FileExists ( xPasta3 ) )
  59.     {
  60.         format ( xCelulas, 180, "       Banido\n\n\nStatus: Banido\n\nAdmin %s\n\nMotivo: %s\n\nConta: %s\n\n\nFoi injusto? tire SS e poste revisão no fórum\n\nseuforum.com.br", DOF2_GetString ( xPasta3, "Admin" ), DOF2_GetString ( xPasta3, "Motivo" ), xNome ( playerid ) ) ;
  61.         ShowPlayerDialog ( playerid, 5555, DIALOG_STYLE_MSGBOX, "BANIDO", xCelulas, "Fechar","" ) ;
  62.         Kicka ( playerid ) ;
  63.     }
  64.  
  65.     format ( xPastaxX, 60, "Banidos/%s.ini", xNome ( playerid ) ) ;
  66.  
  67.     if ( DOF2_FileExists ( xPastaxX ) )
  68.     {
  69.         format ( xCelulas, 180, "       Banido\n\n\nStatus: Banido\n\nAdmin %s\n\nMotivo: %s\n\nConta: %s\n\n\nFoi injusto? tire SS e poste revisão no fórum\n\nseuforum.com.br", DOF2_GetString ( xPastaxX, "Admin" ), DOF2_GetString ( xPastaxX, "Motivo" ), xNome ( playerid ) ) ;
  70.         ShowPlayerDialog ( playerid, 5556, DIALOG_STYLE_MSGBOX, "BANIDO", xCelulas, "Fechar","" ) ;
  71.         Kicka ( playerid ) ;
  72.     }
  73.  
  74.     GetPlayerIp ( playerid, xIP, 16 ) ;
  75.  
  76.     format ( xPasta2, 60, "IPsBanidos/%s.ini", xIP ) ;
  77.  
  78.     if ( DOF2_FileExists ( xPasta2 ) )
  79.     {
  80.         format ( xCelulas, 180, "       Banido\n\n\nStatus: Banido\n\nAdmin %s\n\nMotivo: %s\n\nConta: %s\n\nIP: %s\n\n\nFoi injusto? tire SS e poste revisão no fórum\n\nseuforum.com.br", DOF2_GetString ( xPasta2, "Admin" ), DOF2_GetString ( xPasta2, "Motivo" ), xNome ( playerid ), DOF2_GetString ( xPasta2, "IP" ) ) ;
  81.         ShowPlayerDialog ( playerid, 5557, DIALOG_STYLE_MSGBOX, "BANIDO", xCelulas, "Fechar","" ) ;
  82.         Kicka ( playerid ) ;
  83.     }
  84.     return 1;
  85. }
  86.  
  87. COMMAND:banir ( playerid, params [] )
  88. {
  89.     new
  90.         xID, xMotivo [ 50 ], xCelulas [ 190 ], Negro [ 21 ], xPastaa [ 64 ], xPastaS [ 64 ], xDats [ 14 ], xHoraa [ 22 ], xIP [ 16 ] ;
  91.  
  92.     if ( !IsPlayerConnected ( playerid ) )
  93.         return SendClientMessage ( playerid, -1, "[ ERRO ]: Você não está logado" ) ;
  94.  
  95.     if ( sscanf ( params, "us[50]", xID, xMotivo ) )
  96.         return SendClientMessage ( playerid, -1, "[ USE ]: /banir [ID] [Motivo]" ) ;
  97.  
  98.     if ( !IsPlayerConnected ( playerid ) )
  99.         return SendClientMessage ( playerid, -1, "[ ERRO ]: ID não conectado" ) ;
  100.  
  101.     GetPlayerName ( xID, Negro, 21 ) ;
  102.  
  103.     getdate ( Ano, Mes, Dia ) ;
  104.  
  105.     gettime ( Hora, Minuto, Segundo ) ;
  106.  
  107.     format ( xDats, 14, "%d/%d/%d", Dia, Mes, Ano ) ;
  108.  
  109.     format ( xHoraa, 22, "%d:%d:%d", Hora, Minuto, Segundo ) ;
  110.  
  111.     format ( xCelulas, 128, "[ BanSystem ]: %s foi banido do servidor pelo administrador %s, Motivo: %s", Negro, xNome ( playerid ), xMotivo ) ;
  112.     SendClientMessageToAll ( xCor_AzulBB, xCelulas ) ;
  113.  
  114.     format ( xCelulas, 190, "       Banido\n\n\nStatus: Banido\n\nAdmin %s\n\nMotivo: %s\n\nConta: %s\n\n\nTire SS e poste revisão no fórum\n\nseuforum.com.br", xNome ( playerid ), xMotivo, Negro ) ;
  115.     ShowPlayerDialog ( xID, 55, DIALOG_STYLE_MSGBOX, "Banido do Servidor",  xCelulas, "Sair", "" )  ;
  116.  
  117.     Kicka ( xID ) ;
  118.  
  119.     GetPlayerIp ( xID, xIP, 16 ) ;
  120.  
  121.     format ( xPastaa, 40, "Banidos/%s.ini", Negro ) ;
  122.  
  123.     if ( DOF2_CreateFile ( xPastaa ) )
  124.     {
  125.         DOF2_SetString ( xPastaa, "Admin", xNome ( playerid ) ) ;
  126.         DOF2_SetString ( xPastaa, "Motivo", xMotivo ) ;
  127.         DOF2_SetString ( xPastaa, "Data", xDats ) ;
  128.         DOF2_SetString ( xPastaa, "Hora", xHoraa ) ;
  129.         DOF2_SaveFile (  ) ;
  130.     }
  131.     format ( xPastaS, 40, "IPsBanidos/%s.ini", xIP );
  132.     if ( DOF2_CreateFile ( xPastaS ) )
  133.     {
  134.         DOF2_SetString ( xPastaS, "Admin", xNome ( playerid ) ) ;
  135.         DOF2_SetString ( xPastaS, "Motivo", xMotivo ) ;
  136.         DOF2_SetString ( xPastaS, "Data", xDats ) ;
  137.         DOF2_SetString ( xPastaS, "Hora", xHoraa ) ;
  138.         DOF2_SetString ( xPastaS, "IP", xIP ) ;
  139.         DOF2_SaveFile () ;
  140.     }
  141.     return 1 ;
  142. }
  143. COMMAND:agendarban ( playerid, params[] )
  144. {
  145.     new
  146.         LekNome [ 20+1 ], LekBan [ 20+1 ], LekMotivo [ 25 ], LekArquivo [ 64 ], LekCelulas [ 128 ], LekData [ 14 ], LekHora [ 22 ] ;
  147.  
  148.     if ( sscanf ( params, "s[21]s[25]", LekNome, LekMotivo ) )
  149.         return SendClientMessage ( playerid, xCor_AzulBB, "[ USE ]: /agendarban [Nick_Sobrenick] [Motivo]" ) ;
  150.  
  151.     format ( LekArquivo, 64, "Contas/%s.ini", LekNome ) ;
  152.  
  153.     if ( !DOF2_FileExists ( LekArquivo ) )
  154.         return SendClientMessage ( playerid, xCor_AzulBB, "[ ERRO ]: Está conta não existe no banco de dados" ) ;
  155.  
  156.     format ( LekCelulas, 128, "[ BanSystem ]: Admin %s agendou ban no nick %s. Motivo: %s", xNome ( playerid ), LekNome, LekMotivo ) ;
  157.     SendClientMessageToAll ( xCor_AzulBB, LekCelulas ) ;
  158.  
  159.     getdate ( Ano, Mes, Dia ) ;
  160.  
  161.     gettime ( Hora, Minuto, Segundo ) ;
  162.  
  163.     format ( LekData, 14, "%d/%d/%d", Dia, Mes, Ano ) ;
  164.  
  165.     format ( LekHora, 22, "%d:%d:%d", Hora, Minuto, Segundo ) ;
  166.  
  167.     format ( LekBan, 64, "AgendadosBan/%s.ini", LekNome ) ;
  168.  
  169.     if ( DOF2_CreateFile ( LekBan ) )
  170.     {
  171.         DOF2_SetString ( LekBan, "Admin", xNome ( playerid ) ) ;
  172.         DOF2_SetString ( LekBan, "Motivo", LekMotivo ) ;
  173.         DOF2_SetString ( LekBan, "Data", LekData ) ;
  174.         DOF2_SetString ( LekBan, "Hora", LekHora ) ;
  175.         DOF2_SaveFile () ;
  176.     }
  177.     return 1 ;
  178. }
  179. COMMAND:retirarbana ( playerid, params[] )
  180. {
  181.     new
  182.         xCelulas [ 128 ], xPastaX [ 64 ], xNomesX [ 21 ] ;
  183.  
  184.     if ( sscanf ( params, "s[21]", xNomesX ) )
  185.         return SendClientMessage ( playerid, xCor_AzulBB, "[ USE ]: /retirarbana [Nick]");
  186.  
  187.     format ( xPastaX, 64, "AgendadosBan/%s.ini", xNomesX ) ;
  188.  
  189.     if ( fexist( xPastaX ) )
  190.     {
  191.         DOF2_RemoveFile ( xPastaX ) ;
  192.         SendClientMessage ( playerid, xCor_AzulBB, "[ AVISO ]: Conta agendada desbanida com sucesso");
  193.  
  194.         format ( xCelulas, 128, "[ BanSystem ]: Admin %s retirou o agendamento de ban do nick %s", xNome ( playerid ), xNomesX ) ;
  195.         SendClientMessage ( playerid, xCor_AzulBB, xCelulas ) ;
  196.     }
  197.     else return SendClientMessage ( playerid, xCor_AzulBB, "[ ERRO ]: Este nick não está agendado" ) ;
  198.     return 1 ;
  199. }
  200. COMMAND:desbanirconta ( playerid, params[] )
  201. {
  202.     new
  203.         xCelulas [ 128 ], xPastaX [ 64 ], xNomesX [ 21 ] ;
  204.  
  205.     if ( sscanf ( params, "s[21]", xNomesX ) )
  206.         return SendClientMessage ( playerid, xCor_AzulBB, "[ USE ]: /desbanconta [Nick]");
  207.  
  208.     format ( xPastaX, 64, "Banidos/%s.ini", xNomesX ) ;
  209.  
  210.     if ( fexist( xPastaX ) )
  211.     {
  212.         DOF2_RemoveFile ( xPastaX ) ;
  213.         SendClientMessage ( playerid, xCor_AzulBB, "[ AVISO ]: Conta desbanida com sucesso");
  214.  
  215.         format ( xCelulas, 128, "[ BanSystem ]: Admin %s desbaniu a conta %s", xNome ( playerid ), xNomesX ) ;
  216.         SendClientMessage ( playerid, xCor_AzulBB, xCelulas ) ;
  217.     }
  218.     else return SendClientMessage ( playerid, xCor_AzulBB, "[ ERRO ]: Este nick não está banido" ) ;
  219.     return 1;
  220. }
  221. COMMAND:desbanirip ( playerid, params[] )
  222. {
  223.     static
  224.         xCelulas [ 128 ], xPastaXx [ 64 ], xIP [ 16 ] ;
  225.  
  226.     if ( sscanf ( params, "s[16]", xIP ) )
  227.         return SendClientMessage ( playerid, xCor_AzulBB, "[ USE ]: /desbanconta [IP]");
  228.  
  229.     format ( xPastaXx, 64, "IPsBanidos/%s.ini", xIP ) ;
  230.  
  231.     if ( fexist( xPastaXx ) )
  232.     {
  233.         DOF2_RemoveFile ( xPastaXx ) ;
  234.         SendClientMessage ( playerid, -1, "[ AVISO ]: Conta desbanida com sucesso");
  235.  
  236.         format ( xCelulas, 128, "[ BanSystem ]: Admin %s desbaniu o IP %s", xNome ( playerid ), xIP ) ;
  237.         SendClientMessage ( playerid, xCor_AzulBB, xCelulas ) ;
  238.     }
  239.     else return SendClientMessage ( playerid, xCor_AzulBB, "[ ERRO ]: Este IP não está banido" ) ;
  240.     return 1;
  241. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement