julionib Posted April 1, 2014 Share Posted April 1, 2014 (edited) Probably its possible, the question is how? I tried this natives based on racesp sco file: SET_IGNORE_NO_GPS_FLAG( 1 ); START_GPS_RACE_TRACK( 10 ); for ( I = 0; I < l_U877._fU824; I++ ) { if (l_U877._fU620[i] == 3) { ADD_POINT_TO_GPS_RACE_TRACK( ref l_U877._fU16[i] ); } }RENDER_RACE_TRACK( 1 ); based on races_cr script we can see that the parameter for ADD_POINT_TO_GPS_RACE_TRACK is the position: l_U7862 = {-968.99070000, 1170.28300000, 16.87510000};...ADD_POINT_TO_GPS_RACE_TRACK( ref l_U7862 ); maybe im missing some detail or native call... the idea is use in Death Race IV script: Edited April 1, 2014 by julionib Link to comment Share on other sites More sharing options...
pedro2555 Posted April 1, 2014 Share Posted April 1, 2014 Why do they pass it as a reference ?? A think the answer to that question will maybe lead you in the right way. Link to comment Share on other sites More sharing options...
NTAuthority Posted April 1, 2014 Share Posted April 1, 2014 Why do they pass it as a reference ?? A think the answer to that question will maybe lead you in the right way. not passing it a pointer would've caused the game to crash already upon calling it, so I assume he's passing a pointer (to a vector3) indeed Inactive in GTA/R* title modification indefinitely pursuant to a court order obtained by TTWO. Good job acting against modding! Link to comment Share on other sites More sharing options...
julionib Posted April 1, 2014 Author Share Posted April 1, 2014 mmmm, thats complicated Link to comment Share on other sites More sharing options...
pedro2555 Posted April 1, 2014 Share Posted April 1, 2014 @NTAuthority Wait a minute, a reference isn't a pointer. Have you tested that in C++ or C#? @JulioNIB What have you tried so far ? Link to comment Share on other sites More sharing options...
LordOfTheBongs Posted April 1, 2014 Share Posted April 1, 2014 (edited) @NTAuthority Wait a minute, a reference isn't a pointer. Have you tested that in C++ or C#? @JulioNIB What have you tried so far ? in the rockstar scripting language used in the SCO scripts, when a parameter is passed to a native as a reference, in c++ and .net languages it is the same as passing a pointer (.net uses GTA.Native.Pointer) to save the result Edited April 1, 2014 by LordOfTheBongs Link to comment Share on other sites More sharing options...
julionib Posted April 1, 2014 Author Share Posted April 1, 2014 (edited) unbelievable, the pointer thing worked, why R*? why ^^next time i test a native call i will us pointer if they use the REF in the parameter, some native work fine if we ignore this.this is the final code: Native.Function.Call("SET_IGNORE_NO_GPS_FLAG", 1) Native.Function.Call("START_GPS_RACE_TRACK", 10) Native.Function.Call("RENDER_RACE_TRACK", 0) Dim tmpPointer As Native.Pointer = New Native.Pointer(GetType(Vector3)) For Each r As TRace.TRacePoint In RE_editRace.LoadedRacePoints r.blipPos = myNative.attachBlipToCoord(r.pos) r.blipPos.Icon = BlipIcon.Misc_Destination tmpPointer.SetValue(r.pos) Native.Function.Call("ADD_POINT_TO_GPS_RACE_TRACK", tmpPointer) Next Native.Function.Call("RENDER_RACE_TRACK", 1) i removed SET_IGNORE_NO_GPS_FLAG and still working, not sure what it does ^^to clear the track we call Native.Function.Call("RENDER_RACE_TRACK", 0)thx for the tips guys, never expected this as solution Edited April 1, 2014 by julionib Link to comment Share on other sites More sharing options...
julionib Posted April 1, 2014 Author Share Posted April 1, 2014 the result:http://gyazo.com/4776a03cc7ff4ef2c53543753b4bd278http://gyazo.com/ebd71ccbcdfe969b3b724ed0b6b2ffe4 Link to comment Share on other sites More sharing options...
pedro2555 Posted April 1, 2014 Share Posted April 1, 2014 @JulioNIB .NET references aren't the same as pointers, and an actual pointer (a correct memory offset, which, btw, was the most probable reason for the crash mentioned by NTAuthority) is what Rockstar's scripting language actually expects when the ref kwyword is use, and not a reference to CLR owned object as it is in .NET. Take a read at this msdn blog post to better understand the difference: http://goo.gl/3Adw9 Link to comment Share on other sites More sharing options...
julionib Posted April 1, 2014 Author Share Posted April 1, 2014 the question is why this REF thing seems to be ignored in some native calls and in others it have this effect that is like dont call the method, thats the odd part Link to comment Share on other sites More sharing options...
pedro2555 Posted April 1, 2014 Share Posted April 1, 2014 (edited) I haven't really seen the ref keyword being used that much (it is my first time). But can you try to set the pointer value to an actual Vector3 object (instead of the Blip vector3 property) I think that will not work and maybe cause a crash. an you confirm? EDIT: My bad, actual is what you are doing, then the problem must be that you are actually referencing the Vector3 class object and since Vector3 class isn't in GTA Scripting language, it doesn't work. A pointer works because it is just pointing to a memory offset, which happens to be in the allocation expected by the scripting engine. Edited April 1, 2014 by pedro2555 Link to comment Share on other sites More sharing options...
LordOfTheBongs Posted April 1, 2014 Share Posted April 1, 2014 the question is why this REF thing seems to be ignored in some native calls and in others it have this effect that is like dont call the method, thats the odd part which native? Link to comment Share on other sites More sharing options...
julionib Posted April 2, 2014 Author Share Posted April 2, 2014 pedro2555: its working, my last code worked LordOfTheBongs: cant remember a example now, but im almost 100% sure i already used a native that had "ref" in params usage but didnt needed a pointer as param to "work", maybe this is why i have memory corrupt errors (that dont crash game/script at least) sometimes ^^ Link to comment Share on other sites More sharing options...
LordOfTheBongs Posted April 2, 2014 Share Posted April 2, 2014 (edited) Perhaps the incorrect object u used was the same size as the pointer it expected so it did not interfere with other memory... for example, a pointer to a ped and a ped's handle i believe are just 32 bit integers so bad value used but memory would still be organized correctly... im just guessing Edited April 2, 2014 by LordOfTheBongs Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now