Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTAForums Annual Awards 2018

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

julionib

Its possible create race track route on Map?

Recommended Posts

julionib

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 by julionib

Share this post


Link to post
Share on other sites
pedro2555

Why do they pass it as a reference ?? A think the answer to that question will maybe lead you in the right way.

Share this post


Link to post
Share on other sites
NTAuthority

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

Share this post


Link to post
Share on other sites
julionib

mmmm, thats complicated

Share this post


Link to post
Share on other sites
pedro2555

@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 ?

Share this post


Link to post
Share on other sites
LordOfTheBongs

@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 by LordOfTheBongs

Share this post


Link to post
Share on other sites
julionib

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 by julionib

Share this post


Link to post
Share on other sites
pedro2555

@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

Share this post


Link to post
Share on other sites
julionib

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

Share this post


Link to post
Share on other sites
pedro2555

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 by pedro2555

Share this post


Link to post
Share on other sites
LordOfTheBongs

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?

Share this post


Link to post
Share on other sites
julionib

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 ^^

Share this post


Link to post
Share on other sites
LordOfTheBongs

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 by LordOfTheBongs

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • 1 User Currently Viewing
    0 Members, 0 Anonymous, 1 Guest

×

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.