Raised This Month: $ Target: $400
 0% 

if item is in vault --> item in menu = \d


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
thEsp
BANNED
Join Date: Aug 2017
Old 01-06-2019 , 16:13   Re: if item is in vault --> item in menu = \d
Reply With Quote #6

Sorry for late reply, I created this EXAMPLE code but I haven't tested it. (Should be working in my opinion)


PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "--"
#define VERSION "1.0"
#define AUTHOR "thEsp"

new SpecificItem[32] = "3"

new bool:MenuHas_Item=false

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /test","Test")
    
register_clcmd("say /test_check","TestCheck")
}

public 
Test(id)
{
    new 
menu menu_create("\rMenu for test","menu_handler_event")
    
    new 
i
    
new str[32]
    new 
i_ItemNumber=0
    
new str_ItemNumber[32]
    
    for(
i=0i<6i++)
    {
        if(
i==SpecificItem[id])
        {
            
MenuHas_Item=true
        
}
        
        
num_to_str(i,str,10)
        
num_to_str(i_ItemNumber,str_ItemNumber,10)
        
        
menu_additem(menu,str,str_ItemNumber)
        
        
i_ItemNumber++
    }
    
    
menu_setprop(menu,MPROP_EXIT,MEXIT_ALL)
    
    
menu_display(id,menu,0)
}

public 
menu_handler_event(id,item,menu)
{
    switch(
item)
    {
        case 
MENU_EXIT:
        {
            
menu_destroy(menu)
        }
    }
}

public 
TestCheck(id)
{
    if(
MenuHas_Item==true)
    {
        
client_print(id,print_chat,"Item [ %s ] exists",SpecificItem)
    }

EDIT: I checked this, and works alright. The reason I added just 6 items in menu is because menus can display 7 items (Including exit I think) and make simplier code.

Last edited by thEsp; 01-06-2019 at 16:19. Reason: testing
thEsp is offline
 



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


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