IS4Code / PawnPlus

A SA-MP plugin enhancing the capabilities of the Pawn programming language
MIT License
102 stars 17 forks source link

[PawnPlus] task_wait: task reference is invalid (value 0x0) #31

Closed duydang2311 closed 4 years ago

duydang2311 commented 4 years ago

Hi there. I have these two tasks executing when the player login with correct password. It works fine but after having logged in, I disconnect, re-connect and login again (repeat until the 5th time), the tasks have issues. Re-initiating the server makes it work again but the tasks still have issues after a few time re-logging in. Here is my code and errors: https://pastebin.com/xMm6hF6z I don't know if my tasks are written in a wrong way but please help. Thank you for your time!

IS4Code commented 4 years ago

Hi, you should replace the MySQL call with task_ms to rule out a potential issue there, then try task_set_yielded instead of task_yield, and then if it doesn't work replace return Task:0; with return Task:1; to see if that is the value that is erroneously awaited.

duydang2311 commented 4 years ago

I followed your instruction (but task_set_yielded is undefined so i just use task_yield) and it returns the errors right after I login. Here is my code: https://pastebin.com/XMfxUCR0 By the way, I'm using PawnPlus v1.0.0-pre4

IS4Code commented 4 years ago

Then please update to the newest version first and check if the issue is still present there.

duydang2311 commented 4 years ago

I tried. When I run 'sampctl p install IllidanS4/PawnPlus:v1.2.1' then compile and run the server, it always says "PawnPlus v1.0.0-pre4 loaded". I don't know if the pawnplus mysql is the reason?

IS4Code commented 4 years ago

Then it is an issue with sampctl, I don't know how to resolve that. Also you were supposed to try await task_ms(1000);, not just task_ms(1000);.

duydang2311 commented 4 years ago

I replaced mysql_aquery_s with await task_ms and found some stack/heap collision issues on my console. So, I'm trying to fix my bad code. Thanks for help!