Run time error 5: memory access
I dont mean to double post, but I also have another problem - I get this error in my amxx error log : "Run time error 5: memory access "
The line it refers to in the error log is just a Code:
return PLUGIN_CONTINUE |
Re: Run time error 5: memory access
Show the full code, please...
|
Re: Run time error 5: memory access
spacing got a little wierd in the paste, so forgive that.
PHP Code:
|
Re: Run time error 5: memory access
Anyone have any ideas?
|
Re: Run time error 5: memory access
First of all you might wanna clean up your code.
!is_user_connected( enemyz ) is a redundant check as get_user_aiming() returns data only from alive players. Code:
get_user_aiming ( id,enemyz, body ); Also redundant Code:
if ( !p_resists[enemyz][RESISTIDX_MAGIC]) Code:
iparm[0] = enemyz; Code:
if ( 0<enemyz<=32 && !stunned[enemyz] && get_user_team ( id )!=get_user_team ( enemyz ) && playeritem[enemyz]!=IMMUNITY && !hasblink[enemyz] && is_user_alive ( id ) && is_user_alive ( enemyz ) && !temp_immunity[enemyz] )Code:
set_task ( CVAR_ENTANGLE_COOLDOWN, "cooldown", 50 + id, cooldownparm, 1 );Code:
while ( counter >= 0 ) Code:
set_task ( 0.1, "Task_Search_Event_Entangle", TASK_ULTIMATE_ENTANGLE_SEARCH + id, parm, 2 );Code:
public Task_Search_Event_Entangle ( parm[2] )Please review your code as you have lots of redundant tests. While this shouldn't be a problem, in your case it's just a code overhead, not to mention that your task is recursive with a 0.1 seconds delay. |
Re: Run time error 5: memory access
Would it be better to remove the first call as a function and make that as a set_task instead?
change to PHP Code:
|
Re: Run time error 5: memory access
ok so I have tried some of what was above and the error still persists. Even though some of the code is redundant and not "optimized" I would like to get it working before I worry about the optimization portion.
I have also set the function as a task instead of a direct call, and removed the delcared parm[2] from the function params. Here is what I got now - I know there are still some redundancies, but thats ok for now. I would like to focus on what is completely wrong. I'm trying to port in some existing code from the original uwc3 mod plugin and this is the only part that is giving me trouble. PHP Code:
PHP Code:
PHP Code:
|
Re: Run time error 5: memory access
PHP Code:
|
Re: Run time error 5: memory access
Are you saying that how I call the task is what is causing the memory problems??
Sorry, Im a little slow this morning, bare with me... |
Re: Run time error 5: memory access
Ok, I got this to work, and actually I needed a few redundant checks as some times I would get array indexing errors every so often, but with redundant checks I have not gotten any and now the function is working as expected.
Thanks to all who helped. |
| All times are GMT -4. The time now is 11:11. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.