07/08/2018, 07:57 PM
(Última modificación: 08/08/2018, 11:41 PM por Valentina..)
AMXX Reset Score With Timer
Descripción:
Permite reinciar tus estadísticas en la tabla de estadísticas valga la redundancia.
Librerías:
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:
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 [ 0 ], szPluginInfo [ 1 ], szPluginInfo [ 2 ] );
for ( new id; id < sizeof g_sSayCommands; id++ ) {
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" ) != -1 )
server_cmd ( "amx_pausecfg add ^"%s^"", szPluginInfo [ 0 ] );
}
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 ( id, g_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_sCommunity, g_sPlayerName [ id ], get_user_frags ( id ), get_user_deaths ( id ) );
set_user_frags ( id, 0 );
cs_set_user_deaths ( id, 0 );
set_user_frags ( id, 0 );
cs_set_user_deaths ( id, 0 );
/* ACTUALIZAR EL SCOREBOARD AL INSTANTE */
message_begin ( MSG_ALL, 85 );
write_byte ( id );
write_short ( 0 );
write_short ( 0 );
write_short ( 0 );
write_short ( 0 );
message_end ( );
}
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 ( );
}
Saludos y espero que le sirva a más de uno.