Raised This Month: $12 Target: $400
 3% 

menu_destroy


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
elantra86
Member
Join Date: Feb 2014
Old 02-26-2014 , 12:04   menu_destroy
Reply With Quote #1

Hi all!
this is script1.sma

public kz_menu(id)
{
new title[64];
formatex(title, 63, "\yProKreedz %s Menu\w", VERSION)
new menu = menu_create(title, "MenuHandler")

new msgcheck[64], msggocheck[64], msgpause[64]
formatex(msgcheck, 63, "Checkpoint - \y#%i", checknumbers[id])
formatex(msggocheck, 63, "Gocheck - \y#%i", gochecknumbers[id])
formatex(msgpause, 63, "Pause - %s^n", IsPaused[id] ? "\yON" : "\rOFF" )

menu_additem( menu, msgcheck, "1" )
menu_additem( menu, msggocheck, "2" )
menu_additem( menu, "Top 15^n", "3")
menu_additem( menu, "Start", "4")
menu_additem( menu, "Timer Menu", "5" )
menu_additem( menu, msgpause, "6" )
menu_additem( menu, "Invisible Menu", "7" )
menu_additem( menu, "Spectator/CT", "8" )
menu_additem( menu, "Reset Time^n", "9")
menu_additem( menu, "Exit", "MENU_EXIT" )

menu_setprop(menu, MPROP_PERPAGE, 0)
menu_display(id, menu, 0)
return PLUGIN_HANDLED
}

public MenuHandler(id , menu, item)
{
if( item == MENU_EXIT ) {
menu_destroy(menu)
return PLUGIN_HANDLED
}
}

How can i call this selected function in another script2.sma
i mean clear previous menu script1 & call script2 menu

or have any other ways to clear script1 menu between call script2 menu (set_task and kill_task)?
sorry or my english!
thx in advance!

Last edited by elantra86; 02-26-2014 at 12:10.
elantra86 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 02-26-2014 , 19:45   Re: menu_destroy
Reply With Quote #2

Destroying a menu from a separate plugin? Sounds like you need Dynamic Natives
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
elantra86
Member
Join Date: Feb 2014
Old 02-26-2014 , 23:21   Re: menu_destroy
Reply With Quote #3

Quote:
Originally Posted by hornet View Post
Destroying a menu from a separate plugin? Sounds like you need Dynamic Natives
thx i understand.
but 1 question:
param register_plugin in 1st script & 2nd script is equal
Whether it is important? or i can use different params ?
PHP Code:
// pro_menu_close.inc
#pragma reqlib "pro_menu_close"

native menu_destroyer(id
PHP Code:
// script2.sma
#include <pro_menu_close>

use menu_destroyer(id
PHP Code:
// script1.sma
public plugin_natives()
{
    
register_library("pro_menu_close")
    
register_native("menu_destroyer","menu_destroy(menu)")
}
public 
_menu_destroyer(id)
{
    new 
id menu_destroy(menu)
    return 
PLUGIN_HANDLED

where i do mistake plz help!

Last edited by elantra86; 02-27-2014 at 01:22.
elantra86 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 02-27-2014 , 09:23   Re: menu_destroy
Reply With Quote #4

Quote:
Originally Posted by elantra86 View Post
PHP Code:
// pro_menu_close.inc
#pragma reqlib "pro_menu_close"

native menu_destroyer() 
PHP Code:
// script2.sma
#include <pro_menu_close>

use menu_destroyer() 
PHP Code:
// script1.sma
public plugin_natives()
{
    
register_library("pro_menu_close")
    
register_native("menu_destroyer","_menu_destroyer")
}
public 
_menu_destroyer(iPluginiParams)
{
    
menu_destroy(menu)

EDIT: This is assuming that menu is a global variable. If it isn't, then what you are trying to do is not possible
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).

Last edited by YamiKaitou; 02-27-2014 at 09:24.
YamiKaitou is offline
elantra86
Member
Join Date: Feb 2014
Old 02-27-2014 , 09:37   Re: menu_destroy
Reply With Quote #5

OK. can i clear or destroy any menu in new plugin to avoid overlap??
this example for prokreedz 2.31 & mapchooser4

Last edited by elantra86; 02-27-2014 at 09:40.
elantra86 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 02-27-2014 , 10:18   Re: menu_destroy
Reply With Quote #6

What are you trying to accomplish?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
elantra86
Member
Join Date: Feb 2014
Old 02-27-2014 , 10:46   Re: menu_destroy
Reply With Quote #7

i try close menu prokreedz.sma
before call mapchooser4.sma menu
KWo reply today & he said :
this plugin isn't resitstant to overlap with menus created by other plugins nor get overlaped by them.

https://forums.alliedmods.net/showth...=46104&page=64
elantra86 is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 02-27-2014 , 10:59   Re: menu_destroy
Reply With Quote #8

Quote:
Originally Posted by elantra86 View Post
i try close menu prokreedz.sma
before call mapchooser4.sma menu
KWo reply today & he said :
this plugin isn't resitstant to overlap with menus created by other plugins nor get overlaped by them.

https://forums.alliedmods.net/showth...=46104&page=64
In mapchooser4, you need to check if an player have open the menu, if yes you can add delay to open wanted menu, and if the player still in kreedzmenu, you add other delay (Like a " LOOP ")

correct-me, if i am wrong
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
elantra86
Member
Join Date: Feb 2014
Old 02-27-2014 , 11:03   Re: menu_destroy
Reply With Quote #9

can u show this in script plz ?
elantra86 is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 02-27-2014 , 11:09   Re: menu_destroy
Reply With Quote #10

Quote:
Originally Posted by elantra86 View Post
can u show this in script plz ?
Is not an script, you need only to put in mapchooser4

__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
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 07:32.


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