Raised This Month: $32 Target: $400
 8% 

How to perform an action after waiting for another players menu response


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
htcarnage
Senior Member
Join Date: Oct 2009
Old 07-31-2013 , 23:56   How to perform an action after waiting for another players menu response
Reply With Quote #1

Ok, the title may be confusing, but here is what I mean:

I want Player1 to be able to use a command to teleport themselves to Player2, but before the teleport is performed, Player2 has to accept the teleport request. So I wrote some code that will present a menu to Player2, but I don't know how to check his response and teleport Player1 if it was a positive response.

My code so far:
PHP Code:
public Action:Command_GoTo(clientargs)
{
    new 
String:target[50];
    
GetCmdArg(1targetsizeof(target));
    
    new 
Player FindTarget(clienttarget);
    if(
Player != -1)
    {
        new 
Handle:Menu CreateMenu(AcceptMenu_Handler);
        
SetMenuTitle(Menu"Allow %N to teleport to you?"client);
        
AddMenuItem(Menu"Accept""Yes");
        
AddMenuItem(Menu"Deny""No");
        
DisplayMenu(MenuPlayer10);
    }
}

public 
AcceptMenu_Handler(Handle:acceptmenuMenuAction:actionparam1param2)
{
    switch(
action)
    {
        case 
MenuAction_Select:
        {
            new 
String:response[64];
            
GetMenuItem(acceptmenuparam2itemsizeof(item))
            
            if(
StrEqual(response"Accept"))
            {
             
//What to do here?
            
}
            
            if(
StrEqual(response"Deny"))
            {
             
//What to do here??
            
}
        }
        case 
MenuAction_Cancel:
        {
            
CloseHandle(acceptmenu)
        }
    }

Basically I dont know how to pass Player1 information to the menu handler so that Player1 can be teleported if Player2 Accepted the request.

Thanks for any help. I can explain further if needed.
__________________

Last edited by htcarnage; 08-01-2013 at 02:10.
htcarnage is offline
ojmdk476oj
AlliedModders Donor
Join Date: Dec 2009
Old 08-01-2013 , 06:01   Re: How to perform an action after waiting for another players menu response
Reply With Quote #2

Check out this.
ojmdk476oj is offline
htcarnage
Senior Member
Join Date: Oct 2009
Old 08-01-2013 , 16:54   Re: How to perform an action after waiting for another players menu response
Reply With Quote #3

Thank you, have it working.
__________________
htcarnage is offline
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 08:10.


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