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

show menu every 3 rounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KiloV92
New Member
Join Date: Jan 2024
Old 01-13-2024 , 03:23   show menu every 3 rounds
Reply With Quote #1

i know we cant pass id to global event . but how can i do this ?

new g_iAdMenuUsage[33] = 0

public plugin_init()
{
register_logevent( "Logevent_RoundStart", 2, "1=Round_Start" );
register_clcmd("say /adminmenu", "clcmd_adminmenu")
}
public Logevent_RoundStart(id)
{
g_iAdMenuUsage[id] ++

}
public clcmd_adminmenu(id)
{
if(g_iAdMenuUsage[id] > 3)
{

show_menu(id)
}
}
KiloV92 is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 01-13-2024 , 07:07   Re: show menu every 3 rounds
Reply With Quote #2

get_players()
__________________
bigdaddy424 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-13-2024 , 10:41   Re: show menu every 3 rounds
Reply With Quote #3

PHP Code:
#include <amxmodx>

public plugin_init()
{
   
register_event("HLTV""HLTV_Event""a""1=0""2=0");
}

public 
HLTV_Event()
{
   
set_task(2.0"MenuUsageIncrement4EveryPlayer");
}

public 
MenuUsageIncrement4EveryPlayer()
{
   for(new 
1<= 32i++)
   {
       if(!
is_user_alive(i)) continue;
       
g_iAdMenuUsage[i] ++;
   }

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 01-13-2024 at 18:22.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-13-2024 , 17:11   Re: show menu every 3 rounds
Reply With Quote #4

Don't loop through all player entities, use get_players() as bigdaddy424 suggested.
__________________
fysiks is offline
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 01-13-2024 , 19:00   Re: show menu every 3 rounds
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
Don't loop through all player entities, use get_players() as bigdaddy424 suggested.
Yea
Uzviseni Bog is offline
KiloV92
New Member
Join Date: Jan 2024
Old 01-14-2024 , 01:57   Re: show menu every 3 rounds
Reply With Quote #6

Thanks . And how can i stop giving g_iAdMenuUsage[id] to players at 3 ? I mean how can i detect if a player has 3 g_iAdMenuUsage and stop giving them until they use the menu ?
KiloV92 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-14-2024 , 10:50   Re: show menu every 3 rounds
Reply With Quote #7

Quote:
Originally Posted by KiloV92 View Post
Thanks . And how can i stop giving g_iAdMenuUsage[id] to players at 3 ? I mean how can i detect if a player has 3 g_iAdMenuUsage and stop giving them until they use the menu ?
g_iAdMenuUsage[i] = min(++g_iAdMenuUsage[i], 3);
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 01-14-2024 , 13:36   Re: show menu every 3 rounds
Reply With Quote #8

PHP Code:
public hook_event()
{
    
method_get_players()
    
    
//method_get_maxplayers()
}

stock method_get_players()
{
    new 
players[32], maxplayers
    
    get_players
(playersmaxplayers"ch"// skip bots & hltv
    
    
for(new iidmaxplayersi++)
    {
        
id players[i]
        
        
chk_menu(id)
    }
}

stock method_get_maxplayers()
{    
    static 
maxplayers
    
    
if( !maxplayers )
    {
        
maxplayers get_maxplayers()
    }
    
    for(new 
id 1id <= maxplayersid++)
    {
        if(
is_user_bot(id) || is_user_hltv(id))
        {
            continue
        }
        
        
chk_menu(id)
    }
}

stock chk_menu(id)
{
    
g_iAdMenuUsage[id]++
    
    if(
g_iAdMenuUsage[id] > 3)
    {
        
show_menux(id)
        
        
//g_iAdMenuUsage[id] = 0 //<-reset¿?
    
}
}

public 
show_menux(id)
{
    
//...

__________________
mlibre 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 13:01.


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