Raised This Month: $ Target: $400
 0% 

Solved [Help] ZP Admin Access Weapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
elmedin
Senior Member
Join Date: Nov 2013
Location: Bruh
Old 05-02-2020 , 12:00   [Help] ZP Admin Access Weapon
Reply With Quote #1

Hey im having a problem with a plugin, i give the weapon admin access only, when i try to buy it the menu appears again which is good, but when i try to get another weapon the moment i press a button the menu just fades away.

CORE Weapon Menu:

Registred native on main weapon core plugin
PHP Code:
register_native("zg_menu""zg_Test"1
PHP Code:
public zg_Test(id)
{
    
Show_MainEquipMenu(id)
    
Reset_PlayerWeapon(id1)

PHP Code:
public Show_MainEquipMenu(id)
{
    if(
zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_sniper(id) || zp_get_user_nemesis(id) || zp_get_user_assassin(id))
        return
    if(
Get_BitVar(g_GotWeaponid))
        return
    

    static 
LangText[64]; formatex(LangTextsizeof(LangText), "%L"GAME_LANG"WPN_MENU_NAME")
    static 
MenuMenu menu_create(LangText"MenuHandle_MainEquip")
    
    static 
WeaponName[32]
    
    if(
g_PreWeapon[id][WPN_PRIMARY] != -1)
    {
        
ArrayGetString(ArWeaponNameg_PreWeapon[id][WPN_PRIMARY], WeaponNamesizeof(WeaponName))
        
formatex(LangTextsizeof(LangText), "%L [\y%s\w]"GAME_LANG"WPN_MENU_PRIMARY"WeaponName)
    } else {
        
formatex(LangTextsizeof(LangText), "%L \d[ ]\w"GAME_LANG"WPN_MENU_PRIMARY")
    }
    
menu_additem(MenuLangText"wpn_pri")
    
    if(
g_PreWeapon[id][WPN_SECONDARY] != -1)
    {
        
ArrayGetString(ArWeaponNameg_PreWeapon[id][WPN_SECONDARY], WeaponNamesizeof(WeaponName))
        
formatex(LangTextsizeof(LangText), "%L [\y%s\w]"GAME_LANG"WPN_MENU_SECONDARY"WeaponName)
    } else {
        
formatex(LangTextsizeof(LangText), "%L \d[ ]\w"GAME_LANG"WPN_MENU_SECONDARY")
    }
    
menu_additem(MenuLangText"wpn_sec")
    
    if(
g_PreWeapon[id][WPN_MELEE] != -1)
    {
        
ArrayGetString(ArWeaponNameg_PreWeapon[id][WPN_MELEE], WeaponNamesizeof(WeaponName))
        
formatex(LangTextsizeof(LangText), "%L [\y%s\w]^n"GAME_LANG"WPN_MENU_MELEE"WeaponName)
    } else {
        
formatex(LangTextsizeof(LangText), "%L \d[ ]\w^n"GAME_LANG"WPN_MENU_MELEE")
    }
    
menu_additem(MenuLangText"wpn_melee")
   
    
formatex(LangTextsizeof(LangText), "\y%L"GAME_LANG"WPN_MENU_TAKEWPN")
    
menu_additem(MenuLangText"get_wpn")
   
    
menu_setprop(MenuMPROP_EXITMEXIT_ALL)
    
menu_display(idMenu0)

PHP Code:
public Reset_PlayerWeapon(idNewPlayer)
{
    if(
NewPlayer)
    {
        
g_PreWeapon[id][WPN_PRIMARY] = g_FirstWeapon[WPN_PRIMARY]
        
g_PreWeapon[id][WPN_SECONDARY] = g_FirstWeapon[WPN_SECONDARY]
        
g_PreWeapon[id][WPN_MELEE] = g_FirstWeapon[WPN_MELEE]
        
        for(new 
0MAX_WEAPONi++)
            
g_UnlockedWeapon[id][i] = 0
    
}
    
    
UnSet_BitVar(g_GotWeaponid)


Weapon Code admin access:

PHP Code:
public zg_weapon_bought(idItemID)
{
    if(
ItemID == g_Base)

    {
    
    if(
get_user_flags(id) & ADMIN_FLAG)
        {
            
Get_Base(id)
        }
        
// If not admin
        
else
        {
            
zg_menu(id);
            
client_print(idprint_chat"[ZPNM] This item is only for admin!");
            
                
            }
            
            }
            
            } 

Last edited by elmedin; 05-06-2020 at 13:39.
elmedin is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 05-06-2020 , 09:50   Re: [Help] ZP Admin Access Weapon
Reply With Quote #2

Share the code of the function MenuHandle_MainEquip
__________________








CrazY. is offline
elmedin
Senior Member
Join Date: Nov 2013
Location: Bruh
Old 05-06-2020 , 13:39   Re: [Help] ZP Admin Access Weapon
Reply With Quote #3

Quote:
Originally Posted by CrazY. View Post
Share the code of the function MenuHandle_MainEquip
Its ok, i fixed it after some days
elmedin 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 16:51.


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