AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How/what code to add to turn a plugin on/off? (https://forums.alliedmods.net/showthread.php?t=27969)

allenwr 05-03-2006 23:14

How/what code to add to turn a plugin on/off?
 
I have tried using
Code:
register_concmd(amx_nng 1, check_noobguns)
thats not exact, but what is the right way to do it? or does it depend?

Smokey485 05-03-2006 23:32

Woah woah, that is horrid code, it seems that your new to AMXX


Alright, heres what you would do

Code:
#include <amxmodx> #include <amxmisc> #include <fun> // probably needed for what you want to do. public plugin_init() { register_concmd("amx_nng", "check_noobguns", ADMIN_ALL, "amx_nng name") } public check_noobguns(id) { new arg[33] read_argv(1, arg, 32) // get what the admin typed in for name new target = cmd_target(id, arg, 3) // whatever your purpose was }

allenwr 05-03-2006 23:42

and that would turn a plugin on and off?

"amx_nng name" <---- ?

Xanimos 05-03-2006 23:43

It depends on the plugin. You would have to code into the plugin a way to turn it on and off. What plugin are you trying to add that to?

allenwr 05-03-2006 23:43

the one i have been making, nonoobguns

allenwr 05-04-2006 01:33

Code:
#include <amxmodx>       #include <amxmisc>     #include <cstrike> #include <fun>       public plugin_init()       {           register_plugin("Nonoobguns", "1.4", "Allenwr")           register_concmd("amx_nng", "check_noobguns", ADMIN_ADMIN, "amx_nng name") // Need help here     register_event("WeapPickup", "check_noobguns", "b")           register_cvar("amx_nonoobguns", "1")       } public check_noobguns(id)       {           if(get_cvar_num("amx_nonoobguns") != 1 || !is_user_alive(id))               return PLUGIN_CONTINUE

this is only a portion, but im not sure on how to finish it right, so it is amx_nng 1 for on and amx_nng 0 for off

allenwr 05-04-2006 12:04

bump.

VEN 05-04-2006 12:39

Here is simple example just to show you the idea:
[edit: hm, i think you wanted not that...]

Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {     register_plugin("Nonoobguns", "1.4", "Allenwr")     register_concmd("amx_nng", "check_noobguns", ADMIN_ADMIN, "[0|1]")     register_cvar("amx_nonoobguns", "1") } public check_noobguns(id, level, cid) {     if (!cmd_access(id, level, cid, 1))         return PLUGIN_HANDLED     if (read_argc() == 1) { // if no arguments supplied we show current plugin's state         console_print(id, "^"amx_nng^" is ^"%d^"", get_cvar_num("amx_nonoobguns") ? 1 : 0)         return PLUGIN_HANDLED     }     // if argument specified we set new plugin's state (1 is on, 0 is off)     new arg[2]     read_argv(1, arg, 1)     set_cvar_num("amx_nonoobguns", str_to_num(arg) ? 1 : 0)     return PLUGIN_HANDLED }

allenwr 05-04-2006 12:50

i think i understand, but im not too sure, can we talk on pm to figure/help me finish this part of my project?

VEN 05-04-2006 12:56

Better ask here but ok, you can.


All times are GMT -4. The time now is 05:10.

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