More like programming help - Problem with GetPlayerPos - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: More like programming help - Problem with GetPlayerPos (
/showthread.php?tid=429688)
More like programming help - Problem with GetPlayerPos -
BigETI - 10.04.2013
I know it doesn't belong to scripting, but I want to get values from an invoked native from AMX by using a plugin, without using any premade GDKs for example "Invoke" or "sampgdk". I can already invoke natives, set their arguments properly and get its return value, because I already get their pointers during AMXLoad. But if I try to get values from example GetPlayerPos, it will return NULL from its three arguments (x, y, and z). Do you have any clue, how to get its arguments properly?
I would really appreciate some help from you.
Code snippets:
http://pastebin.com/sp9Ycp8D
Best regards
~ BigETI
P.S.: Do not suggest me to use premade GDKs, because I know what I am doing...
Re: More like programming help - Problem with GetPlayerPos -
xeeZ - 12.04.2013
What's the point of reading GetPlayerPos() parameters if you they are supposed to be set by you (or the server)? Anyway, the x, y and z parameters are passed by reference, so you have to obtain their address first (with amx_GetAddr), and then dereference it to get/set the actual value.
Quote:
Originally Posted by BigETI
without using any premade GDKs
|
Quote:
Originally Posted by BigETI
Do not suggest me to use premade GDKs
|
Are there multiple ones?
AW: Re: More like programming help - Problem with GetPlayerPos -
BigETI - 12.04.2013
Does it matter, if I try to use amx_GetAddr at its initialization or inside the selfmade GetPlayerPos function?
And can you show me a small example, please?
Quote:
Originally Posted by xeeZ
Are there multiple ones?
|
I just wanted to say that in a general way...
Re: More like programming help - Problem with GetPlayerPos -
xeeZ - 12.04.2013
It's to be done inside GetPlayerPos, see the "Passing parameters by reference" section of the Plugin development guide:
https://sampforum.blast.hk/showthread.php?pid=1507428#pid1507428
AW: More like programming help - Problem with GetPlayerPos -
BigETI - 12.04.2013
I thought you can only use amx_GetAddr inside a selfmade native function thing, since the "cell *params" argument can be picked and used to return the physical address.
Like:
http://pastebin.com/nXvq7Nrm
But in my scenario I can't image how I am supposed to use amx_GetAddr on a hooked native's params.
These are my attempts:
http://pastebin.com/k3DXn0Ff