Raised This Month: $ Target: $400
 0% 

What's wrong with my menu functions?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jordan
Veteran Member
Join Date: Aug 2005
Old 01-04-2006 , 19:04   What's wrong with my menu functions?
Reply With Quote #1

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> #define PLUGIN "Personal Gravity" #define VERSION "1.1" #define AUTHOR "SatanWoJ" /*Description: 1) Adds a gravity command which gives an individual player a specific amount of gravity. 2) Allows the players to buy different gravities. Credits: v3x for fixing the warnings :)                     Changelog                   1.0 - Original Coding                   1.1 - Added Description/Credits/Changelog*/ new arg1[32] new arg2[10] public plugin_init() {     register_plugin("Personal Gravity", "1.1", "SatanWoJ")     register_concmd("amx_pgrav", "gravity", ADMIN_KICK, "<nick> <gravity>")     register_clcmd("say /buygrav", "bgrav", 0)     new keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_0     register_menucmd(register_menuid("Gravity Menu"), keys, "GravMenu") } public gravity(id, level, cid) {         if(!cmd_access(id, level, cid, 2))             return PLUGIN_HANDLED             read_argv(1, arg1, 31)         read_argv(2, arg2, 9)         new target = cmd_target(id, arg1, 15)         new Float:amount = str_to_float(arg2)/800         set_user_gravity(target, amount)         return PLUGIN_CONTINUE }     public bgrav(id) {         if(!is_user_alive(id))             return PLUGIN_HANDLED                     new menu[192]         new keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_0         format(menu, 191, "Gravity Menu^n^n1. 100 - $5000^n2. 200 - $3500^n3. 400 - $2000^n4. 550 - $1500^n5. 800 - $0^n^n0. BACK.")         show_menu(id, keys, menu)         return PLUGIN_HANDLED } public gravmenu(id, key) {         if(key == 1)         {             new money = cs_get_user_money(id)             new Float:grav = get_user_gravity(id)             if(money < 5000)             {                 client_print(id, print_chat, "You have insufficient funds!")                 return PLUGIN_HANDLED             }             else if(grav == 0.125)                 {                     client_print(id, print_chat, "You already are at that gravity!")                     return PLUGIN_HANDLED                 } else {                         cs_set_user_money(id, money-5000)                         set_user_gravity(id, 0.125)                         return PLUGIN_HANDLED                     }         }         else if(key == 2)         {             new money = cs_get_user_money(id)             new Float:grav = get_user_gravity(id)             if(money < 3500)             {                 client_print(id, print_chat, "You have insufficient funds!")                 return PLUGIN_HANDLED             }             else if(grav == 0.25)                 {                     client_print(id, print_chat, "You already are at that gravity!")                     return PLUGIN_HANDLED                 } else {                         cs_set_user_money(id, money-3500)                         set_user_gravity(id, 0.25)                         return PLUGIN_HANDLED                     }         }         else if(key == 3)         {             new money = cs_get_user_money(id)             new Float:grav = get_user_gravity(id)             if(money < 2000)             {                 client_print(id, print_chat, "You have insufficient funds!")                 return PLUGIN_HANDLED             }             else if(grav == 0.5)                 {                     client_print(id, print_chat, "You already are at that gravity!")                     return PLUGIN_HANDLED                 } else {                         cs_set_user_money(id, money-2000)                         set_user_gravity(id, 0.5)                         return PLUGIN_HANDLED                     }         }         else if(key == 4)         {             new money = cs_get_user_money(id)             new Float:grav = get_user_gravity(id)             if(money < 1500)             {                 client_print(id, print_chat, "You have insufficient funds!")                 return PLUGIN_HANDLED             }             else if(grav == 0.6875)                 {                     client_print(id, print_chat, "You already are at that gravity!")                     return PLUGIN_HANDLED                 } else {                         cs_set_user_money(id, money-1500)                         set_user_gravity(id, 0.6875)                         return PLUGIN_HANDLED                     }         }         else if(key == 5)         {             new Float:grav = get_user_gravity(id)             if(grav == 1.0)                 {                     client_print(id, print_chat, "You already are at that gravity!")                     return PLUGIN_HANDLED                 } else {                         set_user_gravity(id, 1.0)                         return PLUGIN_HANDLED                     }         }         else if(key == 0)         {             return PLUGIN_HANDLED;         }         return PLUGIN_CONTINUE     }

For some reason, when the person uses /buygrav and pushes a button, no money is taken away, no client_print shows up, and the gravity isn't changed.

BTW this script is edited from the same script but a different coding which I used switch(key) and cases but didn't work either...
Jordan is offline
Des12
Senior Member
Join Date: Jan 2005
Old 01-05-2006 , 20:12  
Reply With Quote #2

Code:
public gravmenu(id, key)

should be

Code:
public GravMenu(id, key)
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
Dirty DuMont
Member
Join Date: Jan 2006
Old 01-05-2006 , 20:15  
Reply With Quote #3

^^ What he said.
Dirty DuMont is offline
Send a message via AIM to Dirty DuMont
Des12
Senior Member
Join Date: Jan 2005
Old 01-05-2006 , 20:24  
Reply With Quote #4

@ Dirty: The point of you post is....? Spam?

Anyways Satanwoj, what is the point of declaring the args globally?
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
Dirty DuMont
Member
Join Date: Jan 2006
Old 01-05-2006 , 20:56  
Reply With Quote #5

Eh, not so much a "spam" post, just pointing out that you were correct. However, your recent post was a "spam" post. And try not to think your the shit on a forum by saying stuff that is totally useless to say.
Dirty DuMont is offline
Send a message via AIM to Dirty DuMont
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 01-05-2006 , 22:51  
Reply With Quote #6

Quote:
Originally Posted by Ðirty Ð
Eh, not so much a "spam" post, just pointing out that you were correct. However, your recent post was a "spam" post. And try not to think your the shit on a forum by saying stuff that is totally useless to say.
1) You (Joined: Jan 2006 ( 14028 ) )
2) Dest (Joined: Jan 2005 ( 5787 ) )
Therefore "try not to think your the shit on a forum by saying stuff that is totally useless to say."
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Dirty DuMont
Member
Join Date: Jan 2006
Old 01-06-2006 , 01:48  
Reply With Quote #7

Ha, how stupid do you feel right now? Who cares about who joined first, this is a community. You think because you joined before I did, you have more authority than I do? Ha, you wish kid. My original post was stating that he was right and that I supported his opinon. Usually when you ask for help you have MORE than one opinon. Re-think your thoughts before you post them. Thanks.
Dirty DuMont is offline
Send a message via AIM to Dirty DuMont
Jordan
Veteran Member
Join Date: Aug 2005
Old 01-06-2006 , 07:08  
Reply With Quote #8

Errr I'm not sure exactly ty des
Jordan is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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