This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

register_native & use


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
elantra86
Member
Join Date: Feb 2014
Old 02-27-2014 , 01:26   register_native & use
Reply With Quote #1

PHP Code:
// part of script1.sma
public kz_menu(id)
{
    new 
title[64];
    
formatex(title63"\yГлавное меню\w"VERSION)
    new 
menu menu_create(title"MenuHandler")  
    
    new 
msgcheck[64], msggocheck[64], msgpause[64]
    
formatex(msgcheck63"Сохранение - \y#%i"checknumbers[id])
    
formatex(msggocheck63"Перемещение - \y#%i",  gochecknumbers[id])
    
formatex(msgpause63"Пауза - %s^n"IsPaused[id] ? "\yВкл" "\rВыкл" )
    
    
    
menu_additemmenumsgcheck"1" )
    
menu_additemmenumsggocheck"2" )
    
menu_additemmenu"EXIT""MENU_EXIT" )
    
    
menu_setprop(menuMPROP_PERPAGE0)
    
menu_display(idmenu0)
    return 
PLUGIN_HANDLED 
}

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
}


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


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


where i do mistake plz help!
elantra86 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-27-2014 , 03:08   Re: register_native & use
Reply With Quote #2

"menu_destroy(menu)" this should be your callback "_menu_destroyer".
__________________
Arkshine is offline
elantra86
Member
Join Date: Feb 2014
Old 02-27-2014 , 04:32   Re: register_native & use
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
"menu_destroy(menu)" this should be your callback "_menu_destroyer".
i want call function menu_destroy(menu)

in script2.sma how can i do this?
or clear all menus to to avoid overlap seperate menus.

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

here menu_destroy(menu) works fine


help plz!

Last edited by elantra86; 02-27-2014 at 04:36.
elantra86 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 02-27-2014 , 09:25   Re: register_native & use
Reply With Quote #4

Don't create a new thread when you already have one
__________________
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
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 05:11.


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