Raised This Month: $ Target: $400
 0% 

User Left Buyzone


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Unkolix
Veteran Member
Join Date: Sep 2012
Old 10-13-2013 , 11:20   User Left Buyzone
Reply With Quote #1

Is there any event when user leaves buy zone? I know there's cs_get_user_buyzone, but using this will make me do tasks...
Unkolix is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-13-2013 , 12:22   Re: User Left Buyzone
Reply With Quote #2

PHP Code:
    register_event("StatusIcon""StatusIcon_buyzone_OFF""be""1=0""2=buyzone"); 
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 10-13-2013 , 12:29   Re: User Left Buyzone
Reply With Quote #3

Quote:
Originally Posted by ConnorMcLeod View Post
PHP Code:
    register_event("StatusIcon""StatusIcon_buyzone_OFF""be""1=0""2=buyzone"); 
Thanks!

Or I shouldn't check cs_get_user_buyzone?
And chosen_guns is true if player took any item from menu, and if he didn't, the menu will be closed.

Last edited by Unkolix; 10-13-2013 at 12:51.
Unkolix is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-13-2013 , 12:33   Re: User Left Buyzone
Reply With Quote #4

You don't need to check for buyzone, but you need to check if the correct menu is opened, so you don't close a wrong menu such as radio/amxmodmenu/langmenu/etc...
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 10-13-2013 , 12:50   Re: User Left Buyzone
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
You don't need to check for buyzone, but you need to check if the correct menu is opened, so you don't close a wrong menu such as radio/amxmodmenu/langmenu/etc...
Yeah. Unfortunately I don't know how to check it...
Unkolix is offline
Old 10-13-2013, 13:33
^SmileY
This message has been deleted by ConnorMcLeod. Reason: not related
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-13-2013 , 14:04   Re: User Left Buyzone
Reply With Quote #6

Using this native :
Code:
/**
 * Returns information about a menu (if any) the client is currently viewing.
 *
 * If newmenu is valid, then the menu will refer to the menuid associated with 
 * the title.  If newmenu is not valid, and the menu is valid, then the player 
 * is viewing a menu displayed with show_menu().
 *
 * Both may be invalid if the player is not viewing a menu.
 *
 * @param id			Client index.
 * @param menu			Variable to store old menu id.  If none, then <1 will be 
 *						stored.
 * @param newmenu		Variable to store new menu id.  If none, then -1 will be 
 *						stored.
 * @param menupage		Variable to store current page of the new menu, if any.
 * @return				1 if the player is viewing a menu, 0 otherwise.
 * @error				Invalid client.
 */
native player_menu_info(id, &menu, &newmenu, &menupage=0);
PHP Code:
public StatusIcon_buyzone_OFFid )
{
    
CheckMenuClose(id);
}

CheckMenuClose(id)
{
    new 
oldMenuIdnewMenuId;
    
player_menu_info(idoldMenuIdnewMenuId)
    if( 
newMenuId > -&& newMenuId == YOUR_MENU )
    {
        
menu_cancel(id)
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 10-13-2013 at 14:08.
ConnorMcLeod is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 10-18-2013 , 11:07   Re: User Left Buyzone
Reply With Quote #7

Thanks a lot. But what is my menu named? It seems that it can't catch it... Should I make my menu name as a global variable?

PHP Code:
new menu
....
menu menu_create(...) 

Last edited by Unkolix; 10-18-2013 at 11:07.
Unkolix is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 10-18-2013 , 12:52   Re: User Left Buyzone
Reply With Quote #8

Quote:
Originally Posted by Unkolix View Post
Thanks a lot. But what is my menu named? It seems that it can't catch it... Should I make my menu name as a global variable?

PHP Code:
new menu
....
menu menu_create(...) 
yes, and instead of creating the same menu over and over again create it once and keep the menu id in global variable.

Last edited by jimaway; 10-18-2013 at 12:52.
jimaway 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 22:43.


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