AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Clan WArs plugin (https://forums.alliedmods.net/showthread.php?t=48198)

L3X. 12-07-2006 00:15

Clan WArs plugin
 
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") }

stupok 12-07-2006 00:57

Re: Clan WArs plugin
 
I'm not sure if you will have conflicts by having several things with the same name, test it and see.

Code:
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)     }           new tpassword[40], user_pass[40]         get_cvar_string("ppc_password", tpassword, 39)     get_user_info(id, "ppc_password", user_pass, 39)         if(equal(tpassword, user_pass)) passok[id] = true }

L3X. 12-07-2006 11:23

Re: Clan WArs plugin
 
Quote:

Originally Posted by stupok69 (Post 411780)
I'm not sure if you will have conflicts by having several things with the same name, test it and see.

Code:
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)     }           new tpassword[40], user_pass[40]         get_cvar_string("ppc_password", tpassword, 39)     get_user_info(id, "ppc_password", user_pass, 39)         if(equal(tpassword, user_pass)) passok[id] = true }

Not work.
Now server nobody kick :(

L3X. 12-08-2006 05:31

Re: Clan WArs plugin
 
I do not trust that nobody knows as to correct a code of the program I think that here need function get_user_info but as it to insert and how correctly to use I do not know.

L3X. 12-09-2006 06:44

Re: Clan WArs plugin
 
How I can do that admin set password not in cvar as
register_cvar("ppc_password", "password")

I need do that a simple command
register_clcmd("ppc_password", "password")

public password(id)

............... what I need type here? :) Need help
maybe
new tpassword[40]
set_cvar_string("ppc_password", tpassword, 39)
............


All times are GMT -4. The time now is 06:52.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.