Mensajes: 1,072
Temas: 57
Registro en: Feb 2016
Reputación:
8
Hola, estaria buscando este plugin de la imagen
Mensajes: 33
Temas: 8
Registro en: Nov 2016
Reputación:
0
14/09/2018, 07:54 AM
(Última modificación: 14/09/2018, 07:55 AM por jevs31072001 .)
Mensajes: 2,094
Temas: 59
Registro en: Feb 2015
Reputación:
15
Pues cogieron el adv bans que estaba en amxx y lo modificaron así que no creo que encuentres uno así público
(18/11/2014, 05:47 PM) Neeeeeeeeeel.- escribió: Por qué necesitan una guía para todo? Meté mano y que salga lo que salga... es la mejor forma de aprender.
(16/05/2016, 11:08 PM) kikizon2 escribió: No cabe duda que tienen mierda en vez de cerebro, par de pendejos v:
Mensajes: 188
Temas: 77
Registro en: Apr 2015
Reputación:
0
osea es poco común encontrar una persona que aporte algo asi, ya que nadie va hacer algo gratis. (los buenos somos Pocos).
La mente es como un paracaidas, hay que abrirla para que Funcione
Mensajes: 3,238
Temas: 47
Registro en: Feb 2015
Reputación:
34
https://amxmodx-es.com/Thread-Advanced-s...4#pid87234
Es el más parecido que encontré, eso si, vas a tener que sacarle el HWid porque funciona solo con sXe
Mensajes: 188
Temas: 77
Registro en: Apr 2015
Reputación:
0
@Skylar
Tengo una pregunta para ti.. soy nuevo en eso. que se le debe cambiar? he cambiado pero no me compila. puedes ayudarme un poco?
Mensajes: 1,072
Temas: 57
Registro en: Feb 2016
Reputación:
8
Es un tema de 2016 chicos...
PD: Estaría lindo, después quizás, aporte uno con el plugin que hizo @Destro... o con MySQL, veo jajaja.
Mensajes: 1,450
Temas: 59
Registro en: Feb 2015
Reputación:
20
(14/09/2018, 06:51 PM) Niper.-. escribió: Es un tema de 2016 chicos...
PD: Estaría lindo, después quizás, aporte uno con el plugin que hizo @Destro... o con MySQL, veo jajaja.
Código PHP:
#include <amxmodx> #include <sqlx> #if AMXX_VERSION_NUM < 183 #define client_disconnected client_disconnect #endif /* =============================================================================== * [ Plugin initiation & Global stuff ] * =============================================================================== */ #define SetPlayerBit(%1,%2) ( %1 |= ( 1 << ( %2 & 31 ) ) ) #define ClearPlayerBit(%1,%2) ( %1 &= ~( 1 << ( %2 & 31 ) ) ) #define GetPlayerBit(%1,%2) ( %1 & ( 1 << ( %2 & 31 ) ) ) #define GetBanDuration(%0) ( g_iPlayerOption[ %0 ][ Option_Ban ] ? ( get_systime( ) + g_eBanTime[ g_iPlayerOption[ %0 ][ Option_Ban ] ][ Time_Time ] ):g_eBanTime[ 0 ][ Time_Time ] ) #define HasPermission(%0,%1) ( get_user_flags( %0 ) & %1 ) const EV_HID = 4 ; const MAX_TRIES = 9 ; const MIN_CHARS = 24 ; enum _ : Query_Type { Query_Load , Query_Create , Query_Update , Query_Ban , Query_Unban , Query_Banned } enum _ : Option_Type { Option_Ban , Option_Reason } enum _ : Ban_Data { Ban_Time , Ban_Reason , Ban_Banned } enum _ : Time_Data { Time_Type [ 16 ], Time_Time } enum _ : Player_Data { Player_Userid , Player_HID [ 32 ], Player_Nick [ 32 ], Player_Time , Player_Demo , Player_Bans , Player_Played , Player_Reason , Player_Banned } enum _ : Last_Data { Last_Index , Last_Name [ 16 ], Last_Time [ 16 ] } new const g_szReasons [ ][ ] = { "Incumplir reglas" , "Cheat / Hack" , "Spam / Flood" , "FreeKill / Shoot" , "Falta de respeto" , "Demo + Octinium" } new const g_eBanTime [ ][ Time_Data ] = { { "Permanente" , - 1 }, { "Cinco minutos" , 300 }, { "Quince minutos" , 900 }, { "Media hora" , 1800 }, { "Una hora" , 3600 }, { "Medio dia" , 7200 }, { "Un dia" , 86400 } } new g_iSayText ; new g_iConnected ; new g_iMaxPlayers ; new g_szLogFile [ 64 ]; new g_iBanData [ Ban_Data ]; new g_eLastPlayers [ 5 ][ Last_Data ]; new g_ePlayerData [ 33 ][ Player_Data ]; new g_iPlayerOption [ 33 ][ Option_Type ]; new Handle : g_hTuple ; public plugin_init ( ) { register_plugin ( "Advanced Ban System" , "1.0" , "Manu" ); register_clcmd ( "say /id" , "CommandId" ); register_clcmd ( "say /ban" , "ShowMenuBan" ); register_clcmd ( "abs_ban" , "CommandBan" ); register_clcmd ( "abs_info" , "CommandInfo" ); register_clcmd ( "abs_last" , "CommandLast" ); register_clcmd ( "abs_unban" , "CommandUnban" ); register_clcmd ( "abs_banned" , "CommandBanned" ); register_srvcmd ( "sxe_event" , "ev_sXe" ); g_iSayText = get_user_msgid ( "SayText" ); g_iMaxPlayers = get_maxplayers ( ); SQL_Init ( ); } /* =============================================================================== * [ Client-related ] * =============================================================================== */ public ev_sXe ( ) { new iId ; new szData [ 8 ]; read_argv ( 1 , szData , charsmax ( szData ) ); if( str_to_num ( szData ) == EV_HID ) { read_argv ( 2 , szData , charsmax ( szData ) ); if( FindPlayer ( iId , str_to_num ( szData ) ) ) { read_argv ( 5 , g_ePlayerData [ iId ][ Player_HID ], charsmax ( g_ePlayerData [ ][ Player_HID ] ) ); if( strlen ( g_ePlayerData [ iId ][ Player_HID ] ) < MIN_CHARS ) { client_print ( iId , print_console , "Tu hardware id no se pudo verificar." ); client_print ( iId , print_console , "Cualquier duda entra a www.skaviados.net" ); server_cmd ( "kick #%d ^" No pudimos validar tu HID ( Mirar consola )^ "" , get_user_userid ( iId ) ); server_exec ( ); } else { SQL_Query ( iId , Query_Load ); } } } } public KickPlayer ( iId ) { server_cmd ( "kick #%d ^" Ingreso restringido ( Mirar consola )^ "" , get_user_userid ( iId ) ); server_exec ( ); } public CommandLogs ( iId ) { if( ! HasPermission ( iId , ADMIN_BAN ) ) { console_print ( iId , "[ABS] No tienes permisos suficientes para utilizar este comando." ); return PLUGIN_HANDLED ; } new szBuffer [ 192 ]; new szLogs [ 15 ][ 192 ]; new iFile = fopen ( g_szLogFile , "rt" ); while( ! feof ( iFile ) ) { fgets ( iFile , szBuffer , charsmax ( szBuffer ) ); trim ( szBuffer ); remove_quotes ( szBuffer ); if( strlen ( szBuffer ) < 10 ) { continue; } for( new i = 14 ; i > 0 ; i -- ) { szLogs [ i ] = szLogs [ i - 1 ]; } copy ( szLogs [ 0 ], charsmax ( szLogs [ ] ), szBuffer ); } for( new i = 14 ; i >= 0 ; i -- ) { console_print ( iId , "[%d] %s" , ( i + 1 ), szLogs [ i ] ); } fclose ( iFile ); return PLUGIN_HANDLED ; } public CommandInfo ( iId ) { if( ! HasPermission ( iId , ADMIN_BAN ) ) { console_print ( iId , "[ABS] No tienes permisos suficientes para utilizar este comando." ); return PLUGIN_HANDLED ; } new iPlayers [ 32 ]; new szName [ 32 ]; new iNum ; get_players ( iPlayers , iNum ); console_print ( iId , "^n**** Informacion sobre jugadores conectados ****" ); for( new i = 0 ; i < iNum ; i ++ ) { get_user_name ( iPlayers [ i ], szName , charsmax ( szName ) ); console_print ( iId , "Identificador: %05d | Bans: %02d | Nombre: %s." , g_ePlayerData [ iPlayers [ i ] ][ Player_Userid ], g_ePlayerData [ iPlayers [ i ] ][ Player_Bans ], szName ); } return PLUGIN_HANDLED ; } public CommandLast ( iId ) { if( ! HasPermission ( iId , ADMIN_BAN ) ) { console_print ( iId , "[ABS] No tienes permisos suficientes para utilizar este comando." ); return PLUGIN_HANDLED ; } new iPlayers [ 32 ]; new iNum ; get_players ( iPlayers , iNum ); console_print ( iId , "**** Ultimas cinco desconexiones de jugadores ****" ); for( new i = 0 ; i < sizeof ( g_eLastPlayers ); i ++ ) { if( g_eLastPlayers [ i ][ Last_Index ] == 0 ) { break; } console_print ( iId , "[%s] Identificador: %05d | Nombre: %s." , g_eLastPlayers [ i ][ Last_Time ], g_eLastPlayers [ i ][ Last_Index ], g_eLastPlayers [ i ][ Last_Name ] ); } return PLUGIN_HANDLED ; } public CommandBanned ( iId ) { if( ! HasPermission ( iId , ADMIN_BAN ) ) { console_print ( iId , "[ABS] No tienes permisos suficientes para utilizar este comando." ); return PLUGIN_HANDLED ; } console_print ( iId , "[ Identificador | Ultimo nombre | Fecha | Tiempo restante | Razon ]" ); SQL_Query ( iId , Query_Banned ); return PLUGIN_HANDLED ; } public CommandBan ( iId ) { if( ! HasPermission ( iId , ADMIN_BAN ) ) { console_print ( iId , "[ABS] No tienes permisos suficientes para utilizar este comando." ); return PLUGIN_HANDLED ; } new iTarget ; new iTime ; new iFile ; new iReason ; new szIndex [ 8 ]; new szTime [ 8 ]; new szReason [ 8 ]; new szDate [ 32 ]; new szName [ 32 ]; if( read_argc ( ) != 4 ) { console_print ( iId , "[ABS] Comando mal estructurado. Utilizacion: ^" abs_ban < id > < tiempo > < numero de razon > - Permanente : - 1 min ^ "" ); console_print ( iId , "[ABS] Las razones pueden ser:^n^n1. %s^n2. %s" , g_szReasons [ 0 ], g_szReasons [ 1 ] ); console_print ( iId , "3. %s^n4. %s^n5. %s^n6. %s" , g_szReasons [ 2 ], g_szReasons [ 3 ], g_szReasons [ 4 ], g_szReasons [ 5 ] ); return PLUGIN_HANDLED ; } read_argv ( 1 , szIndex , charsmax ( szIndex ) ); if( ( iTarget = str_to_num ( szIndex ) ) > 0 ) { read_argv ( 2 , szTime , charsmax ( szTime ) ); if( ( iTime = str_to_num ( szTime ) ) != 0 && ( 100000 >= iTime >= - 1 ) ) { read_argv ( 3 , szReason , charsmax ( szReason ) ); if( ( 0 <= ( iReason = str_to_num ( szReason ) - 1 ) < sizeof ( g_szReasons ) ) ) { if( ! SearchTarget ( iTarget ) ) { g_iBanData [ Ban_Banned ] = get_systime ( ); g_iBanData [ Ban_Reason ] = iReason ; g_iBanData [ Ban_Time ] = iTime > 0 ? ( get_systime ( ) + ( iTime * 60 ) ) : - 1 ; get_time ( "%d/%m %H:%M:%S" , szDate , charsmax ( szDate ) ); get_user_name ( iId , szName , charsmax ( szName ) ); iFile = fopen ( g_szLogFile , "a" ); fprintf ( iFile , "[BAN] Admin: %s | Identificador: %d | Tiempo: %d min | Razon: %s | Fecha: %s.^n" , szName , iTarget , iTime , g_szReasons [ iReason ], szDate ); fclose ( iFile ); SQL_Query ( iTarget , Query_Ban ); } else { g_ePlayerData [ iTarget ][ Player_Time ] = iTime > 0 ? ( get_systime ( ) + ( iTime * 60 ) ):- 1 ; g_ePlayerData [ iTarget ][ Player_Bans ]++; g_ePlayerData [ iTarget ][ Player_Reason ] = iReason ; g_ePlayerData [ iTarget ][ Player_Banned ] = get_systime ( ); BanPlayer ( iId , iTarget ); } console_print ( iId , "[ABS] Identificador baneado correctamente." ); } else { console_print ( iId , "[ABS] Has introducido una razon que no existe ( solo entre 1 y 6 )." ); } } else { console_print ( iId , "[ABS] No has introducido un tiempo valido ( -1 para permanente )." ); } } else { console_print ( iId , "[ABS] El identificador tiene que ser un numero positivo." ); } return PLUGIN_HANDLED ; } public CommandUnban ( iId ) { if( ! HasPermission ( iId , ADMIN_BAN ) ) { console_print ( iId , "[ABS] No tienes permisos suficientes para utilizar este comando." ); return PLUGIN_HANDLED ; } else if( read_argc ( ) != 2 ) { console_print ( iId , "[ABS] Comando mal estructurado. Utilizacion: ^" abs_unban < identificador >^ "" ); return PLUGIN_HANDLED ; } new iUserid ; new szUserid [ 8 ]; read_argv ( 1 , szUserid , charsmax ( szUserid ) ); if( 0 < ( iUserid = str_to_num ( szUserid ) ) ) { RegisterUnban ( iId , iUserid ); SQL_Query ( iUserid , Query_Unban ); console_print ( iId , "[ABS] Se competo la operacion." ); console_print ( iId , "[ABS] Si el identificador era correcto entonces ha sido desbaneado." ); } else { console_print ( iId , "[ABS] El identificador tiene que ser un numero positivo." ); } return PLUGIN_HANDLED ; } public CommandId ( iId ) { if( g_ePlayerData [ iId ][ Player_Userid ] > 0 ) { PrintColor ( iId , "^x04[ABS]^x01 Tu identificador unico es^x04 %d^x01." , g_ePlayerData [ iId ][ Player_Userid ] ); } return PLUGIN_HANDLED ; } public client_putinserver ( iId ) { SetPlayerBit ( g_iConnected , iId ); get_user_name ( iId , g_ePlayerData [ iId ][ Player_Nick ], charsmax ( g_ePlayerData [ ][ Player_Nick ] ) ); } public client_disconnected ( iId ) { ClearPlayerBit ( g_iConnected , iId ); RegisterDisconnect ( iId ); g_ePlayerData [ iId ][ Player_Played ] += get_user_time ( iId ); SQL_Query ( iId , Query_Update ); g_ePlayerData [ iId ][ Player_Userid ] = 0 ; g_ePlayerData [ iId ][ Player_HID ][ 0 ] = EOS ; } /* =============================================================================== * [ Menu's ] * =============================================================================== */ public ShowMenuBan ( iId ) { if( ! HasPermission ( iId , ADMIN_BAN ) ) { PrintColor ( iId , "^x04[ABS]^x01 No tienes permisos suficientes para acceder a este menu." ); return PLUGIN_HANDLED ; } new szNum [ 8 ]; new szData [ 64 ]; new iMenu = menu_create ( "===========================^n \wSistema de ban^n\y===========================" , "BanHandler" ); formatex ( szData , charsmax ( szData ), "Cambiar tiempo \y[\r%s\y]" , g_eBanTime [ g_iPlayerOption [ iId ][ Option_Ban ] ][ Time_Type ] ); menu_additem ( iMenu , szData , "b" ); formatex ( szData , charsmax ( szData ), "Cambiar motivo \y[\r%s\y]^n" , g_szReasons [ g_iPlayerOption [ iId ][ Option_Reason ] ] ); menu_additem ( iMenu , szData , "r" ); for( new iPlayer = 1 ; iPlayer <= g_iMaxPlayers ; iPlayer ++ ) { if( ! GetPlayerBit ( g_iConnected , iPlayer ) || HasPermission ( iPlayer , ADMIN_IMMUNITY ) || ( g_ePlayerData [ iPlayer ][ Player_Userid ] == 0 ) ) { continue; } get_user_name ( iPlayer , szData , charsmax ( szData ) - 48 ); formatex ( szNum , charsmax ( szNum ), "%d %d" , iPlayer , get_user_userid ( iPlayer ) ); formatex ( szData [ strlen ( szData ) ], charsmax ( szData ) - 16 , " \d- \y[\wBans: \r%d\y]" , g_ePlayerData [ iPlayer ][ Player_Bans ] ); menu_additem ( iMenu , szData , szNum ); } menu_setprop ( iMenu , MPROP_NEXTNAME , "Siguiente" ); menu_setprop ( iMenu , MPROP_BACKNAME , "Anterior" ); menu_setprop ( iMenu , MPROP_EXITNAME , "Cancelar" ); menu_display ( iId , iMenu ); return PLUGIN_HANDLED ; } public BanHandler ( iId , iMenu , iItem ) { if( iItem == MENU_EXIT ) { menu_destroy ( iMenu ); return PLUGIN_HANDLED ; } new szPlayer [ 4 ]; new szData [ 8 ]; new iPlayer ; new iNum ; menu_item_getinfo ( iMenu , iItem , iNum , szData , charsmax ( szData ), _ , _ , iNum ); menu_destroy ( iMenu ); switch( szData [ 0 ] ) { case 'b' : { ( g_iPlayerOption [ iId ][ Option_Ban ] < sizeof ( g_eBanTime ) - 1 ) ? ( g_iPlayerOption [ iId ][ Option_Ban ]++ ) : ( g_iPlayerOption [ iId ][ Option_Ban ] = 0 ); ShowMenuBan ( iId ); } case 'r' : { ( g_iPlayerOption [ iId ][ Option_Reason ] < sizeof ( g_szReasons ) - 1 ) ? ( g_iPlayerOption [ iId ][ Option_Reason ]++ ) : ( g_iPlayerOption [ iId ][ Option_Reason ] = 0 ); ShowMenuBan ( iId ); } default: { strtok ( szData , szPlayer , charsmax ( szPlayer ), szData , charsmax ( szData ), ' ' , true ); iPlayer = str_to_num ( szPlayer ); iNum = str_to_num ( szData ); if( GetPlayerBit ( g_iConnected , iPlayer ) && ( get_user_userid ( iPlayer ) == iNum ) ) { g_ePlayerData [ iPlayer ][ Player_Time ] = GetBanDuration ( iId ); g_ePlayerData [ iPlayer ][ Player_Bans ]++; g_ePlayerData [ iPlayer ][ Player_Reason ] = g_iPlayerOption [ iId ][ Option_Reason ]; g_ePlayerData [ iPlayer ][ Player_Banned ] = get_systime ( ); BanPlayer ( iId , iPlayer ); client_cmd ( iId , "spk buttons/button3" ); PrintColor ( iId , "^x04[ABS]^x01 Jugador baneado correctamente." ); PrintColor ( iId , "^x04[ABS]^x01 Verifica el foro periodicamente para evitar inconvenientes." ); } else { PrintColor ( iId , "^x04[ABS]^x01 No existe el jugador especificado." ); } } } return PLUGIN_HANDLED ; } /* =============================================================================== * [ Modules ] * =============================================================================== */ BanPlayer ( const iBanner , const iBanned ) { new szDate [ 32 ]; get_time ( "%d/%m %H:%M:%S" , szDate , charsmax ( szDate ) ); new iFile = fopen ( g_szLogFile , "a" ); fprintf ( iFile , "[Ban] Admin: %s | Jugador: %s | Identificador: %d | Duracion: %d | Razon: %s | Fecha: %s.^n" , g_ePlayerData [ iBanner ][ Player_Nick ], g_ePlayerData [ iBanned ][ Player_Nick ], g_ePlayerData [ iBanned ][ Player_Userid ], ( g_ePlayerData [ iBanned ][ Player_Time ] - get_systime ( ) ) / 60 , g_szReasons [ g_ePlayerData [ iBanned ][ Player_Reason ] ], szDate ); fclose ( iFile ); PrintColor ( iBanner , "^x04[ABS]^x01 Jugador baneado correctamente. [ Identificador: %d ]" , g_ePlayerData [ iBanned ][ Player_Userid ] ); PrintUserInformation ( iBanned ); set_task ( 0.25 , "KickPlayer" , iBanned ); return true ; } SearchTarget ( & iTarget ) { for( new iPlayer = 1 ; iPlayer <= g_iMaxPlayers ; iPlayer ++ ) { if( ! is_user_connected ( iPlayer ) || ( g_ePlayerData [ iPlayer ][ Player_Userid ] != iTarget ) ) { continue; } iTarget = iPlayer ; return true ; } return false ; } RegisterUnban ( const iId , const iUserid ) { new szDate [ 32 ]; get_time ( "%d/%m %H:%M:%S" , szDate , charsmax ( szDate ) ); new iFile = fopen ( g_szLogFile , "a" ); fprintf ( iFile , "[ Unban ] Administrador: %s | Identificador: %d | Fecha: %s.^n" , g_ePlayerData [ iId ][ Player_Nick ], iUserid , szDate ); fclose ( iFile ); } RegisterDisconnect ( const iId ) { if( g_ePlayerData [ iId ][ Player_Userid ] == 0 ) { return; } for( new i = 4 ; i > 0 ; i -- ) { g_eLastPlayers [ i ] = g_eLastPlayers [ i - 1 ]; } g_eLastPlayers [ 0 ][ Last_Index ] = g_ePlayerData [ iId ][ Player_Userid ]; get_user_name ( iId , g_eLastPlayers [ 0 ][ Last_Name ], charsmax ( g_eLastPlayers [ ][ Last_Name ] ) ); get_time ( "%H:%M:%S" , g_eLastPlayers [ 0 ][ Last_Time ], charsmax ( g_eLastPlayers [ ][ Last_Time ] ) ); } PrintUserInformation ( const iId ) { client_print ( iId , print_console , "Usted se encuentra baneado de Skaviados" ); client_print ( iId , print_console , "- Motivo del ban: %s" , g_szReasons [ g_ePlayerData [ iId ][ Player_Reason ] ] ); client_print ( iId , print_console , "- Tiempo restante estimado: %d minutos" , ( g_ePlayerData [ iId ][ Player_Time ] - get_systime ( ) ) / 60 ); client_print ( iId , print_console , "- Identificador: %d ( necesario para quejas/unban )" , g_ePlayerData [ iId ][ Player_Userid ] ); client_print ( iId , print_console , "Cualquier duda entre a www.skaviados.net" ); } FindPlayer ( & iId , const iUserId ) { for( iId = 1 ; iId <= g_iMaxPlayers ; iId ++ ) { if( is_user_connected ( iId ) && ( get_user_userid ( iId ) == iUserId ) ) { return true ; } } return false ; } PrintColor ( const iId , szText [ ], any :... ) { static szBuffer [ 192 ]; vformat ( szBuffer , charsmax ( szBuffer ), szText , 3 ); if( ! iId ) { message_begin ( MSG_BROADCAST , g_iSayText , _ , iId ); write_byte ( 1 ); write_string ( szBuffer ); message_end ( ); } else { message_begin ( MSG_ONE_UNRELIABLE , g_iSayText , _ , iId ); write_byte ( iId ); write_string ( szBuffer ); message_end ( ); } } /* =============================================================================== * [ SQL Section ] * =============================================================================== */ SQL_Init ( ) { new szDriver [ 8 ]; SQL_SetAffinity ( "sqlite" ); SQL_GetAffinity ( szDriver , charsmax ( szDriver ) ); if( ! equali ( szDriver , "sqlite" ) ) { set_fail_state ( "[ABS] No se ha podido establecer la afinidad a SQLite." ); } g_hTuple = SQL_MakeDbTuple ( "" , "" , "" , "bans" ); get_localinfo ( "amxx_datadir" , g_szLogFile , charsmax ( g_szLogFile ) ); add ( g_szLogFile , charsmax ( g_szLogFile ), "/abs/logs.ini" ); } SQL_Query ( const iId ,const iType ) { static szData [ 4 ], szQuery [ 256 ]; szData [ 0 ] = iId ; szData [ 1 ] = iType ; switch( iType ) { case Query_Load : formatex ( szQuery , charsmax ( szQuery ), "SELECT * FROM users WHERE user_hid=^" % s ^ "" , g_ePlayerData [ iId ][ Player_HID ] ); case Query_Create : formatex ( szQuery , charsmax ( szQuery ), "INSERT INTO users ( user_hid ) VALUES ( ^" % s ^ " )" , g_ePlayerData [ iId ][ Player_HID ] ); case Query_Update : formatex ( szQuery , charsmax ( szQuery ), "UPDATE users SET user_nick=^" % s ^ ",user_time='%d',user_demo='%d',user_bans='%d',user_played='%d',user_reason='%d',user_banned='%d' WHERE user_id='%d'" , g_ePlayerData [ iId ][ Player_Nick ], g_ePlayerData [ iId ][ Player_Time ], g_ePlayerData [ iId ][ Player_Demo ], g_ePlayerData [ iId ][ Player_Bans ], g_ePlayerData [ iId ][ Player_Played ], g_ePlayerData [ iId ][ Player_Reason ], g_ePlayerData [ iId ][ Player_Banned ], g_ePlayerData [ iId ][ Player_Userid ] ); case Query_Ban : formatex ( szQuery , charsmax ( szQuery ), "UPDATE users SET user_time='%d',user_reason='%d',user_banned='%d' WHERE user_id=%d" , g_iBanData [ Ban_Time ], g_iBanData [ Ban_Reason ], g_iBanData [ Ban_Banned ], iId ); case Query_Unban : formatex ( szQuery , charsmax ( szQuery ), "UPDATE users SET user_time='0' WHERE user_id=%d" , iId ); case Query_Banned : formatex ( szQuery , charsmax ( szQuery ), "SELECT * FROM users WHERE ( user_time > '%d' OR user_time = '-1' ) ORDER BY user_banned DESC LIMIT 30" , get_systime ( ) ); } SQL_ThreadQuery ( g_hTuple , "SQL_Handler" , szQuery , szData , charsmax ( szData ) ); return 1 ; } public SQL_Handler ( iFailstate , Handle : hQuery , szError [ ], iErrsize , szData [ ], iDatasize ) { new iId = szData [ 0 ]; new iType = szData [ 1 ]; if( iFailstate < TQUERY_SUCCESS ) { log_amx ( "[ABS] Hubo un error en el handler. %s" , szError ); return; } switch( iType ) { case Query_Load : { if( SQL_NumResults ( hQuery ) == 0 ) { SQL_Query ( iId , Query_Create ); return; } g_ePlayerData [ iId ][ Player_Userid ] = SQL_ReadResult ( hQuery , 0 ); g_ePlayerData [ iId ][ Player_Time ] = SQL_ReadResult ( hQuery , 2 ); g_ePlayerData [ iId ][ Player_Demo ] = SQL_ReadResult ( hQuery , 3 ); g_ePlayerData [ iId ][ Player_Bans ] = SQL_ReadResult ( hQuery , 4 ); g_ePlayerData [ iId ][ Player_Reason ] = SQL_ReadResult ( hQuery , 5 ); g_ePlayerData [ iId ][ Player_Banned ] = SQL_ReadResult ( hQuery , 6 ); g_ePlayerData [ iId ][ Player_Played ] = SQL_ReadResult ( hQuery , 7 ); if( ( g_ePlayerData [ iId ][ Player_Time ] == - 1 ) || ( g_ePlayerData [ iId ][ Player_Time ] > get_systime ( ) ) ) { PrintUserInformation ( iId ); set_task ( 0.25 , "KickPlayer" , iId ); } } case Query_Create : { g_ePlayerData [ iId ][ Player_Userid ] = SQL_GetInsertId ( hQuery ); console_print ( iId , "[ABS] Este servidor cuenta con *Advanced Ban System v1.0b* ." ); console_print ( iId , "[ABS] Le informamos que usted ha sido registrado en la base de datos ." ); } case Query_Banned : { new szDate [ 32 ]; new szName [ 32 ]; new iUser ; new iTime ; new iDate ; new iReason ; while( SQL_MoreResults ( hQuery ) ) { iUser = SQL_ReadResult ( hQuery , 0 ); iTime = SQL_ReadResult ( hQuery , 2 ); iReason = SQL_ReadResult ( hQuery , 5 ); iDate = SQL_ReadResult ( hQuery , 6 ); format_time ( szDate , charsmax ( szDate ), "%c" , iDate ); SQL_ReadResult ( hQuery , 8 , szName , charsmax ( szName ) ); console_print ( iId , "[ %d ] %s | %s | %d minutos | %s" , iUser , szName , szDate , ( iTime > - 1 ) ? ( ( iTime - get_systime ( ) ) / 60 ) : - 1 , g_szReasons [ iReason ] ); SQL_NextRow ( hQuery ); } } } }
Te lo hizo Treki.
Mensajes: 2,094
Temas: 59
Registro en: Feb 2015
Reputación:
15
ni vi la fecha que crearon este post pero siempre que digo "no creo que sea público" resulta ser que es público
(18/11/2014, 05:47 PM) Neeeeeeeeeel.- escribió: Por qué necesitan una guía para todo? Meté mano y que salga lo que salga... es la mejor forma de aprender.
(16/05/2016, 11:08 PM) kikizon2 escribió: No cabe duda que tienen mierda en vez de cerebro, par de pendejos v:
Mensajes: 3,077
Temas: 33
Registro en: May 2017
Reputación:
34
(14/09/2018, 09:33 PM) OsweRRR escribió: ni vi la fecha que crearon este post pero siempre que digo "no creo que sea público" resulta ser que es público
No era público hasta ahora.
Mensajes: 3,238
Temas: 47
Registro en: Feb 2015
Reputación:
34
(14/09/2018, 09:33 PM) OsweRRR escribió: ni vi la fecha que crearon este post pero siempre que digo "no creo que sea público" resulta ser que es público
Tampoco vi la fecha solo leí el título y comenté xd
Mensajes: 3,020
Temas: 49
Registro en: Oct 2013
Reputación:
33
(14/09/2018, 09:11 PM) metita escribió: Código PHP:
#include <amxmodx> #include <sqlx> #if AMXX_VERSION_NUM < 183 #define client_disconnected client_disconnect #endif /* =============================================================================== * [ Plugin initiation & Global stuff ] * =============================================================================== */ #define SetPlayerBit(%1,%2) ( %1 |= ( 1 << ( %2 & 31 ) ) ) #define ClearPlayerBit(%1,%2) ( %1 &= ~( 1 << ( %2 & 31 ) ) ) #define GetPlayerBit(%1,%2) ( %1 & ( 1 << ( %2 & 31 ) ) ) #define GetBanDuration(%0) ( g_iPlayerOption[ %0 ][ Option_Ban ] ? ( get_systime( ) + g_eBanTime[ g_iPlayerOption[ %0 ][ Option_Ban ] ][ Time_Time ] ):g_eBanTime[ 0 ][ Time_Time ] ) #define HasPermission(%0,%1) ( get_user_flags( %0 ) & %1 ) const EV_HID = 4 ; const MAX_TRIES = 9 ; const MIN_CHARS = 24 ; enum _ : Query_Type { Query_Load , Query_Create , Query_Update , Query_Ban , Query_Unban , Query_Banned } enum _ : Option_Type { Option_Ban , Option_Reason } enum _ : Ban_Data { Ban_Time , Ban_Reason , Ban_Banned } enum _ : Time_Data { Time_Type [ 16 ], Time_Time } enum _ : Player_Data { Player_Userid , Player_HID [ 32 ], Player_Nick [ 32 ], Player_Time , Player_Demo , Player_Bans , Player_Played , Player_Reason , Player_Banned } enum _ : Last_Data { Last_Index , Last_Name [ 16 ], Last_Time [ 16 ] } new const g_szReasons [ ][ ] = { "Incumplir reglas" , "Cheat / Hack" , "Spam / Flood" , "FreeKill / Shoot" , "Falta de respeto" , "Demo + Octinium" } new const g_eBanTime [ ][ Time_Data ] = { { "Permanente" , - 1 }, { "Cinco minutos" , 300 }, { "Quince minutos" , 900 }, { "Media hora" , 1800 }, { "Una hora" , 3600 }, { "Medio dia" , 7200 }, { "Un dia" , 86400 } } new g_iSayText ; new g_iConnected ; new g_iMaxPlayers ; new g_szLogFile [ 64 ]; new g_iBanData [ Ban_Data ]; new g_eLastPlayers [ 5 ][ Last_Data ]; new g_ePlayerData [ 33 ][ Player_Data ]; new g_iPlayerOption [ 33 ][ Option_Type ]; new Handle : g_hTuple ; public plugin_init ( ) { register_plugin ( "Advanced Ban System" , "1.0" , "Manu" ); register_clcmd ( "say /id" , "CommandId" ); register_clcmd ( "say /ban" , "ShowMenuBan" ); register_clcmd ( "abs_ban" , "CommandBan" ); register_clcmd ( "abs_info" , "CommandInfo" ); register_clcmd ( "abs_last" , "CommandLast" ); register_clcmd ( "abs_unban" , "CommandUnban" ); register_clcmd ( "abs_banned" , "CommandBanned" ); register_srvcmd ( "sxe_event" , "ev_sXe" ); g_iSayText = get_user_msgid ( "SayText" ); g_iMaxPlayers = get_maxplayers ( ); SQL_Init ( ); } /* =============================================================================== * [ Client-related ] * =============================================================================== */ public ev_sXe ( ) { new iId ; new szData [ 8 ]; read_argv ( 1 , szData , charsmax ( szData ) ); if( str_to_num ( szData ) == EV_HID ) { read_argv ( 2 , szData , charsmax ( szData ) ); if( FindPlayer ( iId , str_to_num ( szData ) ) ) { read_argv ( 5 , g_ePlayerData [ iId ][ Player_HID ], charsmax ( g_ePlayerData [ ][ Player_HID ] ) ); if( strlen ( g_ePlayerData [ iId ][ Player_HID ] ) < MIN_CHARS ) { client_print ( iId , print_console , "Tu hardware id no se pudo verificar." ); client_print ( iId , print_console , "Cualquier duda entra a www.skaviados.net" ); server_cmd ( "kick #%d ^" No pudimos validar tu HID ( Mirar consola )^ "" , get_user_userid ( iId ) ); server_exec ( ); } else { SQL_Query ( iId , Query_Load ); } } } } public KickPlayer ( iId ) { server_cmd ( "kick #%d ^" Ingreso restringido ( Mirar consola )^ "" , get_user_userid ( iId ) ); server_exec ( ); } public CommandLogs ( iId ) { if( ! HasPermission ( iId , ADMIN_BAN ) ) { console_print ( iId , "[ABS] No tienes permisos suficientes para utilizar este comando." ); return PLUGIN_HANDLED ; } new szBuffer [ 192 ]; new szLogs [ 15 ][ 192 ]; new iFile = fopen ( g_szLogFile , "rt" ); while( ! feof ( iFile ) ) { fgets ( iFile , szBuffer , charsmax ( szBuffer ) ); trim ( szBuffer ); remove_quotes ( szBuffer ); if( strlen ( szBuffer ) < 10 ) { continue; } for( new i = 14 ; i > 0 ; i -- ) { szLogs [ i ] = szLogs [ i - 1 ]; } copy ( szLogs [ 0 ], charsmax ( szLogs [ ] ), szBuffer ); } for( new i = 14 ; i >= 0 ; i -- ) { console_print ( iId , "[%d] %s" , ( i + 1 ), szLogs [ i ] ); } fclose ( iFile ); return PLUGIN_HANDLED ; } public CommandInfo ( iId ) { if( ! HasPermission ( iId , ADMIN_BAN ) ) { console_print ( iId , "[ABS] No tienes permisos suficientes para utilizar este comando." ); return PLUGIN_HANDLED ; } new iPlayers [ 32 ]; new szName [ 32 ]; new iNum ; get_players ( iPlayers , iNum ); console_print ( iId , "^n**** Informacion sobre jugadores conectados ****" ); for( new i = 0 ; i < iNum ; i ++ ) { get_user_name ( iPlayers [ i ], szName , charsmax ( szName ) ); console_print ( iId , "Identificador: %05d | Bans: %02d | Nombre: %s." , g_ePlayerData [ iPlayers [ i ] ][ Player_Userid ], g_ePlayerData [ iPlayers [ i ] ][ Player_Bans ], szName ); } return PLUGIN_HANDLED ; } public CommandLast ( iId ) { if( ! HasPermission ( iId , ADMIN_BAN ) ) { console_print ( iId , "[ABS] No tienes permisos suficientes para utilizar este comando." ); return PLUGIN_HANDLED ; } new iPlayers [ 32 ]; new iNum ; get_players ( iPlayers , iNum ); console_print ( iId , "**** Ultimas cinco desconexiones de jugadores ****" ); for( new i = 0 ; i < sizeof ( g_eLastPlayers ); i ++ ) { if( g_eLastPlayers [ i ][ Last_Index ] == 0 ) { break; } console_print ( iId , "[%s] Identificador: %05d | Nombre: %s." , g_eLastPlayers [ i ][ Last_Time ], g_eLastPlayers [ i ][ Last_Index ], g_eLastPlayers [ i ][ Last_Name ] ); } return PLUGIN_HANDLED ; } public CommandBanned ( iId ) { if( ! HasPermission ( iId , ADMIN_BAN ) ) { console_print ( iId , "[ABS] No tienes permisos suficientes para utilizar este comando." ); return PLUGIN_HANDLED ; } console_print ( iId , "[ Identificador | Ultimo nombre | Fecha | Tiempo restante | Razon ]" ); SQL_Query ( iId , Query_Banned ); return PLUGIN_HANDLED ; } public CommandBan ( iId ) { if( ! HasPermission ( iId , ADMIN_BAN ) ) { console_print ( iId , "[ABS] No tienes permisos suficientes para utilizar este comando." ); return PLUGIN_HANDLED ; } new iTarget ; new iTime ; new iFile ; new iReason ; new szIndex [ 8 ]; new szTime [ 8 ]; new szReason [ 8 ]; new szDate [ 32 ]; new szName [ 32 ]; if( read_argc ( ) != 4 ) { console_print ( iId , "[ABS] Comando mal estructurado. Utilizacion: ^" abs_ban < id > < tiempo > < numero de razon > - Permanente : - 1 min ^ "" ); console_print ( iId , "[ABS] Las razones pueden ser:^n^n1. %s^n2. %s" , g_szReasons [ 0 ], g_szReasons [ 1 ] ); console_print ( iId , "3. %s^n4. %s^n5. %s^n6. %s" , g_szReasons [ 2 ], g_szReasons [ 3 ], g_szReasons [ 4 ], g_szReasons [ 5 ] ); return PLUGIN_HANDLED ; } read_argv ( 1 , szIndex , charsmax ( szIndex ) ); if( ( iTarget = str_to_num ( szIndex ) ) > 0 ) { read_argv ( 2 , szTime , charsmax ( szTime ) ); if( ( iTime = str_to_num ( szTime ) ) != 0 && ( 100000 >= iTime >= - 1 ) ) { read_argv ( 3 , szReason , charsmax ( szReason ) ); if( ( 0 <= ( iReason = str_to_num ( szReason ) - 1 ) < sizeof ( g_szReasons ) ) ) { if( ! SearchTarget ( iTarget ) ) { g_iBanData [ Ban_Banned ] = get_systime ( ); g_iBanData [ Ban_Reason ] = iReason ; g_iBanData [ Ban_Time ] = iTime > 0 ? ( get_systime ( ) + ( iTime * 60 ) ) : - 1 ; get_time ( "%d/%m %H:%M:%S" , szDate , charsmax ( szDate ) ); get_user_name ( iId , szName , charsmax ( szName ) ); iFile = fopen ( g_szLogFile , "a" ); fprintf ( iFile , "[BAN] Admin: %s | Identificador: %d | Tiempo: %d min | Razon: %s | Fecha: %s.^n" , szName , iTarget , iTime , g_szReasons [ iReason ], szDate ); fclose ( iFile ); SQL_Query ( iTarget , Query_Ban ); } else { g_ePlayerData [ iTarget ][ Player_Time ] = iTime > 0 ? ( get_systime ( ) + ( iTime * 60 ) ):- 1 ; g_ePlayerData [ iTarget ][ Player_Bans ]++; g_ePlayerData [ iTarget ][ Player_Reason ] = iReason ; g_ePlayerData [ iTarget ][ Player_Banned ] = get_systime ( ); BanPlayer ( iId , iTarget ); } console_print ( iId , "[ABS] Identificador baneado correctamente." ); } else { console_print ( iId , "[ABS] Has introducido una razon que no existe ( solo entre 1 y 6 )." ); } } else { console_print ( iId , "[ABS] No has introducido un tiempo valido ( -1 para permanente )." ); } } else { console_print ( iId , "[ABS] El identificador tiene que ser un numero positivo." ); } return PLUGIN_HANDLED ; } public CommandUnban ( iId ) { if( ! HasPermission ( iId , ADMIN_BAN ) ) { console_print ( iId , "[ABS] No tienes permisos suficientes para utilizar este comando." ); return PLUGIN_HANDLED ; } else if( read_argc ( ) != 2 ) { console_print ( iId , "[ABS] Comando mal estructurado. Utilizacion: ^" abs_unban < identificador >^ "" ); return PLUGIN_HANDLED ; } new iUserid ; new szUserid [ 8 ]; read_argv ( 1 , szUserid , charsmax ( szUserid ) ); if( 0 < ( iUserid = str_to_num ( szUserid ) ) ) { RegisterUnban ( iId , iUserid ); SQL_Query ( iUserid , Query_Unban ); console_print ( iId , "[ABS] Se competo la operacion." ); console_print ( iId , "[ABS] Si el identificador era correcto entonces ha sido desbaneado." ); } else { console_print ( iId , "[ABS] El identificador tiene que ser un numero positivo." ); } return PLUGIN_HANDLED ; } public CommandId ( iId ) { if( g_ePlayerData [ iId ][ Player_Userid ] > 0 ) { PrintColor ( iId , "^x04[ABS]^x01 Tu identificador unico es^x04 %d^x01." , g_ePlayerData [ iId ][ Player_Userid ] ); } return PLUGIN_HANDLED ; } public client_putinserver ( iId ) { SetPlayerBit ( g_iConnected , iId ); get_user_name ( iId , g_ePlayerData [ iId ][ Player_Nick ], charsmax ( g_ePlayerData [ ][ Player_Nick ] ) ); } public client_disconnected ( iId ) { ClearPlayerBit ( g_iConnected , iId ); RegisterDisconnect ( iId ); g_ePlayerData [ iId ][ Player_Played ] += get_user_time ( iId ); SQL_Query ( iId , Query_Update ); g_ePlayerData [ iId ][ Player_Userid ] = 0 ; g_ePlayerData [ iId ][ Player_HID ][ 0 ] = EOS ; } /* =============================================================================== * [ Menu's ] * =============================================================================== */ public ShowMenuBan ( iId ) { if( ! HasPermission ( iId , ADMIN_BAN ) ) { PrintColor ( iId , "^x04[ABS]^x01 No tienes permisos suficientes para acceder a este menu." ); return PLUGIN_HANDLED ; } new szNum [ 8 ]; new szData [ 64 ]; new iMenu = menu_create ( "===========================^n \wSistema de ban^n\y===========================" , "BanHandler" ); formatex ( szData , charsmax ( szData ), "Cambiar tiempo \y[\r%s\y]" , g_eBanTime [ g_iPlayerOption [ iId ][ Option_Ban ] ][ Time_Type ] ); menu_additem ( iMenu , szData , "b" ); formatex ( szData , charsmax ( szData ), "Cambiar motivo \y[\r%s\y]^n" , g_szReasons [ g_iPlayerOption [ iId ][ Option_Reason ] ] ); menu_additem ( iMenu , szData , "r" ); for( new iPlayer = 1 ; iPlayer <= g_iMaxPlayers ; iPlayer ++ ) { if( ! GetPlayerBit ( g_iConnected , iPlayer ) || HasPermission ( iPlayer , ADMIN_IMMUNITY ) || ( g_ePlayerData [ iPlayer ][ Player_Userid ] == 0 ) ) { continue; } get_user_name ( iPlayer , szData , charsmax ( szData ) - 48 ); formatex ( szNum , charsmax ( szNum ), "%d %d" , iPlayer , get_user_userid ( iPlayer ) ); formatex ( szData [ strlen ( szData ) ], charsmax ( szData ) - 16 , " \d- \y[\wBans: \r%d\y]" , g_ePlayerData [ iPlayer ][ Player_Bans ] ); menu_additem ( iMenu , szData , szNum ); } menu_setprop ( iMenu , MPROP_NEXTNAME , "Siguiente" ); menu_setprop ( iMenu , MPROP_BACKNAME , "Anterior" ); menu_setprop ( iMenu , MPROP_EXITNAME , "Cancelar" ); menu_display ( iId , iMenu ); return PLUGIN_HANDLED ; } public BanHandler ( iId , iMenu , iItem ) { if( iItem == MENU_EXIT ) { menu_destroy ( iMenu ); return PLUGIN_HANDLED ; } new szPlayer [ 4 ]; new szData [ 8 ]; new iPlayer ; new iNum ; menu_item_getinfo ( iMenu , iItem , iNum , szData , charsmax ( szData ), _ , _ , iNum ); menu_destroy ( iMenu ); switch( szData [ 0 ] ) { case 'b' : { ( g_iPlayerOption [ iId ][ Option_Ban ] < sizeof ( g_eBanTime ) - 1 ) ? ( g_iPlayerOption [ iId ][ Option_Ban ]++ ) : ( g_iPlayerOption [ iId ][ Option_Ban ] = 0 ); ShowMenuBan ( iId ); } case 'r' : { ( g_iPlayerOption [ iId ][ Option_Reason ] < sizeof ( g_szReasons ) - 1 ) ? ( g_iPlayerOption [ iId ][ Option_Reason ]++ ) : ( g_iPlayerOption [ iId ][ Option_Reason ] = 0 ); ShowMenuBan ( iId ); } default: { strtok ( szData , szPlayer , charsmax ( szPlayer ), szData , charsmax ( szData ), ' ' , true ); iPlayer = str_to_num ( szPlayer ); iNum = str_to_num ( szData ); if( GetPlayerBit ( g_iConnected , iPlayer ) && ( get_user_userid ( iPlayer ) == iNum ) ) { g_ePlayerData [ iPlayer ][ Player_Time ] = GetBanDuration ( iId ); g_ePlayerData [ iPlayer ][ Player_Bans ]++; g_ePlayerData [ iPlayer ][ Player_Reason ] = g_iPlayerOption [ iId ][ Option_Reason ]; g_ePlayerData [ iPlayer ][ Player_Banned ] = get_systime ( ); BanPlayer ( iId , iPlayer ); client_cmd ( iId , "spk buttons/button3" ); PrintColor ( iId , "^x04[ABS]^x01 Jugador baneado correctamente." ); PrintColor ( iId , "^x04[ABS]^x01 Verifica el foro periodicamente para evitar inconvenientes." ); } else { PrintColor ( iId , "^x04[ABS]^x01 No existe el jugador especificado." ); } } } return PLUGIN_HANDLED ; } /* =============================================================================== * [ Modules ] * =============================================================================== */ BanPlayer ( const iBanner , const iBanned ) { new szDate [ 32 ]; get_time ( "%d/%m %H:%M:%S" , szDate , charsmax ( szDate ) ); new iFile = fopen ( g_szLogFile , "a" ); fprintf ( iFile , "[Ban] Admin: %s | Jugador: %s | Identificador: %d | Duracion: %d | Razon: %s | Fecha: %s.^n" , g_ePlayerData [ iBanner ][ Player_Nick ], g_ePlayerData [ iBanned ][ Player_Nick ], g_ePlayerData [ iBanned ][ Player_Userid ], ( g_ePlayerData [ iBanned ][ Player_Time ] - get_systime ( ) ) / 60 , g_szReasons [ g_ePlayerData [ iBanned ][ Player_Reason ] ], szDate ); fclose ( iFile ); PrintColor ( iBanner , "^x04[ABS]^x01 Jugador baneado correctamente. [ Identificador: %d ]" , g_ePlayerData [ iBanned ][ Player_Userid ] ); PrintUserInformation ( iBanned ); set_task ( 0.25 , "KickPlayer" , iBanned ); return true ; } SearchTarget ( & iTarget ) { for( new iPlayer = 1 ; iPlayer <= g_iMaxPlayers ; iPlayer ++ ) { if( ! is_user_connected ( iPlayer ) || ( g_ePlayerData [ iPlayer ][ Player_Userid ] != iTarget ) ) { continue; } iTarget = iPlayer ; return true ; } return false ; } RegisterUnban ( const iId , const iUserid ) { new szDate [ 32 ]; get_time ( "%d/%m %H:%M:%S" , szDate , charsmax ( szDate ) ); new iFile = fopen ( g_szLogFile , "a" ); fprintf ( iFile , "[ Unban ] Administrador: %s | Identificador: %d | Fecha: %s.^n" , g_ePlayerData [ iId ][ Player_Nick ], iUserid , szDate ); fclose ( iFile ); } RegisterDisconnect ( const iId ) { if( g_ePlayerData [ iId ][ Player_Userid ] == 0 ) { return; } for( new i = 4 ; i > 0 ; i -- ) { g_eLastPlayers [ i ] = g_eLastPlayers [ i - 1 ]; } g_eLastPlayers [ 0 ][ Last_Index ] = g_ePlayerData [ iId ][ Player_Userid ]; get_user_name ( iId , g_eLastPlayers [ 0 ][ Last_Name ], charsmax ( g_eLastPlayers [ ][ Last_Name ] ) ); get_time ( "%H:%M:%S" , g_eLastPlayers [ 0 ][ Last_Time ], charsmax ( g_eLastPlayers [ ][ Last_Time ] ) ); } PrintUserInformation ( const iId ) { client_print ( iId , print_console , "Usted se encuentra baneado de Skaviados" ); client_print ( iId , print_console , "- Motivo del ban: %s" , g_szReasons [ g_ePlayerData [ iId ][ Player_Reason ] ] ); client_print ( iId , print_console , "- Tiempo restante estimado: %d minutos" , ( g_ePlayerData [ iId ][ Player_Time ] - get_systime ( ) ) / 60 ); client_print ( iId , print_console , "- Identificador: %d ( necesario para quejas/unban )" , g_ePlayerData [ iId ][ Player_Userid ] ); client_print ( iId , print_console , "Cualquier duda entre a www.skaviados.net" ); } FindPlayer ( & iId , const iUserId ) { for( iId = 1 ; iId <= g_iMaxPlayers ; iId ++ ) { if( is_user_connected ( iId ) && ( get_user_userid ( iId ) == iUserId ) ) { return true ; } } return false ; } PrintColor ( const iId , szText [ ], any :... ) { static szBuffer [ 192 ]; vformat ( szBuffer , charsmax ( szBuffer ), szText , 3 ); if( ! iId ) { message_begin ( MSG_BROADCAST , g_iSayText , _ , iId ); write_byte ( 1 ); write_string ( szBuffer ); message_end ( ); } else { message_begin ( MSG_ONE_UNRELIABLE , g_iSayText , _ , iId ); write_byte ( iId ); write_string ( szBuffer ); message_end ( ); } } /* =============================================================================== * [ SQL Section ] * =============================================================================== */ SQL_Init ( ) { new szDriver [ 8 ]; SQL_SetAffinity ( "sqlite" ); SQL_GetAffinity ( szDriver , charsmax ( szDriver ) ); if( ! equali ( szDriver , "sqlite" ) ) { set_fail_state ( "[ABS] No se ha podido establecer la afinidad a SQLite." ); } g_hTuple = SQL_MakeDbTuple ( "" , "" , "" , "bans" ); get_localinfo ( "amxx_datadir" , g_szLogFile , charsmax ( g_szLogFile ) ); add ( g_szLogFile , charsmax ( g_szLogFile ), "/abs/logs.ini" ); } SQL_Query ( const iId ,const iType ) { static szData [ 4 ], szQuery [ 256 ]; szData [ 0 ] = iId ; szData [ 1 ] = iType ; switch( iType ) { case Query_Load : formatex ( szQuery , charsmax ( szQuery ), "SELECT * FROM users WHERE user_hid=^" % s ^ "" , g_ePlayerData [ iId ][ Player_HID ] ); case Query_Create : formatex ( szQuery , charsmax ( szQuery ), "INSERT INTO users ( user_hid ) VALUES ( ^" % s ^ " )" , g_ePlayerData [ iId ][ Player_HID ] ); case Query_Update : formatex ( szQuery , charsmax ( szQuery ), "UPDATE users SET user_nick=^" % s ^ ",user_time='%d',user_demo='%d',user_bans='%d',user_played='%d',user_reason='%d',user_banned='%d' WHERE user_id='%d'" , g_ePlayerData [ iId ][ Player_Nick ], g_ePlayerData [ iId ][ Player_Time ], g_ePlayerData [ iId ][ Player_Demo ], g_ePlayerData [ iId ][ Player_Bans ], g_ePlayerData [ iId ][ Player_Played ], g_ePlayerData [ iId ][ Player_Reason ], g_ePlayerData [ iId ][ Player_Banned ], g_ePlayerData [ iId ][ Player_Userid ] ); case Query_Ban : formatex ( szQuery , charsmax ( szQuery ), "UPDATE users SET user_time='%d',user_reason='%d',user_banned='%d' WHERE user_id=%d" , g_iBanData [ Ban_Time ], g_iBanData [ Ban_Reason ], g_iBanData [ Ban_Banned ], iId ); case Query_Unban : formatex ( szQuery , charsmax ( szQuery ), "UPDATE users SET user_time='0' WHERE user_id=%d" , iId ); case Query_Banned : formatex ( szQuery , charsmax ( szQuery ), "SELECT * FROM users WHERE ( user_time > '%d' OR user_time = '-1' ) ORDER BY user_banned DESC LIMIT 30" , get_systime ( ) ); } SQL_ThreadQuery ( g_hTuple , "SQL_Handler" , szQuery , szData , charsmax ( szData ) ); return 1 ; } public SQL_Handler ( iFailstate , Handle : hQuery , szError [ ], iErrsize , szData [ ], iDatasize ) { new iId = szData [ 0 ]; new iType = szData [ 1 ]; if( iFailstate < TQUERY_SUCCESS ) { log_amx ( "[ABS] Hubo un error en el handler. %s" , szError ); return; } switch( iType ) { case Query_Load : { if( SQL_NumResults ( hQuery ) == 0 ) { SQL_Query ( iId , Query_Create ); return; } g_ePlayerData [ iId ][ Player_Userid ] = SQL_ReadResult ( hQuery , 0 ); g_ePlayerData [ iId ][ Player_Time ] = SQL_ReadResult ( hQuery , 2 ); g_ePlayerData [ iId ][ Player_Demo ] = SQL_ReadResult ( hQuery , 3 ); g_ePlayerData [ iId ][ Player_Bans ] = SQL_ReadResult ( hQuery , 4 ); g_ePlayerData [ iId ][ Player_Reason ] = SQL_ReadResult ( hQuery , 5 ); g_ePlayerData [ iId ][ Player_Banned ] = SQL_ReadResult ( hQuery , 6 ); g_ePlayerData [ iId ][ Player_Played ] = SQL_ReadResult ( hQuery , 7 ); if( ( g_ePlayerData [ iId ][ Player_Time ] == - 1 ) || ( g_ePlayerData [ iId ][ Player_Time ] > get_systime ( ) ) ) { PrintUserInformation ( iId ); set_task ( 0.25 , "KickPlayer" , iId ); } } case Query_Create : { g_ePlayerData [ iId ][ Player_Userid ] = SQL_GetInsertId ( hQuery ); console_print ( iId , "[ABS] Este servidor cuenta con *Advanced Ban System v1.0b* ." ); console_print ( iId , "[ABS] Le informamos que usted ha sido registrado en la base de datos ." ); } case Query_Banned : { new szDate [ 32 ]; new szName [ 32 ]; new iUser ; new iTime ; new iDate ; new iReason ; while( SQL_MoreResults ( hQuery ) ) { iUser = SQL_ReadResult ( hQuery , 0 ); iTime = SQL_ReadResult ( hQuery , 2 ); iReason = SQL_ReadResult ( hQuery , 5 ); iDate = SQL_ReadResult ( hQuery , 6 ); format_time ( szDate , charsmax ( szDate ), "%c" , iDate ); SQL_ReadResult ( hQuery , 8 , szName , charsmax ( szName ) ); console_print ( iId , "[ %d ] %s | %s | %d minutos | %s" , iUser , szName , szDate , ( iTime > - 1 ) ? ( ( iTime - get_systime ( ) ) / 60 ) : - 1 , g_szReasons [ iReason ] ); SQL_NextRow ( hQuery ); } } } }
Te lo hizo Treki.
Adjunto base de datos que realicé para que puedan utilizar el plugin. saludos.
Archivos adjuntos
bans.sq3 (Tamaño: 16 KB / Descargas: 27)
Ingeniero agrónomo y desarrollador de Software.
tutoriales-allied
buscas un zp?
"La imitación es la forma más sincera de admiración con la que puede pagar la mediocridad a la grandeza"
Merci Alliedmodders pour m'introduire dans la programmation.