Raised This Month: $ Target: $400
 0% 

User buy hook [ Need help ]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HoLLyWooD
Senior Member
Join Date: Nov 2010
Location: Ukraine Krivoy Rog
Old 01-16-2011 , 10:08   User buy hook [ Need help ]
Reply With Quote #1

A very interesting thing. Invoking the plugin is once per round and only one player! How can this be?

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

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "HoLLyWooD"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd"buy","clcmd_buy");
}

public 
clcmd_buy(id){
    
menu_go(id)
    
log_amx("%d call menu!",id);
}

menu_go(id){
    if(!
is_user_alive(id))
        return 
PLUGIN_HANDLED;
        
    
AwesomeMenu(id);
    return 
PLUGIN_CONTINUE;
}

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);
   
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
    
menu_display(idmenu0);
 }

public 
menu_handler(idmenuitem){
    if( 
item == MENU_EXIT ){
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    new 
key str_to_num(data);
    
    switch(
key){
        case 
1:{
            
client_print(idprint_chat"Hooray! You selected the Awesome 1st Selection");
            
menu_destroy(menu);
            return 
PLUGIN_HANDLED;
        }
        case 
2:{
            
client_print(idprint_chat"OH NO! You selected the Awesome 2nd Selection! BEWARE!");
        }
        case 
3:{
            
client_print(idprint_chat"You have selected the Awesome Admin Selection! Hail Teh Bail!");
        }
    }

    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;


Who can help - that cake

menu get from http://forums.alliedmods.net/showthr...6364#BasicMenu
__________________

You do not know what to tell? Keep silent! You will look cleverer!
Не знаешь что сказать? Промолчи! Будешь выглядеть умней!
Статьи по скриптингу: НА РУССКОМ

Last edited by HoLLyWooD; 01-30-2011 at 14:42.
HoLLyWooD is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 01-16-2011 , 10:36   Re: Plugin works once per round? O_o
Reply With Quote #2

You can make a new global bool and set it false at round start.
Then when the menu is called, check if bool is false.
If it's false, he hasn't used the menu yet, show the menu and set the bool true.

And you could create the awesome menu inside the clcmd_func along with the menu_go(id) function.

And you shouldn't just copy-paste a tutorial, you should read, understand and try to make it yourself.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
HoLLyWooD
Senior Member
Join Date: Nov 2010
Location: Ukraine Krivoy Rog
Old 01-16-2011 , 11:13   Re: Plugin works once per round? O_o
Reply With Quote #3

You do not understand. I do not want to plug used once per round. And I know without the article as to make the menu. I have that plugin written by me working again on the round for one player. I want to help with the correction.

Since I do not see an error in the text that I posted.
__________________

You do not know what to tell? Keep silent! You will look cleverer!
Не знаешь что сказать? Промолчи! Будешь выглядеть умней!
Статьи по скриптингу: НА РУССКОМ
HoLLyWooD is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 01-16-2011 , 11:46   Re: Plugin works once per round? O_o
Reply With Quote #4

Quote:
Originally Posted by HoLLyWooD View Post
I have that plugin written by me working again on the round for one player.
I'm sure you didn't.

What he said is what you need to do to achieve what you want, you're just being ignorant.
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
HoLLyWooD
Senior Member
Join Date: Nov 2010
Location: Ukraine Krivoy Rog
Old 01-16-2011 , 12:02   Re: Plugin works once per round? O_o
Reply With Quote #5

Well I can see, I figured out or not?

I wrote a plugin. Wrote his first with 0. He worked for 1 player per round. I decided that I might not correctly written menu, so he took a menu with a guide.

But it's not on the menu turned out to be. The point may be that I command buy for returning Handled
__________________

You do not know what to tell? Keep silent! You will look cleverer!
Не знаешь что сказать? Промолчи! Будешь выглядеть умней!
Статьи по скриптингу: НА РУССКОМ
HoLLyWooD is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 01-16-2011 , 12:36   Re: Plugin works once per round? O_o
Reply With Quote #6

to make it work do something like this:

PHP Code:
new boolg_MenuUsed[33];

public 
plugin_init()

    
register_logevent("LogEvent_RoundStart"2"1=Round_Start");

    
// Your other stuff.
}

public 
LogEvent_RoundStart()
    
arrayset(g_MenuUsedtruesizeof(g_MenuUsed));

public 
clcmd_buy(id)
{
    if(!
g_MenuUsed[id] && !is_user_alive(id))
    {
        
// Show the menu
    
        
g_MenuUsed[id] = true;
    }
 
    return 
PLUGIN_HANDLED;

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
HoLLyWooD
Senior Member
Join Date: Nov 2010
Location: Ukraine Krivoy Rog
Old 01-16-2011 , 12:45   Re: Plugin works once per round? O_o
Reply With Quote #7

Hmm. Or translater, distorts my message or you do not understand ...

I DO NOT WANT that he worked only 1 time. I want it to work all the time!
__________________

You do not know what to tell? Keep silent! You will look cleverer!
Не знаешь что сказать? Промолчи! Будешь выглядеть умней!
Статьи по скриптингу: НА РУССКОМ
HoLLyWooD is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 01-16-2011 , 14:12   Re: Plugin works once per round? O_o
Reply With Quote #8

Then what's wrong with the code you posted ?
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Elusive138
Senior Member
Join Date: Dec 2010
Old 01-16-2011 , 15:07   Re: Plugin works once per round? O_o
Reply With Quote #9

Quote:
Originally Posted by drekes View Post
Then what's wrong with the code you posted ?
I believe that's what he's asking.
Elusive138 is offline
HoLLyWooD
Senior Member
Join Date: Nov 2010
Location: Ukraine Krivoy Rog
Old 01-16-2011 , 15:09   Re: Plugin works once per round? O_o
Reply With Quote #10

Actually I'm asking what is wrong in my code that causes a time to round it to work?
__________________

You do not know what to tell? Keep silent! You will look cleverer!
Не знаешь что сказать? Промолчи! Будешь выглядеть умней!
Статьи по скриптингу: НА РУССКОМ
HoLLyWooD is offline
Reply


Thread Tools
Display Modes

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:56.


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