Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

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

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

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

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

    2. Support

    3. Suggestions

[Q|C#|.NET] How to create a marker and attach it?


MrGTAmodsgerman
 Share

Recommended Posts

MrGTAmodsgerman

Hey,

How do i create a marker like in San Andreas and attach it to a vehicle?

 

Thanks

  • Like 1
Link to comment
Share on other sites

bhavinbhai2707

Hey,

How do i create a marker like in San Andreas and attach it to a vehicle?

 

Thanks

u can create a marker by world.drawmarker() n what do u mean by attach it??? but though m making guess u can just change it position to the entity's position for ex:- suppose u want to attach it with a car

veh.position = car.position //veh is a marker i assumed to be

 

its just like creating blips n make them follow(remember to stick it in a loop) :)

  • Like 1
Link to comment
Share on other sites

MrGTAmodsgerman

 

Hey,

How do i create a marker like in San Andreas and attach it to a vehicle?

 

Thanks

u can create a marker by world.drawmarker() n what do u mean by attach it??? but though m making guess u can just change it position to the entity's position for ex:- suppose u want to attach it with a car

veh.position = car.position //veh is a marker i assumed to be

 

its just like creating blips n make them follow(remember to stick it in a loop) :)

 

Thanks, and i got a another question to the marker, is it possible to trigger something like OnMarkerHit?

  • Like 1
Link to comment
Share on other sites

unknown modder

 

 

Hey,

How do i create a marker like in San Andreas and attach it to a vehicle?

 

Thanks

u can create a marker by world.drawmarker() n what do u mean by attach it??? but though m making guess u can just change it position to the entity's position for ex:- suppose u want to attach it with a car

veh.position = car.position //veh is a marker i assumed to be

 

its just like creating blips n make them follow(remember to stick it in a loop) :)

 

Thanks, and i got a another question to the marker, is it possible to trigger something like OnMarkerHit?to trigger it you would need a per game check to see if a given ped is close enough to the marker
  • Like 1
Link to comment
Share on other sites

bhavinbhai2707

 

 

Hey,

How do i create a marker like in San Andreas and attach it to a vehicle?

 

Thanks

 

u can create a marker by world.drawmarker() n what do u mean by attach it??? but though m making guess u can just change it position to the entity's position for ex:- suppose u want to attach it with a car

veh.position = car.position //veh is a marker i assumed to be

its just like creating blips n make them follow(remember to stick it in a loop) :)

 

Thanks, and i got a another question to the marker, is it possible to trigger something like OnMarkerHit?

As said by the unknown modder. . .u have to check if the player is close enough to the marker to trigger it just like

 

if(Game.player.character.position.distanceto(Marker) < 15)// Marker is coordinates of your marker

{

world.drawmarker(params);

}

 

alternative to this can be that u can set a bool to true in the above code just as

 

if(same as above)

{

createmark = true;

// now check in loop that if createmark is true then call drawmarker function

}

 

i hope this helps :)

  • Like 1
Link to comment
Share on other sites

unknown modder

if(Game.player.character.position.distanceto(Marker) < 15)

fsqrt is an expensive operation. If you're just checking if a position is close enough then it's better to use DistanceToSquared and use 225 as the max value
  • Like 1
Link to comment
Share on other sites

bhavinbhai2707

 

if(Game.player.character.position.distanceto(Marker) < 15)

fsqrt is an expensive operation. If you're just checking if a position is close enough then it's better to use DistanceToSquared and use 225 as the max value

i heard about this method before but i never tried it so i didn't mention it. . . . i will try it too lol ;)

  • Like 1
Link to comment
Share on other sites

unknown modder

 

 

if(Game.player.character.position.distanceto(Marker) < 15)

fsqrt is an expensive operation. If you're just checking if a position is close enough then it's better to use DistanceToSquared and use 225 as the max value

i heard about this method before but i never tried it so i didn't mention it. . . . i will try it too lol ;)

 

Its not really especially important, but its generally a good habit to get into

  • Like 2
Link to comment
Share on other sites

MrGTAmodsgerman

 

 

 

if(Game.player.character.position.distanceto(Marker) < 15)

fsqrt is an expensive operation. If you're just checking if a position is close enough then it's better to use DistanceToSquared and use 225 as the max value

i heard about this method before but i never tried it so i didn't mention it. . . . i will try it too lol ;)

 

Its not really especially important, but its generally a good habit to get into

 

Thanks but how does "DistanceToSquared" work? Does it do the same thing like distanceto(Marker) < 15)?

Link to comment
Share on other sites

unknown modder

 

 

 

 

if(Game.player.character.position.distanceto(Marker) < 15)

fsqrt is an expensive operation. If you're just checking if a position is close enough then it's better to use DistanceToSquared and use 225 as the max value

i heard about this method before but i never tried it so i didn't mention it. . . . i will try it too lol ;)

 

Its not really especially important, but its generally a good habit to get into

 

Thanks but how does "DistanceToSquared" work? Does it do the same thing like distanceto(Marker) < 15)?

 

pretty much, just make sure you square the distance you're measuring against

Link to comment
Share on other sites

bhavinbhai2707

 

 

 

 

if(Game.player.character.position.distanceto(Marker) < 15)

fsqrt is an expensive operation. If you're just checking if a position is close enough then it's better to use DistanceToSquared and use 225 as the max value
i heard about this method before but i never tried it so i didn't mention it. . . . i will try it too lol ;)

 

Its not really especially important, but its generally a good habit to get into

 

Thanks but how does "DistanceToSquared" work? Does it do the same thing like distanceto(Marker) < 15)?

i am not sure but i m making a guess as i am in a tour n didn't bring my laptop lol. .i think unknown modder wants to say that just enter number which will be squared just like enter 4 to have 16

if u entered 4 it will check distance around 16f from marker coordinates. . .this method is pretty much same but it's more clean ;)

  • Like 1
Link to comment
Share on other sites

MrGTAmodsgerman

 

 

 

 

 

if(Game.player.character.position.distanceto(Marker) < 15)

fsqrt is an expensive operation. If you're just checking if a position is close enough then it's better to use DistanceToSquared and use 225 as the max value
i heard about this method before but i never tried it so i didn't mention it. . . . i will try it too lol ;)

 

Its not really especially important, but its generally a good habit to get into

 

Thanks but how does "DistanceToSquared" work? Does it do the same thing like distanceto(Marker) < 15)?

i am not sure but i m making a guess as i am in a tour n didn't bring my laptop lol. .i think unknown modder wants to say that just enter number which will be squared just like enter 4 to have 16

if u entered 4 it will check distance around 16f from marker coordinates. . .this method is pretty much same but it's more clean ;)

 

More cleans means more performence or not? Or better to hold the code in few lines?

Link to comment
Share on other sites

unknown modder

More cleans means more performence or not? Or better to hold the code in few lines?

The code runs slightly faster. though it would only be noticeable if there were lots of Calls for distanceTo made each tick

  • Like 1
Link to comment
Share on other sites

MrGTAmodsgerman

 

More cleans means more performence or not? Or better to hold the code in few lines?

The code runs slightly faster. though it would only be noticeable if there were lots of Calls for distanceTo made each tick

 

I generally got a big FPS lost with .Net scripts, do you know a very calls clean way to do it? I want to detect if a player is on a special area behind the car with the marker. I mean if the player is there where the marker is.

Edited by MrGTAmodsgerman
  • Like 1
Link to comment
Share on other sites

bhavinbhai2707

 

 

More cleans means more performence or not? Or better to hold the code in few lines?

The code runs slightly faster. though it would only be noticeable if there were lots of Calls for distanceTo made each tick

 

I generally got a big FPS lost with .Net scripts, do you know a very calls clean way to do it? I want to detect if a player is on a special area behind the car with the marker. I mean if the player is there where the marker is.

well for the position check u can do same as above just put it in if statement like this

if(game.player.character.position.distanceto(Marker) < 2)

{

//u can do anything when player is on marker

}

i use the method i gave above. . . .and for fps lost maybe u coded something which is syntactically correct but facing any problem like too many overloads just check scripthookvdotnet.log file for any problem or just upload some part of code here so we can check it out i hope it helps u :)

  • Like 1
Link to comment
Share on other sites

MrGTAmodsgerman

 

 

 

More cleans means more performence or not? Or better to hold the code in few lines?

The code runs slightly faster. though it would only be noticeable if there were lots of Calls for distanceTo made each tick

 

I generally got a big FPS lost with .Net scripts, do you know a very calls clean way to do it? I want to detect if a player is on a special area behind the car with the marker. I mean if the player is there where the marker is.

well for the position check u can do same as above just put it in if statement like this

if(game.player.character.position.distanceto(Marker) < 2)

{

//u can do anything when player is on marker

}

i use the method i gave above. . . .and for fps lost maybe u coded something which is syntactically correct but facing any problem like too many overloads just check scripthookvdotnet.log file for any problem or just upload some part of code here so we can check it out i hope it helps u :)

 

Thank you, i was talk about the whole ScriptHook.Net! Scripts that use NativeUI brings me the most FPS lost, from 60 to 30! All about that can u read on my unclosed topic http://gtaforums.com/topic/839507-how-can-i-play-gta-v-with-mods-without-any-big-fps-lose-that-comes-from-script-mods/

Link to comment
Share on other sites

bhavinbhai2707

 

 

 

 

More cleans means more performence or not? Or better to hold the code in few lines?

The code runs slightly faster. though it would only be noticeable if there were lots of Calls for distanceTo made each tick

 

I generally got a big FPS lost with .Net scripts, do you know a very calls clean way to do it? I want to detect if a player is on a special area behind the car with the marker. I mean if the player is there where the marker is.
well for the position check u can do same as above just put it in if statement like this

if(game.player.character.position.distanceto(Marker) < 2)

{

//u can do anything when player is on marker

}

i use the method i gave above. . . .and for fps lost maybe u coded something which is syntactically correct but facing any problem like too many overloads just check scripthookvdotnet.log file for any problem or just upload some part of code here so we can check it out i hope it helps u :)

 

Thank you, i was talk about the whole ScriptHook.Net! Scripts that use NativeUI brings me the most FPS lost, from 60 to 30! All about that can u read on my unclosed topic http://gtaforums.com/topic/839507-how-can-i-play-gta-v-with-mods-without-any-big-fps-lose-that-comes-from-script-mods/

ohhh native ui u didn't mention it before. . .yess native ui brings mine fps down too its n global issue that's why i stopped using it. . .guadmaz is still looking for the solution maybe will get it soon. . . . ;)

  • Like 1
Link to comment
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
 Share

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

×
×
  • Create New...

Important Information

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