AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Enabled and disabled problem (https://forums.alliedmods.net/showthread.php?t=22025)

DarlD 12-16-2005 23:24

Enabled and disabled problem
 
Im creating a World of Warcraft mod for amxmodx. With the inventory, the bags, the weapons and skills. a lot of work ahead :P and i have to admit this plugin might be a little bit out of my league, but eh what the eck!

Im using a bool to enable and disable all the commands at once
Code:
new bool:enabled
And i use read_argv to set it, like so:
Code:
public enable(id,level,cid)     {     if (!cmd_access(id,level,cid,1))         {         client_print(id,print_console,"[World Of Warcraft]: You have no access to this command")         return PLUGIN_HANDLED     }     new arg[11]     read_argv(1,arg,10)         if ( (equali(arg,"on", 2)) || (equal(arg,"1", 1)) )         {         enabled = true         client_print(0,print_chat,"[World Of Warcraft] is now Enabled")         client_print(0,print_console,"[World Of Warcraft] is now Enabled")     }     else     if ( (equali(arg,"off",3)) || (equal(arg,"0",4)) )         {         enabled = false         client_print(0,print_chat,"[World Of Warcraft] is now Disabled")         client_print(0,print_console,"[World Of Warcraft] is now Disabled")     }     return PLUGIN_HANDLED }

problem is that the cmds are not registering. when i type wow_enabled on in the console it does nothing

getting 1 warning when i try to compile
Code:

warning 204: symbol is assigned a value that is never used: "enabled"

teame06 12-16-2005 23:28

where else are you using the bool enabled ?

Xanimos 12-16-2005 23:30

Who script?

DarlD 12-16-2005 23:32

@suicid3: my own

@teame06: I will be using it when an admin will try to enable or disable the other stuff(ex.:bags, inventory)

teame06 12-16-2005 23:33

It just telling you that you havn't used it for nothing yet.

If you make a fake function to test it like..

Code:
function() {     if(enabled)     {         Do stuff.     } }

Then it go away but other than that you really havn't used it.

Xanimos 12-16-2005 23:35

Wow I'm really tired.....I meant to say "Post the script" but instead started to as "Whole script?" then it came out as "Who script?"

Good night.

DarlD 12-16-2005 23:42

rofl, so about the on off command. anyone know why it aint working? (wow_enabled isnt even registered as a command)

if you guyz want to see the hole code now:
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "World of Warcraft" #define AUTHOR "Meta" new bool:enabled public plugin_init()     {     register_plugin(PLUGIN, "0.1", AUTHOR)     register_clcmd("wow_quests","quests",ADMIN_KICK,"Enable or Disable the quests")     register_clcmd("wow_items","items",ADMIN_KICK,"Enable or Disable the items")     register_clcmd("wow_bags","bags",ADMIN_KICK,"Enable or Disable the bags")     register_clcmd("wow_inventory","inventory",ADMIN_KICK,"Enable or Disable the inventory")     register_clcmd("wow_enable","enable",ADMIN_KICK,"Disable or Enable WoW"); } public enable(id,level,cid)     {     if (!cmd_access(id,level,cid,1))         {         client_print(id,print_console,"[World Of Warcraft]: You have no access to this command")         return PLUGIN_HANDLED     }     new arg[11]     read_argv(1,arg,10)         if ( (equali(arg, "on", 2)) || (equal(arg, "1", 1)) )         {         enabled = true         client_print(0,print_chat,"[World Of Warcraft] is now Enabled")         client_print(0,print_console,"[World Of Warcraft] is now Enabled")     }     else     if ( (equali(arg, "off", 3)) || (equal(arg, "0", 4)) )         {         enabled = false         client_print(0,print_chat,"[World Of Warcraft] is now Disabled")         client_print(0,print_console,"[World Of Warcraft] is now Disabled")     }     return PLUGIN_HANDLED } public quests(id,level,cid)     {     if (!cmd_access(id,level,cid,1))         {         client_print(id,print_console,"[World Of Warcraft]: You have no access to this command")         return PLUGIN_HANDLED     }     if ( enabled == true )         {         new arg[11]         read_argv(1,arg,10)                 if ( (equali(arg, "on", 2)) || (equal(arg,"1",1)) )             {             client_print(id,print_console,"[WoW Quests] are now enabled")         }         else         if ( (equali(arg, "off", 3)) || (equal(arg,"0",4)) )             {             client_print(id,print_console,"[WoW Quests] are now disabled")         }     }     return PLUGIN_HANDLED }

XxAvalanchexX 12-17-2005 02:43

Quote:

Originally Posted by DarlD
wow_enabled isnt even registered as a command

It looks like you are registering wow_enable(no d), not wow_enabled.

DarlD 12-17-2005 06:23

I missed typed in the other post i meant wow_enable

Xanimos 12-17-2005 11:20

The reason is that you dont have functions for the other commands. And when plugin_init() get to a register_clcmd() with no function it stops running everything else. So either make the other functions first or comment out the lines with register_clcmd() that dont do anything


All times are GMT -4. The time now is 16:01.

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