Whats is better?
Please, explain what is better script (Remember: the plugins have the same function).
cvar: pug_warmup is created by other plugin
PHP Code:
public CHECAR() { get_players(USERS,TRs,"e","TERRORIST") get_players(USERS,CTs,"e","CT") TOTAL = get_playersnum()
new WARMUP = get_cvar_num("pug_warmup")
if(WARMUP == 1) return PLUGIN_HANDLED
else if(WARMUP == 2 && TOTAL <= MINIMOGH) { client_print(0,3,"%s Faltam %d jogadores para continuar. (Reiniciando em %d segundos)",HEADER,(10 - TOTAL),TEMPO) set_task(float(TEMPO),"RESTART") return PLUGIN_HANDLED } else if(WARMUP == 0 && TRs <= MINIMO) { client_print(0,3,"%s Reiniciando sistema em %d segundos. (Faltando: %d TRs - %d CTs)",HEADER,TEMPO,(5 - TRs),(5 - CTs)) set_task(float(TEMPO),"RESTART") return PLUGIN_HANDLED } else if(WARMUP == 0 && CTs <= MINIMO) { client_print(0,3,"%s Reiniciando sistema em %d segundos. (Faltando: %d TRs - %d CTs)",HEADER,TEMPO,(5 - TRs),(5 - CTs)) set_task(float(TEMPO),"RESTART") return PLUGIN_HANDLED } return PLUGIN_HANDLED }
Or:
PHP Code:
public CHECAR() { get_players(USERS,TRs,"e","TERRORIST") get_players(USERS,CTs,"e","CT") TOTAL = get_playersnum()
new WARMUP = get_cvar_num("pug_warmup")
switch(WARMUP) { case 0: { if(TRs <= MINIMO) { client_print(0,3,"%s Reiniciando sistema em %d segundos. (Faltando: %d TRs - %d CTs)",HEADER,TEMPO,(5 - TRs),(5 - CTs)) set_task(float(TEMPO),"RESTART") return PLUGIN_HANDLED } else if(CTs <= MINIMO) { client_print(0,3,"%s Reiniciando sistema em %d segundos. (Faltando: %d TRs - %d CTs)",HEADER,TEMPO,(5 - TRs),(5 - CTs)) set_task(float(TEMPO),"RESTART") return PLUGIN_HANDLED } } case 1: { return PLUGIN_HANDLED } case 2: { if(TOTAL <= MINIMOGH) { client_print(0,3,"%s Faltam %d jogadores para continuar. (Reiniciando em %d segundos)",HEADER,(10 - TOTAL),TEMPO) set_task(float(TEMPO),"RESTART") return PLUGIN_HANDLED } } } return PLUGIN_HANDLED }
Ps. If it is not no, explain more :)
The beginning of the code:
PHP Code:
#include <amxmodx> #include <amxmisc> #include <cstrike>
#define HEADER "[PUG]"
new USERS[32],TRs,CTs,TOTAL new MINIMO = 3 new MINIMOGH = 5 new TEMPO = 10
public plugin_init() { register_plugin("Minplayers",AMXX_VERSION_STR ,"SmileY") register_logevent("CHECAR",2,"1=Round_Start") }
public RESTART() { server_cmd("pug_votemap_enabled 1") set_cvar_num("pug_votemap",1) server_cmd("restart") }
|