AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   crash after callfunc_end (https://forums.alliedmods.net/showthread.php?t=343222)

Celena Luna 06-29-2023 04:56

crash after callfunc_end
 
I am trying call the register_item function from Plugin A in Plugin B
  • The server just crash without any log or error dialog after callfunc_end(),
  • It did print out "Test" on server console before crashing => So it did reach the function but crash upon calling callfunc_end()
  • It need it to be in plugin_natives because I want to register it before plugin_precache, preventing the plugin from precaching resources of that plugin

PHP Code:

public register_item(const Name[])
{
    
server_print(Name);


PHP Code:

public plugin_natives()
{
    
callfunc_begin("register_item""PluginB.amxx")
    
callfunc_push_str("Test")
    
callfunc_end()


edit: This is the exception shown in mini-dump after the server crash
https://i.imgur.com/DT5oUmb.png

MrPickles 06-30-2023 00:54

Re: crash after callfunc_end
 
* I guess the error is because plugin B is loaded after plugin A

* you can just remove the precache plugin you want to disable

* It may also be that you are doing it in plugin_natives, I think it only works once inside the server, plugin_init, natives and precache are started before.

callfunc_begin**

"This only sets up the function call and covers the pre-requisites.
Push parameters using the callfunc_push_* set of functions. The call
will be executed only upon using callfunc_end()"

callfunc_push_str**

"This will defy the "const" specifier if copyback is true, which is
only kept for special backwards compatibility."

Celena Luna 06-30-2023 04:52

Re: crash after callfunc_end
 
Quote:

Originally Posted by MrPickles (Post 2806607)
* I guess the error is because plugin B is loaded after plugin A

I make sure for it to load in specific order
PluginMain.amxx => PluginRegistered.amxx => PluginEnd.amxx

Quote:

Originally Posted by MrPickles (Post 2806607)
* you can just remove the precache plugin you want to disable

The whole point is to pause it before the resource is precache when condition are met

Quote:

Originally Posted by MrPickles (Post 2806607)
* It may also be that you are doing it in plugin_natives, I think it only works once inside the server, plugin_init, natives and precache are started before.

I need to register all the basic infomation like name and cost, then save them in an dynamic array and do the selection function to select which item will stay and which will be disabled.
So it need to be done before plugins_precache and only plugin_native is the only one before it.

MrPickles 07-01-2023 20:12

Re: crash after callfunc_end
 
Quote:

Originally Posted by Celena Luna (Post 2806616)
The whole point is to pause it before the resource is precache when condition are met

I don't understand, don't you have the source code to be able to remove the plugin_precache?

DJEarthQuake 07-05-2023 14:19

Re: crash after callfunc_end
 
I would have used pfn_keyvalue instead of native. It has it's own nuances but it comes before precache.

Celena Luna 07-05-2023 21:37

Re: crash after callfunc_end
 
Quote:

Originally Posted by MrPickles (Post 2806680)
I don't understand, don't you have the source code to be able to remove the plugin_precache?

No, I want it to dynamicly replace item each map even if I added 100 of them. It is kind of greedy but it is possible

Quote:

Originally Posted by DJEarthQuake (Post 2806834)
I would have used pfn_keyvalue instead of native. It has it's own nuances but it comes before precache.

I wil try with it. Thank you

Natsheh 07-06-2023 06:54

Re: crash after callfunc_end
 
It seems you're trying to access a memory address not located in the game memory allocations.

TIP: check for index out of bounds errors.


All times are GMT -4. The time now is 07:45.

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