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

Solved Forwards, Call_Push*, Handles - How To ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 05-10-2020 , 06:34   Forwards, Call_Push*, Handles - How To ?
Reply With Quote #1

I am using gameME 5.0.0 and it registers forwards.
A parameter is Handle.

https://github.com/gamemedev/plugin-...ameme.sp#L3894

https://github.com/gamemedev/plugin-...essages.sp#L71

It says datapack is an invalid handle even if it is not equal to INVALID_HANDLE and as is above it returned a number like ac7e. I tried changing to Call_PushCell (without Ref) and then it showed a number like 23fa14cc, still invalid handle but not equal to INVALID_HANDLE. I have tried adding _: into the front of pack but didn't help either.

How can I safely pass a DataPack (Handle) through a registered forward?
__________________

Last edited by claudiuhks; 05-10-2020 at 08:31.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-10-2020 , 07:08   Re: Forwards, Call_Push*, Handles - How To ?
Reply With Quote #2

It would help if you posted the actual error message, which includes an error code detailing why the handle is considered invalid.

You have to be the owner of the Datapack handle to read or write from it.

Handles should generally not be passed by-ref, as they are references internally.
__________________
asherkin is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 05-10-2020 , 08:05   Re: Forwards, Call_Push*, Handles - How To ?
Reply With Quote #3

Error code 4 (as is) and 5 (with Call_PushCell).

Code:
[SM] Exception reported: Handle 75b8 cannot be cloned because it is invalid (error 4)
Quote:
Originally Posted by asherkin View Post
You have to be the owner of the Datapack handle to read or write from it.

Handles should generally not be passed by-ref, as they are references internally.
I see now, thanks. Anyways, this is not some kind of good bie, if you still have stuff to add, please do so.
__________________

Last edited by claudiuhks; 05-10-2020 at 08:12.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-10-2020 , 08:18   Re: Forwards, Call_Push*, Handles - How To ?
Reply With Quote #4

Error 4 means the handle is actually invalid - rather than being free'd already - and due to the value it looks like it's probably a mix up between references (make sure the call mode matches the prototype in the function). Error 5 is access restrictions and probably due to the lack of a clone.
__________________
asherkin is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 05-10-2020 , 08:30   Re: Forwards, Call_Push*, Handles - How To ?
Reply With Quote #5

Well as is, gameME 5.0.0 uses Call_PushCellRef(Handle hPack) and its INC clearly specifies Handle hPack rather than Handle & hPack.

So when I changed Call_PushCellRef to Call_PushCell I have somehow partially fixed it and the error code changed from 4 to 5 (which is OK from what you stated above, access restrictions).

Don't worry, I will mark this thread as solved and again, thanks, I know what I have to do now to get my stuff working (I will add new forward parameters of type int, float and const char[]), I just didn't understand what was going on. Also thought it might be easily fixed, globally (inside gameME 5.0.0).
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
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 07:30.


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