Raised This Month: $ Target: $400
 0% 

admin menu


Post New Thread Reply   
 
Thread Tools Display Modes
yagami
Senior Member
Join Date: Jan 2021
Old 07-16-2023 , 20:21   Re: admin menu
Reply With Quote #11

Quote:
Originally Posted by fysiks View Post
I have no idea what you're saying. Checking is_user_admin(id) doesn't make any sense because this entire menu is only accessible by admins (according to you) so that will always be true.

If you're not going to try my suggestions, I'm going to have to stop trying to help.
I've tried it, but I haven't gotten around to it yet
as I said
what I want and the dispenser of other admins does not appear in the list, not even the dispenser of the admin himself who used command
yagami is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 07-17-2023 , 16:08   Re: admin menu
Reply With Quote #12

if you dont want to see your own dispenser and any other ones owned by admins, the statement should be like this
Code:
if (iOwner != id && !is_user_admin(iOwner))
__________________
bigdaddy424 is offline
yagami
Senior Member
Join Date: Jan 2021
Old 07-19-2023 , 21:37   Re: admin menu
Reply With Quote #13

Quote:
Originally Posted by bigdaddy424 View Post
if you dont want to see your own dispenser and any other ones owned by admins, the statement should be like this
Code:
if (iOwner != id && !is_user_admin(iOwner))
Can you help me please, this and normal player menu I did it beseado in yours that you sent me more has an error, he is accessing all the dispenser
another menu that I sent and for admin only accessed by command
This one is for players, admins and should only appear their dispenser, but everything is appearing.




PHP Code:
public xMenuDispenser(id)
{
    new 
pMenu menu_create("Menu Dispenser""xMenuDispenserHandler")

    new 
iEnt = -1;
    new 
iLeveliHealthsEntId[6];

    while((
iEnt find_ent_by_class(iEntdispenser_classname)))
    {
        if(
pev_valid(iEnt) && is_user_connected(id))
        {   
            
iLevel  pev(iEntDISPENSER_LEVEL);
            
iHealth pev(iEntpev_health);


            
num_to_str(iEntsEntIdcharsmax(sEntId));
            
menu_additem(pMenufmt("\rLevel:\w[%d] \y|| \rVida:\w[%d]"iLeveliHealth), sEntId)
        }

    } 
    
menu_display(idpMenu0);
}

public 
xMenuDispenserHandler(idmenuitem)

    if(
item == MENU_EXIT)
        
menu_destroy(menu);

    new 
szData[6], szName[64], accesscallback;
    
menu_item_getinfo(menuitemaccessszDatacharsmax(szData), szNamecharsmax(szName), callback);

    new 
ent str_to_num(szData)  

    if(
pev_valid(ent))
    {
        
client_print_color(0print_team_default"%s %L"PREFIX_CHATid"DESTRUIR5")
        
g_DispPlayerCount[id]--;
        
xLimitGlobal[cs_get_user_team(id)]--
        
isEnt[ent] = false    
        xRemoveEntFix
(ent);
        
xGiveMoneyDisp(id);
    }

yagami is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 07-19-2023 , 22:20   Re: admin menu
Reply With Quote #14

if youre still having issues drop the whole source file
PHP Code:
public xMenuDispenser(id)
{
    new 
pMenu menu_create("Menu Dispenser""xMenuDispenserHandler")

    new 
iEnt = -1;
    new 
iLeveliHealthiOwnersEntId[6]; 

    while((
iEnt find_ent_by_class(iEntdispenser_classname)))
    {
        if(
pev_valid(iEnt))
        {   
            
iLevel  pev(iEntDISPENSER_LEVEL);
            
iHealth pev(iEntpev_health);
            
iOwner  pev(iEntDISPENSER_OWNER);

            if (
is_user_connected(iOwner)){
                if (
iOwner != id && !is_user_admin(id)){
                    
num_to_str(iEntsEntIdcharsmax(sEntId));
                    
menu_additem(pMenufmt("\rLevel:\w[%d] \y|| \rVida:\w[%d] || \rOwner:\w[%n]"iLeveliHealthiOwner), sEntId)
                }
            }
        }

    } 
    
menu_display(idpMenu0);
}

public 
xMenuDispenserHandler(idmenuitem)

    if(
item == MENU_EXIT)
        
menu_destroy(menu);

    new 
szData[6], szName[64], accesscallback;
    
menu_item_getinfo(menuitemaccessszDatacharsmax(szData), szNamecharsmax(szName), callback);

    new 
ent str_to_num(szData)  

    if(
pev_valid(ent))
    {
        
client_print_color(0print_team_default"%s %L"PREFIX_CHATid"DESTRUIR5")
        
g_DispPlayerCount[id]--;
        
xLimitGlobal[cs_get_user_team(id)]--
        
isEnt[ent] = false    
        xRemoveEntFix
(ent);
        
xGiveMoneyDisp(id);
    }

__________________
bigdaddy424 is offline
yagami
Senior Member
Join Date: Jan 2021
Old 07-19-2023 , 23:14   Re: admin menu
Reply With Quote #15

Quote:
Originally Posted by bigdaddy424 View Post
if youre still having issues drop the whole source file
PHP Code:
public xMenuDispenser(id)
{
    new 
pMenu menu_create("Menu Dispenser""xMenuDispenserHandler")

    new 
iEnt = -1;
    new 
iLeveliHealthiOwnersEntId[6]; 

    while((
iEnt find_ent_by_class(iEntdispenser_classname)))
    {
        if(
pev_valid(iEnt))
        {   
            
iLevel  pev(iEntDISPENSER_LEVEL);
            
iHealth pev(iEntpev_health);
            
iOwner  pev(iEntDISPENSER_OWNER);

            if (
is_user_connected(iOwner)){
                if (
iOwner != id && !is_user_admin(id)){
                    
num_to_str(iEntsEntIdcharsmax(sEntId));
                    
menu_additem(pMenufmt("\rLevel:\w[%d] \y|| \rVida:\w[%d] || \rOwner:\w[%n]"iLeveliHealthiOwner), sEntId)
                }
            }
        }

    } 
    
menu_display(idpMenu0);
}

public 
xMenuDispenserHandler(idmenuitem)

    if(
item == MENU_EXIT)
        
menu_destroy(menu);

    new 
szData[6], szName[64], accesscallback;
    
menu_item_getinfo(menuitemaccessszDatacharsmax(szData), szNamecharsmax(szName), callback);

    new 
ent str_to_num(szData)  

    if(
pev_valid(ent))
    {
        
client_print_color(0print_team_default"%s %L"PREFIX_CHATid"DESTRUIR5")
        
g_DispPlayerCount[id]--;
        
xLimitGlobal[cs_get_user_team(id)]--
        
isEnt[ent] = false    
        xRemoveEntFix
(ent);
        
xGiveMoneyDisp(id);
    }

It did not work, I also do not understand why this way, if before it worked
Oops I just saw here you put iOwner
This menu it will be used by all players, vips, admins so it should appear your own dispenser so I took iOwner from the menuadd because if the dispenser is yours you do not need to know if who it is

Last edited by yagami; 07-19-2023 at 23:16.
yagami is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-20-2023 , 00:06   Re: admin menu
Reply With Quote #16

Your explanations of what you want don't make much sense. Maybe using a translator would help.

Do you simply want one menu that shows only their own items and another menu that shows all non-admin items? If true, you simply need to check "iOwner == id" or "!is_user_admin(iOwner)".
__________________

Last edited by fysiks; 07-20-2023 at 00:39.
fysiks is offline
yagami
Senior Member
Join Date: Jan 2021
Old 07-20-2023 , 01:00   Re: admin menu
Reply With Quote #17

Quote:
Originally Posted by fysiks View Post
Your explanations of what you want don't make much sense. Maybe using a translator would help.

Do you simply want one menu that shows only their own items and another menu that shows all non-admin items? If true, you simply need to check "iOwner == id" or "!is_user_admin(iOwner)".
Ook, there are two menu, xMenuDispenser and xMenuDispenserAdmin where admin can only access via command.

xMenuDispenser it is global and for everyone that includes Admin/Player/VIP his function is as follows when the player had more than two dispenser he lets the player choose which dispenser he wants to destroy

So it should only appear the dispenser that I have, but it is appearing from all players
yagami is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-20-2023 , 01:16   Re: admin menu
Reply With Quote #18

If you want to show only the items that are owned by the player viewing the menu then you would do this:

PHP Code:
public xMenuDispenser(id)
{
    new 
pMenu menu_create("Menu Dispenser""xMenuDispenserHandler")

    new 
iEnt = -1;
    new 
iLeveliHealthsEntId[6];

    while((
iEnt find_ent_by_class(iEntdispenser_classname)))
    {
        if( 
pev_valid(iEnt) )
        {
            
iLevel  pev(iEntDISPENSER_LEVEL);
            
iHealth pev(iEntpev_health);
            
iOwner  pev(iEntDISPENSER_OWNER);

            if( 
id == iOwner )
            {
                
num_to_str(iEntsEntIdcharsmax(sEntId));
                
menu_additem(pMenufmt("\rLevel:\w[%d] \y|| \rLife:\w[%d] || \rOwner:\w[%d]"iLeveliHealthiOwner), sEntId)
            }
        }
    }
    
menu_display(idpMenu0);

If this doesn't work then I'm confident that your concept of "owner" isn't working and needs fixed. So, does this function show you only your own items?
__________________
fysiks 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 07:56.


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