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

Solved Menu invalid handle?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RumbleFrog
Great Tester of Whatever
Join Date: Dec 2016
Location: Fish Tank
Old 04-25-2017 , 18:19   Menu invalid handle?
Reply With Quote #1

So I'm getting this error

PHP Code:
L 04/25/2017 22:12:39: [SMException reportedMenu handle 20900434 is invalid (error 3)
L 04/25/2017 22:12:39: [SMBlamingTicketron.smx()
L 04/25/2017 22:12:39: [SMCall stack trace:
L 04/25/2017 22:12:39: [SM]   [0Menu.ItemCount.get
L 04
/25/2017 22:12:39: [SM]   [1Line 1203C:\Users\xxlos\Ticketron\Ticketron.sp::TagPlayerMenu() 
This is the line it's on:

PHP Code:
public int TagPlayerMenu(Menu menuMenuAction actionint param1int param2)
{    
    
int pDataPos = (menu.ItemCount 1); //This Line is 1203

I do have

PHP Code:
IntToString(view_as<int>(pData), Pack_Stringsizeof Pack_String);
menu.AddItem(Pack_String""ITEMDRAW_IGNORE); 
Could it be I'm trying to pass a disguised DataPack? https://forums.alliedmods.net/showpo...7&postcount=31

Last edited by RumbleFrog; 04-25-2017 at 21:32.
RumbleFrog is offline
RumbleFrog
Great Tester of Whatever
Join Date: Dec 2016
Location: Fish Tank
Old 04-25-2017 , 18:21   Re: Menu invalid handle?
Reply With Quote #2

Note, it still returns the ItemCount despite the warning it gives off
RumbleFrog is offline
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 04-25-2017 , 20:26   Re: Menu invalid handle?
Reply With Quote #3

Maybe check menu != null first?
__________________

Last edited by Chaosxk; 04-25-2017 at 20:26.
Chaosxk is offline
RumbleFrog
Great Tester of Whatever
Join Date: Dec 2016
Location: Fish Tank
Old 04-25-2017 , 20:37   Re: Menu invalid handle?
Reply With Quote #4

Quote:
Originally Posted by Chaosxk View Post
Maybe check menu != null first?
It's not null though, I already tried null check, and it can still get the count, only reason I can think of, is the data pack I'm converting to string
RumbleFrog is offline
RumbleFrog
Great Tester of Whatever
Join Date: Dec 2016
Location: Fish Tank
Old 04-25-2017 , 20:38   Re: Menu invalid handle?
Reply With Quote #5

Basically this is how I converted the pack to string

PHP Code:
IntToString(view_as<int>(pData), Pack_Stringsizeof Pack_String); 
Then on the other side:

PHP Code:
if (menu == null) return;
    
    
int pDataPos = (menu.ItemCount 1);
    
char pDataPosChar[16];
    
    
menu.GetItem(pDataPospDataPosCharsizeof pDataPosChar);
    
    
DataPack pData view_as<DataPack>(StringToInt(pDataPosChar)); 

Last edited by RumbleFrog; 04-25-2017 at 20:39.
RumbleFrog is offline
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 04-25-2017 , 20:55   Re: Menu invalid handle?
Reply With Quote #6

I don't think it's your DataPack, i need to see your whole menu callback.

Also your right, menu isn't null so checking it doesn't matter.
__________________

Last edited by Chaosxk; 04-25-2017 at 20:56.
Chaosxk is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 04-25-2017 , 21:01   Re: Menu invalid handle?
Reply With Quote #7

i think you probably closed the handle somewhere
8guawong is offline
RumbleFrog
Great Tester of Whatever
Join Date: Dec 2016
Location: Fish Tank
Old 04-25-2017 , 21:17   Re: Menu invalid handle?
Reply With Quote #8

Here's my entire callback

PHP Code:
public int TagPlayerMenu(Menu menuMenuAction actionint param1int param2)
{    
    
int pDataPos = (menu.ItemCount 1);
    
char pDataPosChar[16];
    
    
menu.GetItem(pDataPospDataPosCharsizeof pDataPosChar);
    
    
DataPack pData view_as<DataPack>(StringToInt(pDataPosChar));
    
    
ResetPack(pData);
    
    
ReplySource CmdOrigin ReadPackCell(pData);
    
int client ReadPackCell(pData);
    
int ticket ReadPackCell(pData);
    
    
SetCmdReplySource(CmdOrigin);
    
    switch(
action)
    {
        case 
MenuAction_Select:
        {
            if ((
menu.ItemCount 2) == param2)
            {
                
char Update_Query[512];
                
                
Format(Update_Querysizeof Update_Query"UPDATE `Ticketron_Tickets` SET `target_name` = null, `target_steamid` = null, `target_ip` = null WHERE `id` = '%i'"ticket);
            
                
hDB.Query(SQL_OnTagPlayerUpdateUpdate_QuerypData);
            } else
            {
                
int target_id;
                
char Update_Query[512], Client_Name[MAX_NAME_LENGTH], Client_SteamID64[32], Client_IP[45], Menu_Buffer[16], Escaped_Name[128];
            
                
menu.GetItem(param2Menu_Buffersizeof Menu_Buffer);
                
target_id StringToInt(Menu_Buffer);
            
                
GetClientName(target_idClient_Namesizeof Client_Name);
                
GetClientAuthId(target_idAuthId_SteamID64Client_SteamID64sizeof Client_SteamID64);
                
GetClientIP(target_idClient_IPsizeof Client_IP);
            
                
hDB.Escape(Client_NameEscaped_Namesizeof Escaped_Name);
            
                
Format(Update_Querysizeof Update_Query"UPDATE `Ticketron_Tickets` SET `target_name` = '%s', `target_steamid` = '%s', `target_ip` = '%s' WHERE `id` = '%i'"Escaped_NameClient_SteamID64Client_IPticket);
            
                
hDB.Query(SQL_OnTagPlayerUpdateUpdate_QuerypData);
            }
        }
        case 
MenuAction_Cancel:
        {
            
CReplyToCommand(client"%s"Divider_Failure);
            
CReplyToCommand(client"{grey}Tagging player was canceled.");
            
CReplyToCommand(client"%s"Divider_Failure);
        }
    }
    
    
delete menu;

RumbleFrog is offline
RumbleFrog
Great Tester of Whatever
Join Date: Dec 2016
Location: Fish Tank
Old 04-25-2017 , 21:18   Re: Menu invalid handle?
Reply With Quote #9

I deleted the menu towards the end, but that shouldn't affect it?
RumbleFrog is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 04-25-2017 , 21:24   Re: Menu invalid handle?
Reply With Quote #10

remove and see what happens
8guawong 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:59.


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