[ AMXX ] Reset Score With Timer
#1
AMXX Reset Score With Timer

Descripción:
Permite reinciar tus estadísticas en la tabla de estadísticas valga la redundancia.

Librerías:
Código PHP:
#include < amxmodx >
#include < amxmisc >
#include < cstrike >
#include < fun > 

Cvars:
  • rst_active "1" ( Cualquier otro valor diferente a "0", activa el PLUGIN )
  • rst_admin "1" ( 1 = ADMIN Menos tiempo / 0 = ADMIN Tiempo por defecto. )
  • rst_time "30.0" ( TIEMPO para volver a utilizar el resetscore. )
  • rst_admin_time "15.0" ( TIEMPO para que el ADMIN pueda volver a utilizar el resetscore, si la CVAR rst_admin está activada. )

Changelog:
Cita:VERSIÓN 1.0:

- Lanzamiento del plugin

VERSIÓN 1.1:

- Pequeños cambios en el código.
- ADDED: ACTIVAR / DESACTIVAR plugin por cvar configurable.
- ADDED: TIEMPO configurable por cvar ( VALOR Float ).

VERSIÓN 1.2:

- ADDED: MENOS TIEMPO ADMIN configurable por cvar.
- ADDED: TIEMPO ADMIN configurable por cvar ( VALOR Float ).
- ADDED: Actualizar el SCOREBOARD al instante ( Gracias PredatorFlys ).

Código:
Código PHP:
/* Plugin generated by AMXX-Studio */

#include < amxmodx >
#include < amxmisc >
#include < cstrike >
#include < fun >

new const szPluginInfo [ ][ ] = {
    
    { 
"[AMXX] RESET SCORE WITH TIMER" },
    
    { 
"1.2" },
    
    { 
"Chema" }
    
};

new const 
g_sCommunity[ ] = "!g[BREAKING GAMING]!y";

new const 
g_sUncompress[ ] = "no_amxx_uncompress";

new const 
g_sSayCommands [ ] [ ] = {
    
    
"say /resetscore",
    
    
"say /rs",
    
    
"say_team /resetscore",
    
    
"say_team /rs"
};

new 
Float:g_fTimer[33];

new 
g_sPlayerName 33 ] [ 32 ];

enum pCvarsStruct {
    
    
PLUGIN_ACTIVE,
    
RS_TIME,
    
RS_ADMIN,
    
RS_ADMIN_TIME
}

new 
pCvars pCvarsStruct ];

public 
plugin_init ( ) {
    
    
register_plugin szPluginInfo ], szPluginInfo ], szPluginInfo ] );
    
    for ( new 
idid sizeof g_sSayCommandsid++ ) {
        
        
register_clcmd g_sSayCommands id ], "check_reset" );
    }
    
    
pCvars PLUGIN_ACTIVE ]        = register_cvar "rst_active""1" );
    
    
pCvars RS_TIME ]    = register_cvar "rst_time""30.0" );
    
    
pCvars RS_ADMIN ]    = register_cvar "rst_admin""1" );

    
pCvars RS_ADMIN_TIME ]        = register_cvar "rst_admin_time""15.0" );
    
    
server_print g_sUncompress );
}

public 
plugin_cfg ( ) {
    
    
/* Para que el plugin se cargue con amx_off */
    
    
if ( is_plugin_loaded "Pause Plugins" ) != -)
        
server_cmd "amx_pausecfg add ^"%s^""szPluginInfo ] );
}

public 
check_reset id ) {
    
    if ( !
get_pcvar_num pCvars PLUGIN_ACTIVE ] ) )
        return 
PLUGIN_CONTINUE;
        
    new 
Float:fGameTime get_gametime ( );
    
    if ( 
g_fTimer id ] > fGameTime ) {
        
        
PrintText id"%s Tenés que esperar !g%.2f!y segundos para volver a reiniciar tus estadisticas."g_sCommunity, ( g_fTimer id ] - fGameTime ) );
        return 
PLUGIN_HANDLED;
    }
    
    if ( 
get_pcvar_num pCvars RS_ADMIN ] ) ) {
        
        if ( 
is_user_admin id ) ) {
        
            
g_fTimer id ] = fGameTime get_pcvar_float pCvars RS_ADMIN_TIME ] );
        }
    }
    else {
        
        
g_fTimer id ] = fGameTime get_pcvar_float pCvars RS_TIME ] );
    }
    
    
apply_reset id );
    
    return 
PLUGIN_HANDLED;
}

public 
apply_reset id ) {
    
    
get_user_name idg_sPlayerName id ], charsmax g_sPlayerName ) );
    
    
PrintText id"%s El jugador !g%s!y a reinciado sus estadisticas, !t(!g %d!t Frags!y |!g %d!t Muertes )!y."g_sCommunityg_sPlayerName id ], get_user_frags id ), get_user_deaths id ) );
    
    
set_user_frags id);
    
cs_set_user_deaths id);
    
set_user_frags id);
    
cs_set_user_deaths id);

    
/* ACTUALIZAR EL SCOREBOARD AL INSTANTE */

    
message_begin MSG_ALL85 );
    
write_byte id );
    
write_short );
    
write_short );
    
write_short );
    
write_short );
    
message_end ( ); 
}

stock PrintText ( const iIndex, const Text [ ], any:... ) { 
    
    new 
szText 192 ];
    
    
vformat szTextsizeof szText ), Text);
    
    
    
replace_all szTextsizeof szText ), "!y""^1" );
    
replace_all szTextsizeof szText ), "!g""^4" );
    
replace_all szTextsizeof szText ), "!t""^3" );
    
    static 
iLen sizeof szText );
    
    
    
replace_all szTextiLen"á""á" );
    
replace_all szTextiLen"Á""Ã" );
    
replace_all szTextiLen"é""é" );
    
replace_all szTextiLen"É""É" );
    
replace_all szTextiLen"í""Ã*" );
    
replace_all szTextiLen"Í""Ã" );
    
replace_all szTextiLen"ó""ó" );
    
replace_all szTextiLen"Ó""Ó" );
    
replace_all szTextiLen"ú""ú" );
    
replace_all szTextiLen"Ú""Ú" );
    
replace_all szTextiLen"ñ""ñ" );
    
replace_all szTextiLen"Ñ""Ñ" );
    
    
    
message_begin iIndex MSG_ONE_UNRELIABLE MSG_BROADCASTget_user_msgid "SayText" ), .player iIndex );
    
write_byte iIndex iIndex 33 );
    
write_string szText );
    
message_end (  );


Saludos y espero que le sirva a más de uno. Crab


Archivos adjuntos
.sma   Descargar AMXX / AMXX_ResetScore.sma (Tamaño: 4.17 KB / Descargas: 108)
Responder
#2
Buen plugin = buen aporte
Si no te gusta algo, cámbialo. Si no lo puedes cambiar, cambia la forma en que piensas sobre ello <3
Responder
#3
Código PHP:
    replace_all szTextsizeof szText ), "!y""^1" );
    
replace_all szTextsizeof szText ), "!g""^4" );
    
replace_all szTextsizeof szText ), "!t""^3" );
    
    static 
iLen sizeof szText ); 

->

Código PHP:
    static iLen sizeof szText );

    
replace_all szTextiLen"!y""^1" );
    
replace_all szTextiLen"!g""^4" );
    
replace_all szTextiLen"!t""^3" ); 
Dejad de reportarme diciendo que mis plugins no son mios ayyylmao Insecure

[Imagen: steam-fun.gif]
Responder
#4
Código PHP:
    message_begin(MSG_ALL85);
    
write_byte(id);
    
write_short(0); write_short(0); write_short(0); write_short(0);
    
message_end(); 

en
Código PHP:
apply_reset(id
para que te actualze el score al instante.
[Imagen: 76561198090851442.png]
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)