Raised This Month: $ Target: $400
 0% 

Would need some help.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DarlD
Senior Member
Join Date: Aug 2004
Old 10-18-2005 , 00:48   Would need some help.
Reply With Quote #1

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Buy Health"
#define VERSION "1.0"
#define AUTHOR "Meta"
new mBuyHealth // Menu
new mcbBuyHealth // Menu Callback



public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_menucmd(register_menuid("Buy Health"), keys, "ma_BuyHealth")
	new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2
	register_event("Buy Health", "healthmenu", "be")
	/* Menu Buy Health */
	/* Use menu_display(id, mBuyHealth, 0) to show the menu to an user. */
	mBuyHealth = menu_create("Buy Health", "mh_BuyHealth")
	mcbBuyHealth = menu_makecallback("mcb_BuyHealth")
	menu_additem(mBuyHealth, "Buy 10HP - 100$", "ma_BuyHealth", ADMIN_USER, mcbBuyHealth)
	menu_additem(mBuyHealth, "Buy 20HP - 200$", "ma_BuyHealth", ADMIN_USER, mcbBuyHealth)
	menu_additem(mBuyHealth, "Buy 30HP - 300$", "ma_BuyHealth", ADMIN_USER, mcbBuyHealth)
	menu_additem(mBuyHealth, "Buy 40HP - 400$", "ma_BuyHealth", ADMIN_USER, mcbBuyHealth)
	menu_additem(mBuyHealth, "Buy 50HP - 500$", "ma_BuyHealth", ADMIN_USER, mcbBuyHealth)
	menu_additem(mBuyHealth, "Buy 100HP - 1000$", "ma_BuyHealth", ADMIN_USER, mcbBuyHealth)
	menu_additem(mBuyHealth, "Buy 5000HP - 16000$", "ma_BuyHealth", ADMIN_USER, mcbBuyHealth)
	/* Menu End */

	// Add your code here...
	
}


/* Menu Buy Health */

public mh_BuyHealth(id, menu, item) {
	/* This event is called when someone presses a key on this menu */
}

public ma_BuyHealth(id) {
	/* This event is called when an item was selected */
}

public mcb_BuyHealth(id, menu, item) {
	/* This is the callback-event, here you can set items enabled or disabled. */
	/* If you want to enable an item, use: return ITEM_ENABLED */
	/* If you want to disable an item, use: return ITEM_DISABLED */
}
public healthmenu() {
	
	new menu[192]
         new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2
	
         show_menu(id, keys, menu)
    return PLUGIN_HANDLED
}

so basicly im trying to make a menu in order to buy health, right. i think i got all this programing thing ok but im not sure how to set it all up right, im still missing some key things and i know this code is probably total garbage :S but if anyone could show me where i made mistakes that would be really helpfull, thanks
DarlD is offline
Send a message via MSN to DarlD
broertje
Senior Member
Join Date: Mar 2005
Old 10-18-2005 , 14:09  
Reply With Quote #2

i got this,but how you give the person +...hp and not just set it to ...hp and how you do -....money:
Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> #define PLUGIN "Buy Health" #define VERSION "1.0" #define AUTHOR "Broertje" public plugin_init() {     register_plugin("Buy Health", "1.0", "Broertje")         register_clcmd("say /buyhealth", "sayHP", 0, "- Show Menu To buy Hp!!!")         register_menucmd(register_menuid("menu_ChooseType"),1023,"ChooseType"); } public sayHP(id) {          new menu[192]     new keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)         format(menu, 191, "^n1. Buy 10HP - 100$^n2. Buy 20HP - 200$^n3. Buy 30HP - 300$^n4. Buy 40HP - 400$^n5. Buy 50HP - 500$^n6. Buy 100HP - 1000$")     show_menu(id, keys, menu, -1, "Buy Health:")       return PLUGIN_HANDLED } public giveStuff(id, key)     {         if (key==0)               {         set_user_health(id,+10)         cs_set_user_money(id,-100,1)     }     if (key==1) {         set_user_health(id,+20)         cs_set_user_money(id,-200,1)     }     if (key==2) {         set_user_health(id,+30)         cs_set_user_money(id,-300,1)     }     if (key==3) {         set_user_health(id,+40)         cs_set_user_money(id,-400,1)     }     if (key==4) {         set_user_health(id,+50)         cs_set_user_money(id,-500,1)     }     }     if (key==5) {         set_user_health(id,+100)         cs_set_user_money(id,-1000,1)     }
broertje is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 10-18-2005 , 14:22  
Reply With Quote #3

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> //What was the point of this if you dont use it? //#define PLUGIN "Buy Health" //#define VERSION "1.0" //#define AUTHOR "Broertje" public plugin_init() {     register_plugin("Buy Health", "1.0", "Broertje")         register_clcmd("say /buyhealth", "sayHP", 0, "- Show Menu To buy Hp!!!")         register_menucmd(register_menuid("BUY_HEALTH"),1023,"giveStuff"); } public sayHP(id) {     new menu[192]     new keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)         format(menu, 191, "\yBuy Health:^n\w^n1. Buy 10HP - 100$^n2. Buy 20HP - 200$^n3. Buy 30HP - 300$^n4. Buy 40HP - 400$^n5. Buy 50HP - 500$^n6. Buy 100HP - 1000$")     show_menu(id, keys, menu, -1, "BUY_HEALTH")       return PLUGIN_HANDLED } public giveStuff(id, key) {     switch(key)     {         case 0:         {             set_user_health(id,(get_user_health(id)+10))             cs_set_user_money(id,(cs_get_user_money(id)-100),1)         }         case 1:         {             set_user_health(id,(get_user_health(id)+20))             cs_set_user_money(id,(cs_get_user_money(id)-200),1)         }         case 2:         {             set_user_health(id,(get_user_health(id)+30))             cs_set_user_money(id,(cs_get_user_money(id)-300),1)         }         case 3:         {             set_user_health(id,(get_user_health(id)+40))             cs_set_user_money(id,(cs_get_user_money(id)-400),1)         }         case 4:         {             set_user_health(id,(get_user_health(id)+50))             cs_set_user_money(id,(cs_get_user_money(id)-500),1)         }         case 5:         {             set_user_health(id,(get_user_health(id)+100))             cs_set_user_money(id,(cs_get_user_money(id)-1000),1)         }     }     return PLUGIN_HANDLED;    }

Try this one.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
broertje
Senior Member
Join Date: Mar 2005
Old 10-18-2005 , 14:24  
Reply With Quote #4

thx,EDIT* No Hp Is Getting Added
broertje is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 10-18-2005 , 14:27  
Reply With Quote #5

Fixed in post above.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
broertje
Senior Member
Join Date: Mar 2005
Old 10-18-2005 , 14:30  
Reply With Quote #6

still not working
broertje is offline
MistaGee
Senior Member
Join Date: Aug 2004
Location: Germany (Fulda)
Old 10-18-2005 , 14:42  
Reply With Quote #7

change the above to
Code:
public giveStuff(id, key)     {         server_print("Menu was shot!")     if (key==0)

to see a message on the server console whenever someone uses the menu. Lets you know that the function is called at all, I once have had this prob myself...

Greetz MGee
__________________
Ich hab nie behauptet dass ich kein Genie bin!
Mumble-Django: A web interface for Mumble
MistaGee is offline
Send a message via ICQ to MistaGee
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 10-18-2005 , 14:45  
Reply With Quote #8

Newest edit should work. I changed his functions around and fixed some errors in his code.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
broertje
Senior Member
Join Date: Mar 2005
Old 10-19-2005 , 09:58  
Reply With Quote #9

Now It Works,Thx,hehe i'm getting better
broertje is offline
DarlD
Senior Member
Join Date: Aug 2004
Old 10-19-2005 , 10:08  
Reply With Quote #10

it might work. but players can buy when they dont have the money!
__________________
DarlD is offline
Send a message via MSN to DarlD
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 23:52.


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