logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline TheOnlyDroid  
#1 Posted : Thursday, December 8, 2016 12:28:39 AM(UTC)
TheOnlyDroid


Rank: Newbie

Groups: Registered
Joined: 1/25/2016(UTC)
Posts: 5
United Kingdom

I'm utterly baffled to why a good ninety percent of the (the code below) is return Vector3.Zero; After reading a little bit online about the specific Native, using "0" in the flags either seems to always return Zero (or false) or crashes the 'script'; As a result of reading this I changed the flag from '0' to '16' how-ever that did not fix my issue....

After pondering why this is happening, I thought that having a function that would loop until it finds itself a valid position to prevent this issue; But I'm constantly blanking on how to do it (I'm frankly putting this down to lack of sleep and stress of work).

Code:

            public static Vector3 GetSafeCoordinatesForPed(Vector3 position)
            {
                Vector3 v3 = UnsafeGetSafeCoordinatesForPed(position);
                return v3;
            }

            private static unsafe Vector3 UnsafeGetSafeCoordinatesForPed(Vector3 position)
            {
                Vector3 vector3;
                if (NativeFunction.CallByName<bool>("GET_SAFE_COORD_FOR_PED", position.X, position.Y, position.Z, true, &vector3.X, &vector3.Y, &vector3.Z, 16))
                    return vector3;
                else
                    return Vector3.Zero;
            }
Offline MulleDK19  
#2 Posted : Tuesday, December 13, 2016 8:05:40 PM(UTC)
MulleDK19


Rank: Developer

Groups: Administrators
Joined: 5/20/2015(UTC)
Posts: 322
Man
Denmark

Was thanked: 22 time(s) in 18 post(s)
GET_SAFE_COORD_FOR_PED might be relying on the ground to work, which means that it only work within a few hundred meters of the player.
We're now on Twitter!
Don't PM me with RAGE Plugin Hook issues (use the Technical Issues forum), and don't add me as a friend unless I know you.

If you need help developing using RAGE Plugin Hook, or just want to chat, join our IRC channel on freenode.
Links are on the front page of the website http://ragepluginhook.net.

Please note, that people may be idling, and response could take a while.
I suggest you stay for at least half an hour after asking your question (Or just stay forever).
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.