This plugin for clan war servers.
Description:
This plugin will force non admins to input a password in the console when entering the server. They have a certain time to enter the password, and a certain number of tries. If the password is incorrect or they dont enter one, they will be kicked from the server.
CVAR's:
ppc_password <password> - this is the server password
ppc_checkpass 1 |0 - this is on or off
ppc_passtime 80 - this is the time they have to enter the password
ppc_passtrys 2 - this is the number of invalid tries
Commands:
ppc_adminpass - tells an admin the password
Client Commands:
ppc_password <password> - do that in console to enter the password Server not kick admins.
I need that I can type pass before enter server and server not kick if my pass good. Now I can type only in game.
For examble setinfo ppc_password "password"
But I can't connect "setinfo" function.. HELP. thx
Code:
#include <amxmodx>
#include <amxmisc>
new bool:passok[33]
new passtry[33]
public plugin_init()
{
register_plugin("Pass Checker", "0.1", "PeteyB")
register_cvar("ppc_password", "password") //this is your password feild
register_cvar("ppc_checkpass", "1") //this is on or off
register_cvar("ppc_passtime", "80") //this is the time to say password
register_cvar("ppc_passtrys", "2") //this is the number of trys allowed
register_clcmd("ppc_adminpass", "admintellpass") //admins use this to see password
register_clcmd("ppc_password", "check_pass")
}
public admintellpass(id)
{
if(get_user_flags(id) & ADMIN_LEVEL_C)
{
new tpassword[40]
get_cvar_string("ppc_password", tpassword, 39)
console_print(id, "PPC Password: %s - To change: Change the cvar ppc_password", tpassword)
}
else
console_print(id, "Must be admin to check the PPC password")
}
public client_putinserver(id)
{
if(get_cvar_num("ppc_checkpass") && !(get_user_flags(id) & ADMIN_LEVEL_C))
{
passtry[id] = 0
passok[id] = false
set_task(float(get_cvar_num("ppc_passtime")), "nopass", id)
set_task(10.0, "tellpass", id)
}
}
public nopass(id)
{
if(access(id,ADMIN_KICK))
{
client_print(id,print_chat,"[ADMIN] No Kick For You")
}
else
{
if(get_cvar_num("ppc_checkpass") && passok[id] == false)
client_cmd(id, "echo [PPC]You did not enter a password;disconnect")
}
}
public tellpass(id)
{
if(access(id,ADMIN_KICK))
{
console_print(id,"[ADMIN] No Kick")
}
else
{
if(passok[id] == false)
{
client_print(id, print_center, "[PPC]In console type: ppc_password <the server password>")
set_task(10.0, "tellpass", id)
}
}
}
public check_pass(id)
{
new password[40]
read_args(password, 39)
new ppcpass[40]
get_cvar_string("ppc_password", ppcpass,39)
if(equal(password,ppcpass))
{
passtry[id] = 0
console_print(id,"[PPC]Correct Password")
passok[id] = true
}
else
{
passtry[id] += 1
console_print(id,"[PPC]Incorect Password - Try Again")
passok[id] = false
}
if(passtry[id] == get_cvar_num("ppc_passtrys"))
client_cmd( id,"echo [PPC]Too many invalid attempts;disconnect")
}