AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Menu problem (https://forums.alliedmods.net/showthread.php?t=88989)

Emilioneri 03-31-2009 16:52

Menu problem
 
I tried to edit my "Heal for Money" plugin, but the plugin doesn't works. whats wrong?
Code:
/* Plugin generated by Emilioneri */ #include <amxmodx> #include <cstrike> #include <fun> #define PLUGIN "Heal for money" #define VERSION "1.1" #define AUTHOR "Emilioneri" new g_Cost new yes[200] new no[200] public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         g_Cost = register_cvar("amx_healcost", "7000")         register_clcmd("say /buyheal", "cmd_buyheal") } public cmd_buyheal(id) {     new menu = menu_create("\rDo you want to restore your health ??", "heal_menu")         formatex(yes, 199, "Yes")     menu_additem(menu, yes, "1")         formatex(no, 199, "No")     menu_additem(menu, no, "2")         menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)     menu_display(id, menu, 0) } public heal_menu(id, menu, item) {     if (item == MENU_EXIT)     {         menu_destroy(menu)         return PLUGIN_HANDLED     }         new Data[6];     new Access;     new Name[64];     new Callback;         new Key = str_to_num(Data);     menu_item_getinfo(menu, item, Access, Data, 5, Name, 63, Callback)         switch (Key)     {         case 1:         {             if ( !is_user_alive (id) )             {                 client_print(id, print_chat, "You can't buy health cuz you are dead!")                 return PLUGIN_HANDLED             }                 new iMoney = cs_get_user_money(id)             new iCost = get_pcvar_num(g_Cost)                         if(iMoney >= iCost)             {                 set_user_health(id, 100)                         cs_set_user_money(id, iMoney - iCost)                         client_print(id, print_chat, "Your health have been restored for $%i", iCost)                 return PLUGIN_HANDLED             }                 else             {                 client_print(id, print_chat, "You don't have enaugh money! $%i needed!", iCost)             }                 return PLUGIN_HANDLED         }                 case 2:         {             menu_destroy(menu)             return PLUGIN_HANDLED         }     }     return PLUGIN_HANDLED }

alan_el_more 03-31-2009 16:58

Re: Code is compiling but plugin doesn't works
 
this is the problem
PHP Code:

formatex(yes199"Yes")
menu_additem(menuyes"1")
    
formatex(no199"No")
menu_additem(menuno"2"

look at this

https://forums.alliedmods.net/showth...6364#BasicMenu

One 03-31-2009 17:03

Re: Code is compiling but plugin doesn't works
 
i think its better when u add a new if.
if(get_user_health < 99)

there are many idiots that copies all things what another player says..

for example i need just to write /rank in my server... all player says /rank

or i say /sex :mrgreen: u must just see howmuch players says this.


All times are GMT -4. The time now is 02:17.

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