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

    1. GTANet.com

    1. GTA Online

      1. The Contract
      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. GTA San Andreas

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

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

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    4. Bugs*

    1. Grand Theft Auto Series

      1. 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. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    6. 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

      1. GTANet 20th Anniversary
    2. Support

    3. Suggestions

Accessing traffic lights


bhavinbhai2707
 Share

Recommended Posts

bhavinbhai2707

Heyy guys. . .I was trying to find some info about traffic lights . . . .is there any way to control those traffic lights. . .like to check 1. if a traffic light is nearby. . .2. What is light colour (green, red or yellow) 3. How can I change them . . .where are they located in game files. . .if u guys know anything about it then please help me :)

Edited by bhavinbhai2707
Link to comment
Share on other sites

Hi,

you can try this to sove 1) and 2).

unfortunately i don't know how to change the color but this might help..

(I am using scripthookvdotnet [C#])

Player player = Game.Player;Ped character = player.Character;//Get all props near the player in a radius of 12float radius = 12f;foreach(Prop prop in World.GetNearbyProps(character.Position, radius)){    //Check if the prop model corresponds to the traffic light model hash    //Traffic Light from photo model hash: 1043035044    if (prop.Model.Hash == 1043035044)        {                        //If it corresponds, change the color or do something        }}

First get all the props in a radius of 12 from the player position, then check if the model hash corresponds to a traffic light model hash, then change the color.

 

P.S: The traffic light model hash 1043035044 its this one:

yQxUfJt.png

 

P.P.S: I don't know if there are any more traffic lights but if there are just add them to the if condition.

 

Sorry i really have no idea at least right now on how to change their color i'll update this answer if i find out something.

 

Good Luck.

 

 

EDIT:

 

How to change the traffic light color however i dont think it affects how peds drive but if you read the whole topic you will find a way so that peds dont respect traffic lights: http://gtaforums.com/topic/830463-help-with-turning-lights-green-and-causing-peds-to-crash-into-each-other/?do=findComment&comment=1068211340

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

bhavinbhai2707

Hi,

you can try this to sove 1) and 2).

unfortunately i don't know how to change the color but this might help..

(I am using scripthookvdotnet [C#])

Player player = Game.Player;Ped character = player.Character;//Get all props near the player in a radius of 12float radius = 12f;foreach(Prop prop in World.GetNearbyProps(character.Position, radius)){    //Check if the prop model corresponds to the traffic light model hash    //Traffic Light from photo model hash: 1043035044    if (prop.Model.Hash == 1043035044)        {                        //If it corresponds, change the color or do something        }}

First get all the props in a radius of 12 from the player position, then check if the model hash corresponds to a traffic light model hash, then change the color.

 

P.S: The traffic light model hash 1043035044 its this one:

yQxUfJt.png

 

P.P.S: I don't know if there are any more traffic lights but if there are just add them to the if condition.

 

Sorry i really have no idea at least right now on how to change their color i'll update this answer if i find out something.

 

Good Luck.

Thanks bro. . . . .i am looking forward to changing color of lights i am searching some game files. . .thanks for traffic lights hash i was searching for it for many days i am sure their are other models of traffic lights too i am trying to get the hashes ingame. . .if i find any other information on it i will upload it here so other can also look upto it. . .thanks for the reply

Edited by bhavinbhai2707
Link to comment
Share on other sites

 

Hi,

you can try this to sove 1) and 2).

unfortunately i don't know how to change the color but this might help..

(I am using scripthookvdotnet [C#])

Player player = Game.Player;Ped character = player.Character;//Get all props near the player in a radius of 12float radius = 12f;foreach(Prop prop in World.GetNearbyProps(character.Position, radius)){    //Check if the prop model corresponds to the traffic light model hash    //Traffic Light from photo model hash: 1043035044    if (prop.Model.Hash == 1043035044)        {                        //If it corresponds, change the color or do something        }}

First get all the props in a radius of 12 from the player position, then check if the model hash corresponds to a traffic light model hash, then change the color.

 

P.S: The traffic light model hash 1043035044 its this one:

yQxUfJt.png

 

P.P.S: I don't know if there are any more traffic lights but if there are just add them to the if condition.

 

Sorry i really have no idea at least right now on how to change their color i'll update this answer if i find out something.

 

Good Luck.

Thanks bro. . . . .i am looking forward to changing color of lights i am searching some game files. . .thanks for traffic lights hash i was searching for it for many days i am sure their are other models of traffic lights too i am trying to get the hashes ingame. . .if i find any other information on it i will upload it here so other can also look upto it. . .thanks for the reply

 

No problem.

Thank you i would apreciate that so please if you find something let me know please you never know when it might come in handy :)

 

 

Yes if you check the post i typed in the edit type you will find all the traffic light hashes good luck :).

Link to comment
Share on other sites

As far as I know, there are only three types of traffic signal.

List<int> trafficSignalHashes = new List<int> {            -655644382,            862871082,            1043035044        };

As bhavinbhai2707 said, you can access them with World.GetNearbyProps and then filter by the hashes.

 

To set them green inside your loop, you can use

Function.Call(Hash.SET_ENTITY_TRAFFICLIGHT_OVERRIDE, prop, 0);

From NativeDB http://www.dev-c.com/nativedb/func/info/57c5db656185eac4

 

0 = green
1 = red
2 = yellow

Link to comment
Share on other sites

  • 1 year later...
On 11/23/2016 at 8:27 AM, derJake said:

As far as I know, there are only three types of traffic signal.

List<int> trafficSignalHashes = new List<int> {            -655644382,            862871082,            1043035044        };

As bhavinbhai2707 said, you can access them with World.GetNearbyProps and then filter by the hashes.

 

To set them green inside your loop, you can use

Function.Call(Hash.SET_ENTITY_TRAFFICLIGHT_OVERRIDE, prop, 0);

From NativeDB http://www.dev-c.com/nativedb/func/info/57c5db656185eac4

I don't understand how to do this..could you explain it step by step? And send pics of each step? Please

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.