Raised This Month: $ Target: $400
 0% 

Menu - Menu Callback [Advanced]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 04-13-2011 , 11:01   Menu - Menu Callback [Advanced]
Reply With Quote #1

i have problem with menu..
i folowed this "tutorial"
but i can't make it work

https://forums.alliedmods.net/archiv...p/t-98762.html

PHP Code:
public UseStrike(id)
{
    
menu_create("KS""test_show"
     
    
menu_additem(g_hMenu"UAV""1"
    
menu_additem(g_hMenu"Counter-UAV""2"
    
menu_additem(g_hMenu"AirStrike""3"_menu_makecallback("CallbackTest")) 
     
    
menu_setprop(g_hMenu,MPROP_EXITNAME,"Exit"
    
menu_display(idg_hMenu0
     
    return 
PLUGIN_HANDLED 


public 
CallbackTest(idMenuitem

    
//PROBLEM
    
if(item == 1)
    {
        if(
kill_counter[id]<3
            
return ITEM_DISABLED;
    }
    if(
item == 2)
    {
        if(
kill_counter[id]<4
            
return ITEM_DISABLED;
    }
    
///etc...


public 
test_show(idMenuitem

    if(
item == MENU_EXIT
    { 
        return 
PLUGIN_HANDLED 
    

     
    new 
iData[6
    new 
iAccess 
    
new iCallback 
    
new iName[64
     
    
menu_item_getinfo(MenuitemiAccessiData5iName63iCallback
     
    switch(
str_to_num(iData)) 
    { 
        case 
1
        { 
            
//code 1
        

        case 
2
        { 
            /
code 2 
        

        case 
3
        { 
            
//code 3
        

    } 
    return 
PLUGIN_HANDLED 

any one can fix it, menu doesn't work at all :S

first problem, my cvars ain't 0 or 1 like in tutorial, so i tried this way
but it doesn't work

edit: one more question
how to block radar for 15 second?

Last edited by OvidiuS; 04-13-2011 at 11:42.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-13-2011 , 15:10   Re: Menu - Menu Callback [Advanced]
Reply With Quote #2

You only add the callback for the 3rd item, so only the 3rd item is going to be checked in the callback.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-13-2011 , 23:54   Re: Menu - Menu Callback [Advanced]
Reply With Quote #3

And, it won't compile. Check your if statments again.
__________________
fysiks is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 04-14-2011 , 09:32   Re: Menu - Menu Callback [Advanced]
Reply With Quote #4

thanks for helping fysiks and Exolent
I didn't understand you fysiks, my if statement are kill_counter[id]<3 etc...
as i said probem is that my statements aint 1 or 0 like in tutorial
i solved the problem with menu, it's working, but on other way
still want to know how to do it like this...

two more question

1. is there any better way to set task on enemy players
PHP Code:
    for (new i=1i<=g_maxplayers;i++)
    {
        if(
cs_get_user_team(i) != cs_get_user_team(id))
        {
            
set_task(....... 
in this case task will be set to every player individualy..
any one know the better way of setting task on enemy team

2. how to disable radar for 15 sec
i have one idea, but i dont know how good is it..
PHP Code:
if(something[id)
{
    
message_begin(MSG_ALL,gmsgHideWeapon,{0,0,0},0
    
write_byte(8
    
message_end()  
    
set_task(15.0....

and in new task to set that "something[id] = false....
but will it work?

Last edited by OvidiuS; 04-14-2011 at 09:54.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-14-2011 , 19:18   Re: Menu - Menu Callback [Advanced]
Reply With Quote #5

1. I would not recommend setting a task for everyone on the other team if it can be avoided. What are you trying to do?

2.
Quote:
Originally Posted by Bugsy View Post
There is no way to hide just the radar.
Quote:
Originally Posted by Bugsy View Post
The below seems to work to block players on the radar and will still allow the bomb to be shown (when dropped or player killed that is\was holding it).

PHP Code:
//place in plugin_init()
set_msg_blockget_user_msgid"Radar" ) , BLOCK_SET ); 
__________________
fysiks is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 04-15-2011 , 09:49   Re: Menu - Menu Callback [Advanced]
Reply With Quote #6

1. Setting task on everyone isn't the best way, but my scripting skill isn't good, so i don't know how to avoid that

i'm trying to hide/block radar for 15 seconds on oposite team players

2. I know that, but i told radar, because EMP effect should hide whole hud....and changing from (1<<3) to (1<<2) isn't hard

i tested plugin, it has UAV, EMP, AirStrike with jet, but code is redundant ..
i still want to keep plugin private, so i didn't posted the code

UAV works great, EMP is slowhacking (hud_draw), airstrike is perfect xD

if i find a way how to hide hud item, and than make it appear 15 seconds later, that will be great xD

Last edited by OvidiuS; 04-15-2011 at 10:17.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 04-15-2011 , 16:51   Re: Menu - Menu Callback [Advanced]
Reply With Quote #7

hm i made some code for radar blocking
here it is
PHP Code:
#include <amxmodx> 

new Float:gBlock[33], cvarBlock

public 
plugin_init() 

    
register_plugin("KS","1.0","OvidiuS"
    
cvarBlock register_cvar("radar_block""15.0"FCVAR_SPONLY
    
register_clcmd"say /radar""radar_block" 


public 
radar_block(id)  

    new 
Float:BlockTime get_pcvar_float(cvarBlock
    new 
Float:currentTime get_gametime() 
    new 
Players[32
    new 
playerCountiplayer 
     
    get_players
(PlayersplayerCount"c"
    for (
i=0i<playerCounti++) 
    { 
        
player Players[i]  
        if(
get_user_team(player) != get_user_team(id)) 
        { 
            if (
gBlock[player] > currentTime
            { 
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("Radar"), _player
                
write_byte(player
                
write_coord(0
                
write_coord(0
                
write_coord(0
                
message_end() 
            } 
            
gBlock[player] = currentTime BlockTime 
        

    } 

anyone have idea how to do same for hud?
client_PreThink or EventResetHUD?
OvidiuS is offline
Send a message via Skype™ to OvidiuS
Nyuszy
Senior Member
Join Date: Apr 2009
Old 04-16-2011 , 19:17   Re: Menu - Menu Callback [Advanced]
Reply With Quote #8

try to register the Radar event, and if the player's radar is blocked (by cvar), send him the fake 0,0,0 coords...
Nyuszy is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 04-16-2011 , 19:20   Re: Menu - Menu Callback [Advanced]
Reply With Quote #9

already done that
PHP Code:
public prethink(id)
{    
    if(
cblocked[id])
    {
        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("Radar"), _id)
        
write_byte(id)
        
write_coord(0)
        
write_coord(0)
        
write_coord(0)
        
message_end()
    }

thanks for helping
OvidiuS is offline
Send a message via Skype™ to OvidiuS
Reply


Thread Tools
Display Modes

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 19:49.


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