AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   New Amxx Menu Help and checking! (https://forums.alliedmods.net/showthread.php?t=92554)

Frozen Usp 05-16-2009 19:35

New Amxx Menu Help and checking!
 
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?

alekoooooo 05-17-2009 02:21

Re: New Amxx Menu Help and checking!
 
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
        



Frozen Usp 05-17-2009 04:31

Re: New Amxx Menu Help and checking!
 
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>


All times are GMT -4. The time now is 01:36.

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