•  
     

Adicionar senha quando o Server lotar - AMXX

Código: Selecionar todos

#include <amxmodx>
#include <amxmisc>
#define PLUGIN "MaxPlayersPassword"
#define VERSION "1.0"
#define AUTHOR "DA"
new howmanyplayers,password;
public plugin_init(){
register_plugin(PLUGIN,VERSION,AUTHOR)
howmanyplayers = register_cvar("mpp_maxplayers","32");	
password = register_cvar ("mpp_password","acemprol");
}
public client_connect(id){
static players[32], num;
get_players ( players, num, "c" );
num++;
if(num >= get_pcvar_num( howmanyplayers )){
static SetPassword[32];
get_pcvar_string (password,SetPassword,charsmax(SetPassword ));
set_cvar_string ( "sv_password", SetPassword );
}
}
public client_disconnect(id){
static CurPassword[32];
get_cvar_string ( "sv_password", CurPassword, charsmax( CurPassword ) );
if(equal(CurPassword,"")){
return PLUGIN_CONTINUE;
}
static players[32],num;
get_players (players,num,"c");
if(num < get_pcvar_num(howmanyplayers)){
set_cvar_string ("sv_password","");
}
return PLUGIN_CONTINUE;
}