Raised This Month: $ Target: $400
 0% 

New Amxx Menu Help and checking!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Frozen Usp
Member
Join Date: Sep 2007
Location: Sweden
Old 05-16-2009 , 19:35   New Amxx Menu Help and checking!
Reply With Quote #1

Hi, iīm making a plugin where you can buy diffrent stuff from the menu.
i have been looking around and reading Empīs TUT on the new Amxx Menu but the thing i canīt seem to figure out is...
How do i make a forward so that if a Player press example. nr.1 the plugin starts a special public function? and how do i make it so that the plugin checks that he hasnīt already done it before.

This example is taken from http://forums.alliedmods.net/showthread.php?t=46364 and modded to help people understand my problem

PHP Code:
#include <amxmodx>

 
public plugin_init()
 {
    
register_clcmd"my_awesome_menu","AwesomeMenu");
 }
 public 
AwesomeMenu(id)
 {
    new 
menu menu_create("\rLook at this awesome Menu!:""menu_handler");
     
menu_additem(menu"\wI'm Selection #1""1"0);
    
menu_additem(menu"\wI'm Selection #2""2"0);
    
menu_additem(menu"\wI'm Secret Selection #3""3"ADMIN_ADMIN);
 }

// and so on...

switch(key)
    {
        case 
1:
        {
            
menu_destroy(menu);
            return 
PLUGIN_HANDLED;
        }

public 
ex

 
bla bla user hp.... 
How do i make it so that if a player picks CASE 1, he will get the functions thats writen att public EX?

Last edited by Frozen Usp; 05-16-2009 at 19:37.
Frozen Usp is offline
Send a message via MSN to Frozen Usp
alekoooooo
Member
Join Date: Feb 2009
Old 05-17-2009 , 02:21   Re: New Amxx Menu Help and checking!
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>

 
public plugin_init()
 {
    
register_clcmd"my_awesome_menu","AwesomeMenu");
 }
 public 
AwesomeMenu(id)
 {
    new 
menu menu_create("\rLook at this awesome Menu!:""menu_handler");
     
menu_additem(menu"\wI'm Selection #1""1"0);
    
menu_additem(menu"\wI'm Selection #2""2"0);
    
menu_additem(menu"\wI'm Secret Selection #3""3"ADMIN_ADMIN);
 }

// and so on...

switch(key)
    {
        case 
1:
        {
            
set_user_health(id999// :D
        

__________________
alekoooooo is offline
Frozen Usp
Member
Join Date: Sep 2007
Location: Sweden
Old 05-17-2009 , 04:31   Re: New Amxx Menu Help and checking!
Reply With Quote #3

Alright, Thanks m8
but how do i make a variable so that it checks that the user hasnīt already used on of the stuff under the time hes alive.

EX.
PHP Code:
#include <amxmodx> 
#include <amxmisc> 
#include <fun> 

new checker[id] = 1

 
public plugin_init() 
 { 
    
register_clcmd"my_awesome_menu","AwesomeMenu"); 
 } 
 public 
AwesomeMenu(id
 { 
    new 
menu menu_create("\rLook at this awesome Menu!:""menu_handler"); 
     
menu_additem(menu"\wI'm Selection #1""1"0); 
    
menu_additem(menu"\wI'm Selection #2""2"0); 
    
menu_additem(menu"\wI'm Secret Selection #3""3"ADMIN_ADMIN); 
 } 

// and so on... 

switch(key
    { 
        case 
1: if(checker(id) == 0) {
            return 
PLUGIN_HANDLED
        
{
            
set_user_health(id999// :D
            
checker[id] = 0
        

</span></span>

Last edited by Frozen Usp; 05-17-2009 at 04:35.
Frozen Usp is offline
Send a message via MSN to Frozen Usp
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 01:36.


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