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(client, args)
{
new String:target[50];
GetCmdArg(1, target, sizeof(target));
new Player = FindTarget(client, target);
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(Menu, Player, 10);
}
}
public AcceptMenu_Handler(Handle:acceptmenu, MenuAction:action, param1, param2)
{
switch(action)
{
case MenuAction_Select:
{
new String:response[64];
GetMenuItem(acceptmenu, param2, item, sizeof(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.
__________________