AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help me with my Plugin (https://forums.alliedmods.net/showthread.php?t=29551)

thomas_rox3 06-07-2006 16:37

Help me with my Plugin
 
Code:
#include <amxmodx> #include <amxmisc> #define DRUG            (1<<7) // 128 #define PLUGIN "DrinknDrug" #define VERSION "Beta" #define AUTHOR "*[9mm]* Thomas" new gmsgSetFOV new PlayerFlags[32] public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_cvar("amx_drinkndrug","0",ADMIN_CHAT)     new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4     register_menucmd(register_menuid("DrinknDrug"), keys, "drinkndrugmenu")     register_clcmd("drinkndrug","drinkndrug")     register_clcmd("say drink","Drink")     register_clcmd("say_team drink","Drink")     register_clcmd("say sober","Sober")     register_clcmd("say_team sober","Sober")     register_clcmd("say toke", "Toke")     register_clcmd("say_team toke","Toke")     register_clcmd("say undrug", "UnDrug")     register_clcmd("say_team undrug","UnDrug")     gmsgSetFOV = get_user_msgid("SetFOV") } public drinkndrug(id) {     new menu[192]     new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4       format(menu, 191, "What doyo u wanna take?^n^n1. Drinkg^n2. Sober^n3. Drug^n4. Undrug")     show_menu(id, keys, menu)     return PLUGIN_HANDLED } public drinkndrugmenu(id, key) {     if (key == 0)     {               } else if (key == 1) {         client_print(id,print_chat,"No function yet")     } else if (key == 2) {         client_print(id,print_chat,"No function yet")     }else if (key == 3) {         client_print(id,print_chat,"No function yet")     }else if (key == 4) {         client_print(id,print_chat,"No function yet")     } } public client_connect( id ) {     client_cmd( id,"writecfg backup" ) } public client_disconnect( id ) {     if ( task_exists(id) )     {         remove_task( id )     }     client_cmd( id,"exec backup.cfg" ) } public event_SetFOV(id) {     if(is_user_alive(id))     {         if((PlayerFlags[id] & DRUG))         {             message_begin(MSG_ONE, gmsgSetFOV, {0,0,0}, id)             write_byte(170)             message_end()         }     } } public Toke(id) {     if (get_cvar_num("drinkndrug") != 1)     {         client_print(id,print_chat,"Allowing fun is not activated!")         return PLUGIN_HANDLED     }     if (is_user_alive(id) == 1 && get_cvar_num("drinkndrug") == 1)     {               new name[33]             get_user_name(id,name,32)             set_hudmessage(200, 100, 0, -1.0, 0.35, 5)             show_hudmessage(0,"%s is now drugged!",name)             message_begin(MSG_ONE, gmsgSetFOV, {0,0,0}, id)             write_byte(170)             message_end()     }         else if (is_user_alive(id) == 0)     {               client_print(id,print_chat,"You must be alive to call the Drug function!")             return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE } public UnDrug(id) {     if (is_user_alive(id) == 1)     {         new name[33]         get_user_name(id,name,32)         set_hudmessage(200, 100, 0, -1.0, 0.35, 5)         show_hudmessage(0," %s is now undrugged!",name)         client_print(id,print_chat,"You have now been undrugged!")         message_begin(MSG_ONE, gmsgSetFOV, {0,0,0}, id)         write_byte(gmsgSetFOV)         message_end()     }     else if (is_user_alive(id) == 0)     {         client_print(id,print_chat,"You will be undrugged at the beginning of the next round")         message_begin(MSG_ONE, gmsgSetFOV, {0,0,0}, id)         write_byte(gmsgSetFOV)         message_end()     }     return PLUGIN_CONTINUE } public Drink(id) {     if (get_cvar_num("drinkndrug") == 1)     {         new name[33]         get_user_name(id,name,32)         set_hudmessage(200, 100, 0, -1.0, 0.35, 5)         show_hudmessage(0,"%s is now drunk!",name)         client_print(id,print_chat,"You are now drunk! Remember: Don't drink and drive!")     }     } public Sober(id) {     new name[33]     get_user_name(id,name,32)         set_hudmessage(200, 100, 0, -1.0, 0.35, 5)     show_hudmessage(0, "%s is now sober!",name)     client_print(id, print_chat, "You are now sober - go find your car keys!")     remove_task(id)     client_cmd(id, "exec backup.cfg")     }
Thats my plugin to drink and toke but it doesn't seem to do anything at all if someone can help me seeing as this is only my second ever plugin. My menu has no functions because I couldn't figure out how to get the drink, sober, toke and undrug functions to execute in those. It's be greatly appriechated for some1 to help me along with this.


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

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