Mensajes: 207
Temas: 62
Registro en: Feb 2018
Reputación:
0
26/05/2019, 10:31 PM
(Última modificación: 29/05/2019, 04:58 PM por rosario . Edited 1 time in total.)
Buenas vengo a pedirles una ayuda, consejos, ideas, para que me ayuden a mejorar el hook say del sistema de rango que estoy usando, les explicare cada problema con detalles de fotos y una especificación para así poder lograr que me entiendan de lo que trato de solucionar, empiezo con la explicación detallada.
1.- Cuando un jugador "TT" escribe por say normal, debería de salir de la siguiente forma.
Ejemplo: [Silver l] Rosario : Hola
pero en la foto que subiré sale en la parte [Silver l] Rosario : Hola (osea con 2 espacios entre el nombre del rango y el nombre del usuario
2.- Cuando un jugador "TT" o "CT" muere y escribe por say_team
aparece de la siguiente forma
[Silver l] *muerto*
debería de aparecer de la siguiente forma
*muerto* [Silver l] Rosario : probando
3.- Cuando un jugador "CT" muere y escribe por say_team
aparece de la siguiente forma
[Silver l] *muerto* [CT] Rosario : bug (entre *muerto* y [CT] tiene varios espacios
debería de aparecer de la siguiente forma
*muerto* [Silver l] [CT] Rosario : probando
4.- Cuando un jugador "CT" escribe por say_team
aparece de la siguiente forma
[Silver l] [CT] Rosario : bug (aqui tiene 2 espacios entre rango y [CT])
debería de aparecer de la siguiente forma
[Silver l] [CT] Rosario : probando
5.- Cuando un admin "TT" escribe por say normal
aparece de la siguiente forma
[FOS] [Silver l] (DUEÑO) Hola : bug (entre rango y dueño hay doble espacio)
debería de aparecer de la siguiente forma
[FOS] [Silver l] (DUEÑO) Hola : probando
6.- Cuando un admin "TT" muere y escribe por say normal y say_team
aparece de la siguiente forma
[FOS] [Silver l] *muerto* (DUEÑO) Hola : probando
debería de aparecer así
[FOS] *muerto* [Silver l] (DUEÑO) Hola : probando
7.- Cuando un admin "CT" muere y escribe por say_team
aparece de la siguiente forma
[FOS] [Silver l] *muerto* [CT] (DUEÑO) Hola : probando (entre muerto y [CT] tiene doble espacio)
debería de ser así
[FOS] *muerto* [Silver l] [CT] (DUEÑO) Hola : probando
8.- Cuando un admin "CT" escribe por say_team
aparece de la siguiente forma
[FOS] [Silver l] [CT] (DUEÑO) Hola : probando (entre rango y [CT] doble espacio
debería de ser así
[FOS] [Silver l] [CT] (DUEÑO) Hola : probando
PD: LA SOLUCIÓN QUE BUSCO ESTA SUBRAYADO DE VERDE
ESPERO QUE ME HAYA DADO ENTENDER, E INTENTADO ACOMODARLO POR MI PROPIA CUENTA PERO ME SALE PEOR, ENTONCES VENGO A PLANTEARLO PARA VER SI ALGUIEN PUEDE ECHARME UNA MANITO
DEJARE EL CÓDIGO SMA EN DESCARGA YA QUE NO LO PUEDO PLANTEAR EN PHP POR FALTA DE ESPACIO
Archivos adjuntos
Descargar AMXX / Rango_+_adrenaline.sma (Tamaño: 15.05 KB / Descargas: 10)
»» RENTA TU SERVIDOR EN EVOLUTIÓN-HOST ««
Si deseas contactarme para comprar tu servidor de counter-strike puedes enviar un M.P
Mensajes: 225
Temas: 80
Registro en: Feb 2019
Reputación:
0
Solo debías acomodar bien los caracteres.
PD: Ponle el color tu
Código PHP:
/* =============================== Version Con Guardado adv_vault ================================*/ /* ==================================== |=* [INCLUDES] *=| =====================================*/ #include <amxmisc> #include <csstats> #include <cstrike> #include <fakemeta> #include <adv_vault> #include <jctf> /* ==================================== |=* [PLUGIN / VERSION / AUTHOR] *=| =====================================*/ new const PLUGIN [] = "RangoS" new const VERSION [] = "1.1" new const AUTHOR [] = "kikizon" /* ============================================= |=* [EMPIEZA SECCION MODIFICABLE] *=| ==============================================*/ /* ==================================== |=* [CONSTANTES] *=| =====================================*/ new const Prefijo [] = "FOS" // Prefijo en say new const Sonido [] = "Rango/up.wav" // Sonido Rango UP /* ==================================== |=* [CONST NOMBRES DE RANGOS] *=| =====================================*/ enum _ : DATA { NOMBRE [ 32 ], FRAGS , ADRENALINA } new const Rangos [][ DATA ] = { { "Novato" , 100 }, { "Silver I" , 200 }, { "Silver II" , 300 }, { "Silver III" , 500 }, { "Silver IV" , 700 }, { "Silver Elite" , 800 }, { "Silver Elite Master" , 900 }, { "Gold Nova I" , 1000 }, { "Gold Nova II" , 1200 }, { "Gold Nova III" , 1300 }, { "Gold Nova Master" , 1400 }, { "Master Guardian I" , 1500 }, { "Master Guardian II" , 1700 }, { "Master Guardian Elite" , 1800 }, { "Distinguido Master Guardian" , 1900 }, { "Legendary Eagle" , 2000 }, { "Legendary Eagle Master" , 2100 }, { "Supreme Master" , 2200 }, { "The Global Elite" , 2500 } } /* ==================================== |=* [VARIABLES] *=| =====================================*/ new g_rango [ 33 ], g_frags [ 33 ], g_playername [ 33 ][ 32 ], Data [ 255 ], Left [ 25 ], Right [ 50 ], configsdir [ 200 ], rangosfile [ 200 ] new SyncHUD , g_maxplayers , g_msgTeamInfo , g_msgSayText , rangos , cvar_Hud , cvar_knifex2 , cvar_hsx2 , charnum ; new g_vault /* ==================================== |=* [DEFINE] *=| =====================================*/ #define TASK_HUD 2100 #define ID_HUD (taskid - TASK_HUD) enum { CAMPO_RANGO , CAMPO_FRAG , CAMPO_MAX } new g_campos [ CAMPO_MAX ] /* ==================================== |=* [INIT] *=| =====================================*/ public plugin_init () { register_plugin ( PLUGIN , VERSION , AUTHOR ) register_event ( "DeathMsg" , "Event_DeathMsg" , "a" ) register_logevent ( "logevent_round_end" , 2 , "1=Round_End" ) register_clcmd ( "say" , "message_saytext" ) register_clcmd ( "say_team" , "message_sayteam" ) register_clcmd ( "say /rangos" , "RangoSv" ) register_clcmd ( "dar_frags" , "cmd_frags" , ADMIN_RCON , " ^" Nombre ^ " ^" Cantidad ^ "" ) /* ============================================= |= [EMPIEZA SECCION MODIFICABLE] =| ==============================================*/ cvar_Hud = register_cvar ( "rangos_hud" , "1" ) // 1 - Mostrar HUD | 0 - No Mostrar cvar_knifex2 = register_cvar ( "rangos_knifex2" , "1" ) // 1 - x2 frags con knife | 0 - NO :v cvar_hsx2 = register_cvar ( "rangos_hsx2" , "1" ) // 1 - x2 frags de HeadShot | 0 - NO :v /* ============================================= |=* [TERMINA SECCION MODIFICABLE] *=| ==============================================*/ SyncHUD = CreateHudSyncObj () g_maxplayers = get_maxplayers () g_msgTeamInfo = get_user_msgid ( "TeamInfo" ) g_msgSayText = get_user_msgid ( "SayText" ) g_vault = adv_vault_open ( "data_rangos" , false ) g_campos [ CAMPO_RANGO ] = adv_vault_register_field ( g_vault , "RANGOS" ) g_campos [ CAMPO_FRAG ] = adv_vault_register_field ( g_vault , "FRAGS" ) adv_vault_init ( g_vault ) get_configsdir ( configsdir , charsmax ( configsdir )) format ( rangosfile , charsmax ( rangosfile ), "%s/rango.cfg" , configsdir ) rangos = file_size ( rangosfile , 1 ) } /* ==================================== |=* [PRECACHE] *=| =====================================*/ public plugin_precache () precache_sound ( Sonido ) /* =================================== |=* [HUD] *=| =====================================*/ public HUD ( taskid ) { new id = ID_HUD new name [ 33 ] get_user_name ( id , name , charsmax ( name )) new stats [ 8 ], body [ 8 ]; new rank = get_user_stats ( id , stats , body ) new rank2 = get_statsnum () if (! is_user_alive ( id )) { id = pev ( id , pev_iuser2 ) if (! is_user_alive ( id )) return; } if( id != ID_HUD ) { set_hudmessage ( 242 , 195 , 43 , 0.03 , 0.14 , 0 , 0.0 , 1.0 , 0.01 , 0.1 ) ShowSyncHudMsg ( ID_HUD , SyncHUD , "Nombre: %s^nFrags: %d^nRango: %s^n" , name , g_frags [ id ], Rangos [ g_rango [ id ]][ NOMBRE ]) } else { set_hudmessage ( 242 , 195 , 43 , 0.17 , 0.0 , 0 , 0.0 , 1.0 , 0.01 , 0.1 ) ShowSyncHudMsg ( ID_HUD , SyncHUD , "Frags: %d / %d^nRango: %s^nSig Rango: %s^nTop-Ranking: %d de %d^nAdrenalina: (%d/100)" , g_frags [ id ], Rangos [ g_rango [ id ]][ FRAGS ] - g_frags [ id ], Rangos [ g_rango [ id ]][ NOMBRE ], Rangos [ g_rango [ id ]+ 1 ][ NOMBRE ], rank , rank2 , jctf_get_adrenaline ( id )) } } public RangoSv ( id ) { for(new i ; i < rangos ; i ++) { read_file ( rangosfile , i , Data , charsmax ( Data ), charnum ) if( strlen ( Data ) < 2 || Data [ 0 ] == ';' || equali ( Data , "//" , 2 )) continue argbreak ( Data , Left , charsmax ( Left ), Right , charsmax ( Right )) remove_quotes ( Left ) remove_quotes ( Right ) client_print ( id , print_console , "%s [%s]" , Right , Left ) } PrintText ( id , "!g[!y%s!g] !yLa lista de !g/rangos !y se muestra en la !tconsola!g." , Prefijo ) } /* ================================== |=* [PUTINSERVER] *=| ===================================*/ public client_putinserver ( id ) { get_user_name ( id , g_playername [ id ], charsmax ( g_playername [ ] ) ); g_rango [ id ] = 0 g_frags [ id ] = 0 Cargar ( id ) if( get_pcvar_num ( cvar_Hud )) set_task ( 1.0 , "HUD" , id + TASK_HUD , _ , _ , "b" ) } /* ================================== |=* [DISCONNECT] *=| ===================================*/ public client_disconnected ( id ) { Guardar ( id ); remove_task ( id + TASK_HUD ) } /* ================================== |=* [ROUND END] *=| ===================================*/ public logevent_round_end () { for(new id = 1 ; id <= g_maxplayers ; id ++) Guardar ( id ); } /* ================================== |=* [DEATHMSG] *=| ===================================*/ public Event_DeathMsg () { new attacker = read_data ( 1 ) new victim = read_data ( 2 ) new hs = read_data ( 3 ) new weaponid = get_user_weapon ( attacker ) if( victim == attacker ) return; if( is_user_alive ( attacker )) { g_frags [ attacker ]++ if( get_pcvar_num ( cvar_knifex2 )) { if( weaponid == CSW_KNIFE ) g_frags [ attacker ]++ } if( get_pcvar_num ( cvar_hsx2 )) { if( hs ) g_frags [ attacker ]++ } AumentarRango ( attacker ) } } /* ================================ |=* [UPDATE RANGO] *=| =================================*/ AumentarRango ( id ) { new Aumento = false while( g_frags [ id ] >= Rangos [ g_rango [ id ]][ FRAGS ]) { Aumento = true g_rango [ id ]++ } if( Aumento ) { PrintText ( id , "!g[!y%s!g] !yFelicidades subiste al rango!t: !g%s" , Prefijo , Rangos [ g_rango [ id ]][ NOMBRE ]) client_cmd ( id , "spk %s" , Sonido ) Aumento = false } } /*===================================== |=* [SAY] *=| =====================================*/ public message_saytext ( id ) { static said [ 192 ] read_args ( said , charsmax ( said )) remove_quotes ( said ) if ( said [ 0 ] == '@' || said [ 0 ] == '%' || said [ 0 ] == '.' || said [ 0 ] == '!' || equal ( said , "" )) return PLUGIN_HANDLED ; if (! ValidMessage ( said , 1 )) return PLUGIN_CONTINUE ; static color [ 11 ], name [ 32 ], alive [ 11 ] get_user_team ( id , color , charsmax ( color )) get_user_name ( id , name , charsmax ( name )) if ( is_user_alive ( id )) { alive = "" } else { alive = "*Muerto*" } /*===================================== *[ACTIVAR ADM]* ADMIN_LEVEL_B = n DUEÑO ADMIN_LEVEL_C = o DUEÑA ADMIN_LEVEL_E = q SUB DUEÑO ADMIN_LEVEL_D = p ADMIN-VIP =====================================*/ if ( is_user_admin ( id )) { if ( get_user_flags ( id ) & ADMIN_LEVEL_B ) format ( said , charsmax ( said ), "[%s] [%s] %s (DUEÑO) %s: %s" , Prefijo , alive , Rangos [ g_rango [ id ]][ NOMBRE ], name , said ) if ( get_user_flags ( id ) & ADMIN_LEVEL_C ) format ( said , charsmax ( said ), "[%s] [%s] %s (DUEÑA) %s: %s" , Prefijo , alive , Rangos [ g_rango [ id ]][ NOMBRE ], name , said ) if ( get_user_flags ( id ) & ADMIN_LEVEL_E ) format ( said , charsmax ( said ), "^4[^1%s^4] ^4[^1%s^4] %s ^1(^4SUB^1-^4DUEÑO^1) ^3%s ^4: %s" , Prefijo , Rangos [ g_rango [ id ]][ NOMBRE ], alive , name , said ) if ( get_user_flags ( id ) & ADMIN_LEVEL_D ) format ( said , charsmax ( said ), "^4[^1%s^4] ^4[^1%s^4] %s ^1(^4ADMIN^1) ^3%s ^4: %s" , Prefijo , Rangos [ g_rango [ id ]][ NOMBRE ], alive , name , said ) } else { format ( said , charsmax ( said ), "^4[^1%s^4] %s^3 %s ^1: %s" , alive , Rangos [ g_rango [ id ]][ NOMBRE ], name , said ) } static i , team [ 11 ] for ( i = 1 ; i <= g_maxplayers ; i ++) { if (! is_user_connected ( i )) continue get_user_name ( id , name , charsmax ( name )) if ( is_user_admin ( i ) || is_user_alive ( id ) && is_user_alive ( i ) || ! is_user_alive ( id ) && ! is_user_alive ( i )) { get_user_team ( i , team , charsmax ( team )) changeTeamInfo ( i , color ) writeMessage ( i , said ) changeTeamInfo ( i , team ) } } return PLUGIN_HANDLED_MAIN ; } public message_sayteam ( id ) { static said [ 192 ] read_args ( said , charsmax ( said )) remove_quotes ( said ) if ( said [ 0 ] == '@' || said [ 0 ] == '%' || said [ 0 ] == '/' || said [ 0 ] == '.' || said [ 0 ] == '!' || equal ( said , "" )) return PLUGIN_HANDLED ; if (! ValidMessage ( said , 1 )) return PLUGIN_CONTINUE ; static playerTeam , playerTeamName [ 19 ] playerTeam = get_user_team ( id ) switch ( playerTeam ) { case 1 : copy ( playerTeamName , 6 , "^3[TE]" ) case 2 : copy ( playerTeamName , 8 , "^3[CT]" ) default: copy ( playerTeamName , 11 , "^3[SPEC]" ) } static color [ 11 ], name [ 32 ], alive [ 11 ] get_user_team ( id , color , charsmax ( color )) get_user_name ( id , name , charsmax ( name )) if ( is_user_alive ( id )) { alive = "" } else { alive = "*Muerto* " } if ( is_user_admin ( id )) { format ( said , charsmax ( said ), "[%s] [%s] %s %s (DUEÑO) %s: %s" , Prefijo , alive , Rangos [ g_rango [ id ]][ NOMBRE ], playerTeam , name , said ) if ( get_user_flags ( id ) & ADMIN_LEVEL_C ) format ( said , charsmax ( said ), "[%s] [%s] %s %s (DUEÑA) %s: %s" , Prefijo , alive , Rangos [ g_rango [ id ]][ NOMBRE ], playerTeam , name , said ) if ( get_user_flags ( id ) & ADMIN_LEVEL_E ) format ( said , charsmax ( said ), "^4[^1%s^4] ^4[^1%s^4] %s%s ^1(^4SUB^1-^4DUEÑO^1) ^3%s ^4: %s" , Prefijo , Rangos [ g_rango [ id ]], alive , playerTeam , name , said ) if ( get_user_flags ( id ) & ADMIN_LEVEL_D ) format ( said , charsmax ( said ), "^4[^1%s^4] ^4[^1%s^4] %s%s ^1(^4ADMIN^1) ^3%s ^4: %s" , Prefijo , Rangos [ g_rango [ id ]], alive , playerTeam , name , said ) } else { format ( said , charsmax ( said ), "%s %s %s %s: %s" , alive , Rangos [ g_rango [ id ]], playerTeam , name , said ) } static i , team [ 11 ] for ( i = 1 ; i <= g_maxplayers ; i ++) { if (! is_user_connected ( i )) continue; get_user_name ( id , name , charsmax ( name )) if ( get_user_team ( i ) == playerTeam || is_user_admin ( i )) { if ( is_user_alive ( id ) && is_user_alive ( i ) || ! is_user_alive ( id ) && ! is_user_alive ( i )) { get_user_team ( i , team , charsmax ( team )) changeTeamInfo ( i , color ) writeMessage ( i , said ) changeTeamInfo ( i , team ) } } } return PLUGIN_HANDLED_MAIN ; } public changeTeamInfo ( player , team []) { message_begin ( MSG_ONE , g_msgTeamInfo , _ , player ) write_byte ( player ) write_string ( team ) message_end () } public writeMessage ( player , message []) { message_begin ( MSG_ONE , g_msgSayText , { 0 , 0 , 0 }, player ) write_byte ( player ) write_string ( message ) message_end () } /* =================================== |=* [GUARDADO] *=| =====================================*/ Guardar ( id ) { adv_vault_set_start ( g_vault ) adv_vault_set_field ( g_vault , g_campos [ CAMPO_RANGO ], g_rango [ id ]) adv_vault_set_field ( g_vault , g_campos [ CAMPO_FRAG ], g_frags [ id ]) adv_vault_set_end ( g_vault , 0 , g_playername [ id ]) } Cargar ( id ) { if(! adv_vault_get_prepare ( g_vault , _ , g_playername [ id ])) return g_rango [ id ] = adv_vault_get_field ( g_vault , g_campos [ CAMPO_RANGO ]) g_frags [ id ] = adv_vault_get_field ( g_vault , g_campos [ CAMPO_FRAG ]) } /* =================================== |=* [STOCKS - CHEMA] *=| =====================================*/ stock PrintText ( const iIndex , const Text [ ], any :... ) { new szText [ 192 ]; vformat ( szText , sizeof ( szText ), Text , 3 ); replace_all ( szText , sizeof ( szText ), "!y" , "^1" ); replace_all ( szText , sizeof ( szText ), "!g" , "^4" ); replace_all ( szText , sizeof ( szText ), "!t" , "^3" ); static iLen = sizeof ( szText ); replace_all ( szText , iLen , "á" , "á" ); replace_all ( szText , iLen , "Á" , "Ã" ); replace_all ( szText , iLen , "é" , "é" ); replace_all ( szText , iLen , "É" , "É" ); replace_all ( szText , iLen , "í" , "Ã*" ); replace_all ( szText , iLen , "Í" , "Ã" ); replace_all ( szText , iLen , "ó" , "ó" ); replace_all ( szText , iLen , "Ó" , "Ó" ); replace_all ( szText , iLen , "ú" , "ú" ); replace_all ( szText , iLen , "Ú" , "Ú" ); replace_all ( szText , iLen , "ñ" , "ñ" ); replace_all ( szText , iLen , "Ñ" , "Ñ" ); message_begin ( iIndex ? MSG_ONE_UNRELIABLE : MSG_BROADCAST , get_user_msgid ( "SayText" ), . player = iIndex ); write_byte ( iIndex ? iIndex : 33 ); write_string ( szText ); message_end ( ); } /* ===================================================== |=* [Stock para Saber Si el mensaje es valido] *=| ======================================================*/ stock ValidMessage ( text [], maxcount ) { static len , i , count len = strlen ( text ) count = 0 if (! len ) return false ; for ( i = 0 ; i < len ; i ++) { if ( text [ i ] != ' ' ) { count ++ if ( count >= maxcount ) return true ; } } return false ; } public cmd_frags ( id , nivel , cid ) { if (! cmd_access ( id , nivel , cid , 3 )) return PLUGIN_HANDLED ; new arg [ 33 ], arg2 [ 10 ] new name [ 32 ]; get_user_name ( id , name , charsmax ( name )) read_argv ( 1 , arg , charsmax ( arg )) read_argv ( 2 , arg2 , charsmax ( arg2 )) new Player = cmd_target ( id , arg , CMDTARGET_ONLY_ALIVE ) new target [ 32 ]; get_user_name ( Player , target , charsmax ( target )) if (! Player ) { client_print ( id , print_console , "No se encuentra disponible el jugador" ) return PLUGIN_HANDLED ; } new amount = str_to_num ( arg2 ) g_frags [ Player ] += amount // aca sumamos los frags AumentarRango ( Player ) // aca tenes que poner tu checklevel asi cuando le de , checkea si puede subir de level PrintText ( id , "!g[!yAMXX!g] !yEl Admin !g%s !yte dio !g%d !t%s" , name , amount , ( amount > 1 ? "niveles" : "nivel" )) PrintText ( id , "!g[!yAMXX!g] !yLe diste !g%d !t%s !yal jugador !g%s" , amount , ( amount > 1 ? "niveles" : "nivel" ), target ) return PLUGIN_HANDLED ; }
Mensajes: 207
Temas: 62
Registro en: Feb 2018
Reputación:
0
(28/05/2019, 05:37 PM) Reverant escribió: Solo debías acomodar bien los caracteres.
PD: Ponle el color tu
Código PHP:
/* =============================== Version Con Guardado adv_vault ================================*/ /* ==================================== |=* [INCLUDES] *=| =====================================*/ #include <amxmisc> #include <csstats> #include <cstrike> #include <fakemeta> #include <adv_vault> #include <jctf> /* ==================================== |=* [PLUGIN / VERSION / AUTHOR] *=| =====================================*/ new const PLUGIN [] = "RangoS" new const VERSION [] = "1.1" new const AUTHOR [] = "kikizon" /* ============================================= |=* [EMPIEZA SECCION MODIFICABLE] *=| ==============================================*/ /* ==================================== |=* [CONSTANTES] *=| =====================================*/ new const Prefijo [] = "FOS" // Prefijo en say new const Sonido [] = "Rango/up.wav" // Sonido Rango UP /* ==================================== |=* [CONST NOMBRES DE RANGOS] *=| =====================================*/ enum _ : DATA { NOMBRE [ 32 ], FRAGS , ADRENALINA } new const Rangos [][ DATA ] = { { "Novato" , 100 }, { "Silver I" , 200 }, { "Silver II" , 300 }, { "Silver III" , 500 }, { "Silver IV" , 700 }, { "Silver Elite" , 800 }, { "Silver Elite Master" , 900 }, { "Gold Nova I" , 1000 }, { "Gold Nova II" , 1200 }, { "Gold Nova III" , 1300 }, { "Gold Nova Master" , 1400 }, { "Master Guardian I" , 1500 }, { "Master Guardian II" , 1700 }, { "Master Guardian Elite" , 1800 }, { "Distinguido Master Guardian" , 1900 }, { "Legendary Eagle" , 2000 }, { "Legendary Eagle Master" , 2100 }, { "Supreme Master" , 2200 }, { "The Global Elite" , 2500 } } /* ==================================== |=* [VARIABLES] *=| =====================================*/ new g_rango [ 33 ], g_frags [ 33 ], g_playername [ 33 ][ 32 ], Data [ 255 ], Left [ 25 ], Right [ 50 ], configsdir [ 200 ], rangosfile [ 200 ] new SyncHUD , g_maxplayers , g_msgTeamInfo , g_msgSayText , rangos , cvar_Hud , cvar_knifex2 , cvar_hsx2 , charnum ; new g_vault /* ==================================== |=* [DEFINE] *=| =====================================*/ #define TASK_HUD 2100 #define ID_HUD (taskid - TASK_HUD) enum { CAMPO_RANGO , CAMPO_FRAG , CAMPO_MAX } new g_campos [ CAMPO_MAX ] /* ==================================== |=* [INIT] *=| =====================================*/ public plugin_init () { register_plugin ( PLUGIN , VERSION , AUTHOR ) register_event ( "DeathMsg" , "Event_DeathMsg" , "a" ) register_logevent ( "logevent_round_end" , 2 , "1=Round_End" ) register_clcmd ( "say" , "message_saytext" ) register_clcmd ( "say_team" , "message_sayteam" ) register_clcmd ( "say /rangos" , "RangoSv" ) register_clcmd ( "dar_frags" , "cmd_frags" , ADMIN_RCON , " ^" Nombre ^ " ^" Cantidad ^ "" ) /* ============================================= |= [EMPIEZA SECCION MODIFICABLE] =| ==============================================*/ cvar_Hud = register_cvar ( "rangos_hud" , "1" ) // 1 - Mostrar HUD | 0 - No Mostrar cvar_knifex2 = register_cvar ( "rangos_knifex2" , "1" ) // 1 - x2 frags con knife | 0 - NO :v cvar_hsx2 = register_cvar ( "rangos_hsx2" , "1" ) // 1 - x2 frags de HeadShot | 0 - NO :v /* ============================================= |=* [TERMINA SECCION MODIFICABLE] *=| ==============================================*/ SyncHUD = CreateHudSyncObj () g_maxplayers = get_maxplayers () g_msgTeamInfo = get_user_msgid ( "TeamInfo" ) g_msgSayText = get_user_msgid ( "SayText" ) g_vault = adv_vault_open ( "data_rangos" , false ) g_campos [ CAMPO_RANGO ] = adv_vault_register_field ( g_vault , "RANGOS" ) g_campos [ CAMPO_FRAG ] = adv_vault_register_field ( g_vault , "FRAGS" ) adv_vault_init ( g_vault ) get_configsdir ( configsdir , charsmax ( configsdir )) format ( rangosfile , charsmax ( rangosfile ), "%s/rango.cfg" , configsdir ) rangos = file_size ( rangosfile , 1 ) } /* ==================================== |=* [PRECACHE] *=| =====================================*/ public plugin_precache () precache_sound ( Sonido ) /* =================================== |=* [HUD] *=| =====================================*/ public HUD ( taskid ) { new id = ID_HUD new name [ 33 ] get_user_name ( id , name , charsmax ( name )) new stats [ 8 ], body [ 8 ]; new rank = get_user_stats ( id , stats , body ) new rank2 = get_statsnum () if (! is_user_alive ( id )) { id = pev ( id , pev_iuser2 ) if (! is_user_alive ( id )) return; } if( id != ID_HUD ) { set_hudmessage ( 242 , 195 , 43 , 0.03 , 0.14 , 0 , 0.0 , 1.0 , 0.01 , 0.1 ) ShowSyncHudMsg ( ID_HUD , SyncHUD , "Nombre: %s^nFrags: %d^nRango: %s^n" , name , g_frags [ id ], Rangos [ g_rango [ id ]][ NOMBRE ]) } else { set_hudmessage ( 242 , 195 , 43 , 0.17 , 0.0 , 0 , 0.0 , 1.0 , 0.01 , 0.1 ) ShowSyncHudMsg ( ID_HUD , SyncHUD , "Frags: %d / %d^nRango: %s^nSig Rango: %s^nTop-Ranking: %d de %d^nAdrenalina: (%d/100)" , g_frags [ id ], Rangos [ g_rango [ id ]][ FRAGS ] - g_frags [ id ], Rangos [ g_rango [ id ]][ NOMBRE ], Rangos [ g_rango [ id ]+ 1 ][ NOMBRE ], rank , rank2 , jctf_get_adrenaline ( id )) } } public RangoSv ( id ) { for(new i ; i < rangos ; i ++) { read_file ( rangosfile , i , Data , charsmax ( Data ), charnum ) if( strlen ( Data ) < 2 || Data [ 0 ] == ';' || equali ( Data , "//" , 2 )) continue argbreak ( Data , Left , charsmax ( Left ), Right , charsmax ( Right )) remove_quotes ( Left ) remove_quotes ( Right ) client_print ( id , print_console , "%s [%s]" , Right , Left ) } PrintText ( id , "!g[!y%s!g] !yLa lista de !g/rangos !y se muestra en la !tconsola!g." , Prefijo ) } /* ================================== |=* [PUTINSERVER] *=| ===================================*/ public client_putinserver ( id ) { get_user_name ( id , g_playername [ id ], charsmax ( g_playername [ ] ) ); g_rango [ id ] = 0 g_frags [ id ] = 0 Cargar ( id ) if( get_pcvar_num ( cvar_Hud )) set_task ( 1.0 , "HUD" , id + TASK_HUD , _ , _ , "b" ) } /* ================================== |=* [DISCONNECT] *=| ===================================*/ public client_disconnected ( id ) { Guardar ( id ); remove_task ( id + TASK_HUD ) } /* ================================== |=* [ROUND END] *=| ===================================*/ public logevent_round_end () { for(new id = 1 ; id <= g_maxplayers ; id ++) Guardar ( id ); } /* ================================== |=* [DEATHMSG] *=| ===================================*/ public Event_DeathMsg () { new attacker = read_data ( 1 ) new victim = read_data ( 2 ) new hs = read_data ( 3 ) new weaponid = get_user_weapon ( attacker ) if( victim == attacker ) return; if( is_user_alive ( attacker )) { g_frags [ attacker ]++ if( get_pcvar_num ( cvar_knifex2 )) { if( weaponid == CSW_KNIFE ) g_frags [ attacker ]++ } if( get_pcvar_num ( cvar_hsx2 )) { if( hs ) g_frags [ attacker ]++ } AumentarRango ( attacker ) } } /* ================================ |=* [UPDATE RANGO] *=| =================================*/ AumentarRango ( id ) { new Aumento = false while( g_frags [ id ] >= Rangos [ g_rango [ id ]][ FRAGS ]) { Aumento = true g_rango [ id ]++ } if( Aumento ) { PrintText ( id , "!g[!y%s!g] !yFelicidades subiste al rango!t: !g%s" , Prefijo , Rangos [ g_rango [ id ]][ NOMBRE ]) client_cmd ( id , "spk %s" , Sonido ) Aumento = false } } /*===================================== |=* [SAY] *=| =====================================*/ public message_saytext ( id ) { static said [ 192 ] read_args ( said , charsmax ( said )) remove_quotes ( said ) if ( said [ 0 ] == '@' || said [ 0 ] == '%' || said [ 0 ] == '.' || said [ 0 ] == '!' || equal ( said , "" )) return PLUGIN_HANDLED ; if (! ValidMessage ( said , 1 )) return PLUGIN_CONTINUE ; static color [ 11 ], name [ 32 ], alive [ 11 ] get_user_team ( id , color , charsmax ( color )) get_user_name ( id , name , charsmax ( name )) if ( is_user_alive ( id )) { alive = "" } else { alive = "*Muerto*" } /*===================================== *[ACTIVAR ADM]* ADMIN_LEVEL_B = n DUEÑO ADMIN_LEVEL_C = o DUEÑA ADMIN_LEVEL_E = q SUB DUEÑO ADMIN_LEVEL_D = p ADMIN-VIP =====================================*/ if ( is_user_admin ( id )) { if ( get_user_flags ( id ) & ADMIN_LEVEL_B ) format ( said , charsmax ( said ), "[%s] [%s] %s (DUEÑO) %s: %s" , Prefijo , alive , Rangos [ g_rango [ id ]][ NOMBRE ], name , said ) if ( get_user_flags ( id ) & ADMIN_LEVEL_C ) format ( said , charsmax ( said ), "[%s] [%s] %s (DUEÑA) %s: %s" , Prefijo , alive , Rangos [ g_rango [ id ]][ NOMBRE ], name , said ) if ( get_user_flags ( id ) & ADMIN_LEVEL_E ) format ( said , charsmax ( said ), "^4[^1%s^4] ^4[^1%s^4] %s ^1(^4SUB^1-^4DUEÑO^1) ^3%s ^4: %s" , Prefijo , Rangos [ g_rango [ id ]][ NOMBRE ], alive , name , said ) if ( get_user_flags ( id ) & ADMIN_LEVEL_D ) format ( said , charsmax ( said ), "^4[^1%s^4] ^4[^1%s^4] %s ^1(^4ADMIN^1) ^3%s ^4: %s" , Prefijo , Rangos [ g_rango [ id ]][ NOMBRE ], alive , name , said ) } else { format ( said , charsmax ( said ), "^4[^1%s^4] %s^3 %s ^1: %s" , alive , Rangos [ g_rango [ id ]][ NOMBRE ], name , said ) } static i , team [ 11 ] for ( i = 1 ; i <= g_maxplayers ; i ++) { if (! is_user_connected ( i )) continue get_user_name ( id , name , charsmax ( name )) if ( is_user_admin ( i ) || is_user_alive ( id ) && is_user_alive ( i ) || ! is_user_alive ( id ) && ! is_user_alive ( i )) { get_user_team ( i , team , charsmax ( team )) changeTeamInfo ( i , color ) writeMessage ( i , said ) changeTeamInfo ( i , team ) } } return PLUGIN_HANDLED_MAIN ; } public message_sayteam ( id ) { static said [ 192 ] read_args ( said , charsmax ( said )) remove_quotes ( said ) if ( said [ 0 ] == '@' || said [ 0 ] == '%' || said [ 0 ] == '/' || said [ 0 ] == '.' || said [ 0 ] == '!' || equal ( said , "" )) return PLUGIN_HANDLED ; if (! ValidMessage ( said , 1 )) return PLUGIN_CONTINUE ; static playerTeam , playerTeamName [ 19 ] playerTeam = get_user_team ( id ) switch ( playerTeam ) { case 1 : copy ( playerTeamName , 6 , "^3[TE]" ) case 2 : copy ( playerTeamName , 8 , "^3[CT]" ) default: copy ( playerTeamName , 11 , "^3[SPEC]" ) } static color [ 11 ], name [ 32 ], alive [ 11 ] get_user_team ( id , color , charsmax ( color )) get_user_name ( id , name , charsmax ( name )) if ( is_user_alive ( id )) { alive = "" } else { alive = "*Muerto* " } if ( is_user_admin ( id )) { format ( said , charsmax ( said ), "[%s] [%s] %s %s (DUEÑO) %s: %s" , Prefijo , alive , Rangos [ g_rango [ id ]][ NOMBRE ], playerTeam , name , said ) if ( get_user_flags ( id ) & ADMIN_LEVEL_C ) format ( said , charsmax ( said ), "[%s] [%s] %s %s (DUEÑA) %s: %s" , Prefijo , alive , Rangos [ g_rango [ id ]][ NOMBRE ], playerTeam , name , said ) if ( get_user_flags ( id ) & ADMIN_LEVEL_E ) format ( said , charsmax ( said ), "^4[^1%s^4] ^4[^1%s^4] %s%s ^1(^4SUB^1-^4DUEÑO^1) ^3%s ^4: %s" , Prefijo , Rangos [ g_rango [ id ]], alive , playerTeam , name , said ) if ( get_user_flags ( id ) & ADMIN_LEVEL_D ) format ( said , charsmax ( said ), "^4[^1%s^4] ^4[^1%s^4] %s%s ^1(^4ADMIN^1) ^3%s ^4: %s" , Prefijo , Rangos [ g_rango [ id ]], alive , playerTeam , name , said ) } else { format ( said , charsmax ( said ), "%s %s %s %s: %s" , alive , Rangos [ g_rango [ id ]], playerTeam , name , said ) } static i , team [ 11 ] for ( i = 1 ; i <= g_maxplayers ; i ++) { if (! is_user_connected ( i )) continue; get_user_name ( id , name , charsmax ( name )) if ( get_user_team ( i ) == playerTeam || is_user_admin ( i )) { if ( is_user_alive ( id ) && is_user_alive ( i ) || ! is_user_alive ( id ) && ! is_user_alive ( i )) { get_user_team ( i , team , charsmax ( team )) changeTeamInfo ( i , color ) writeMessage ( i , said ) changeTeamInfo ( i , team ) } } } return PLUGIN_HANDLED_MAIN ; } public changeTeamInfo ( player , team []) { message_begin ( MSG_ONE , g_msgTeamInfo , _ , player ) write_byte ( player ) write_string ( team ) message_end () } public writeMessage ( player , message []) { message_begin ( MSG_ONE , g_msgSayText , { 0 , 0 , 0 }, player ) write_byte ( player ) write_string ( message ) message_end () } /* =================================== |=* [GUARDADO] *=| =====================================*/ Guardar ( id ) { adv_vault_set_start ( g_vault ) adv_vault_set_field ( g_vault , g_campos [ CAMPO_RANGO ], g_rango [ id ]) adv_vault_set_field ( g_vault , g_campos [ CAMPO_FRAG ], g_frags [ id ]) adv_vault_set_end ( g_vault , 0 , g_playername [ id ]) } Cargar ( id ) { if(! adv_vault_get_prepare ( g_vault , _ , g_playername [ id ])) return g_rango [ id ] = adv_vault_get_field ( g_vault , g_campos [ CAMPO_RANGO ]) g_frags [ id ] = adv_vault_get_field ( g_vault , g_campos [ CAMPO_FRAG ]) } /* =================================== |=* [STOCKS - CHEMA] *=| =====================================*/ stock PrintText ( const iIndex , const Text [ ], any :... ) { new szText [ 192 ]; vformat ( szText , sizeof ( szText ), Text , 3 ); replace_all ( szText , sizeof ( szText ), "!y" , "^1" ); replace_all ( szText , sizeof ( szText ), "!g" , "^4" ); replace_all ( szText , sizeof ( szText ), "!t" , "^3" ); static iLen = sizeof ( szText ); replace_all ( szText , iLen , "á" , "á" ); replace_all ( szText , iLen , "Á" , "Ã" ); replace_all ( szText , iLen , "é" , "é" ); replace_all ( szText , iLen , "É" , "É" ); replace_all ( szText , iLen , "í" , "Ã*" ); replace_all ( szText , iLen , "Í" , "Ã" ); replace_all ( szText , iLen , "ó" , "ó" ); replace_all ( szText , iLen , "Ó" , "Ó" ); replace_all ( szText , iLen , "ú" , "ú" ); replace_all ( szText , iLen , "Ú" , "Ú" ); replace_all ( szText , iLen , "ñ" , "ñ" ); replace_all ( szText , iLen , "Ñ" , "Ñ" ); message_begin ( iIndex ? MSG_ONE_UNRELIABLE : MSG_BROADCAST , get_user_msgid ( "SayText" ), . player = iIndex ); write_byte ( iIndex ? iIndex : 33 ); write_string ( szText ); message_end ( ); } /* ===================================================== |=* [Stock para Saber Si el mensaje es valido] *=| ======================================================*/ stock ValidMessage ( text [], maxcount ) { static len , i , count len = strlen ( text ) count = 0 if (! len ) return false ; for ( i = 0 ; i < len ; i ++) { if ( text [ i ] != ' ' ) { count ++ if ( count >= maxcount ) return true ; } } return false ; } public cmd_frags ( id , nivel , cid ) { if (! cmd_access ( id , nivel , cid , 3 )) return PLUGIN_HANDLED ; new arg [ 33 ], arg2 [ 10 ] new name [ 32 ]; get_user_name ( id , name , charsmax ( name )) read_argv ( 1 , arg , charsmax ( arg )) read_argv ( 2 , arg2 , charsmax ( arg2 )) new Player = cmd_target ( id , arg , CMDTARGET_ONLY_ALIVE ) new target [ 32 ]; get_user_name ( Player , target , charsmax ( target )) if (! Player ) { client_print ( id , print_console , "No se encuentra disponible el jugador" ) return PLUGIN_HANDLED ; } new amount = str_to_num ( arg2 ) g_frags [ Player ] += amount // aca sumamos los frags AumentarRango ( Player ) // aca tenes que poner tu checklevel asi cuando le de , checkea si puede subir de level PrintText ( id , "!g[!yAMXX!g] !yEl Admin !g%s !yte dio !g%d !t%s" , name , amount , ( amount > 1 ? "niveles" : "nivel" )) PrintText ( id , "!g[!yAMXX!g] !yLe diste !g%d !t%s !yal jugador !g%s" , amount , ( amount > 1 ? "niveles" : "nivel" ), target ) return PLUGIN_HANDLED ; }
ahora sale peor los caracteres, bueh no importa se queda eso asi gracias por la ayuda
»» RENTA TU SERVIDOR EN EVOLUTIÓN-HOST ««
Si deseas contactarme para comprar tu servidor de counter-strike puedes enviar un M.P