AmyrAhmady/samp-node

Server crash at native GetAnimationName

ghosty2004 opened this issue · 8 comments

The server crash when I use the native GetAnimationName

Can you give a simple example of how you are using it? @ghosty2004

const samp = require("samp-node-lib");
samp.OnPlayerUpdate((player) => {
    let AnimIndex = player.GetPlayerAnimationIndex();
    if(AnimIndex) {
        console.log(samp.GetAnimationName(AnimIndex, 32, 32));
    }
    return true;
});

Thanks, I know the problem now
I will fix it later when I get some free time today, cheers

@ghosty2004 I'm working on it along with an issue broking any native call that is supposed to return a string. I'm hoping I'll fix it in the near time

@ghosty2004 found a workaround for you for now. Every time you need to get a string in return for a samp native call you should specify the length of the returned string twice. For example, if you need to get an animation name, use this

samp.callNative('GetAnimationName', 'iSiiSii', AnimIndex, 32, 32, 32, 32)

instead of this

samp.callNative('GetAnimationName', 'iSiSi', AnimIndex, 32, 32)

Same for GetPlayerName, for example:

samp.callNative('GetPlayerName', 'iSii', 0, 24, 24)

The fix itself is ready so you can just wait for it

@ghosty2004 can you give it a try now

Yes, it works now.