FindNative crashes server
#1

I am trying to call sa-mp function with my plugin,but it crashes server.

I made global 'AMX * amx;', Then in function:

pawn Код:
amx_FindNative ( amx, "GetPlayerPos", &idx );
I tried it with local 'AMX amx', and

pawn Код:
amx_FindNative ( &amx, "GetPlayerPos", &idx );
But nothing changes. Any ideas?
Reply
#2

It crashes immediately or when you're trying to use the idx variable?
Have you checked whether *amx is null? Do you set it properly in AmxLoad?

How do you debug it anyway?
Reply
#3

I have debugged it with logprintf function, and when I use amx_FindNative, server crashes ( i see, that print stops before this function in my serverlog ). Well, I'm not cheking whether amx is null, and I haven't set it in AmxLoad. I've just recently started work with plugins.
Reply
#4

Quote:
Originally Posted by Scottas
Посмотреть сообщение
I have debugged it with logprintf function, and when I use amx_FindNative, server crashes ( i see, that print stops before this function in my serverlog ). Well, I'm not cheking whether amx is null, and I haven't set it in AmxLoad. I've just recently started work with plugins.
Okay then. Do what James advised you to and next time use Visual Studio to debug your plugins. It'll make your life so much easier!

Also, bare in mind that your server might load several different AMX machines - including both your gamemode and filterscripts. You can either change the *amx pointer to the last virtual machine loaded by simply overwriting it in every AmxLoad, or use a more sophisticated way like Incognito's CInvoke. Take look at it and have fun developing plugins!
Reply
#5

Thank you for info. I found how to set player values in plugin ( pos, money, angle ), but I can't find how to get these values in plugin. For example, how to use GetPlayerPos in plugin?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)