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

    2. News

    1. Red Dead Redemption 2

    1. GTA Online

      1. After Hours
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

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

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

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

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

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

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

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. 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. Forum Support

    2. Site Suggestions

Sign in to follow this  
qiangqiang101

How to get the Speed Limit of the Street/Road/Freeway?

Recommended Posts

Jitnaught

If someone wants to try and deobfuscate/figure out the RageShowMyLocation code used for getting the speed limit, here it is:

 

public static int GetSpeedLimitINT(string str) //str = street name{    int num = 0;    Ped myCharacter = RageShowMyLocationClass.getCharacter(RageShowMyLocationClass.getMyPlayer()); //player character    int result;    while (true)    {        IL_B91:        uint arg_A07_0 = 1722625677u;        while (true)        {            uint num2;            bool flag = false;            bool arg_38_0;            bool arg_329_0;            bool arg_7E_0;            switch ((num2 = (arg_A07_0 ^ 1270910418u)) % 95u)            {            case 0u:                result = num;                arg_A07_0 = 1421080358u;                continue;            case 1u:                arg_A07_0 = (((!flag) ? 2555311153u : 3085115832u) ^ num2 * 3794914848u);                continue;            case 2u:                arg_A07_0 = (num2 * 3287755441u ^ 3769583326u);                continue;            case 3u:                arg_A07_0 = ((flag ? 4165463435u : 3868122613u) ^ num2 * 2377780836u);                continue;            case 4u:                arg_A07_0 = (num2 * 1176351684u ^ 1029257870u);                continue;            case 5u:                arg_A07_0 = ((!(flag = !RageShowMyLocationClass.stringContains(str, _Module_.weirdStuffWithArraysMethod<string>(1313775186u)))) ? 1638768977u : 412181316u);                continue;            case 6u:                num = 50;                arg_A07_0 = (num2 * 1776313437u ^ 3866335980u);                continue;            case 7u:                goto IL_B91;            case 8u:                arg_A07_0 = (num2 * 1279483495u ^ 667523092u);                continue;            case 9u:                arg_A07_0 = (num2 * 1134227873u ^ 2871097431u);                continue;            case 10u:                if (!RageShowMyLocationClass.stringContains(str, _Module_.moreWeirdStuffWithArrayMethod<string>(1261978706u)))                {                    arg_A07_0 = (num2 * 633882024u ^ 3792242465u);                    continue;                }                goto IL_7D;            case 11u:                arg_A07_0 = (num2 * 1191558811u ^ 3181131227u);                continue;            case 12u:                num = 60;                arg_A07_0 = (num2 * 3090648510u ^ 1087202742u);                continue;            case 13u:                arg_A07_0 = (num2 * 1502362183u ^ 3726862419u);                continue;            case 14u:                flag = !RageShowMyLocationClass.stringContains(str, _Module_.whatsWithTheseWeirdArrayMethods<string>(1875235213u));                arg_A07_0 = (num2 * 1374238711u ^ 2834354517u);                continue;            case 15u:                flag = !RageShowMyLocationClass.stringContains(str, _Module_.anotherFrickenWeirdArrayMethod<string>(591322001u));                arg_A07_0 = 27065765u;                continue;            case 16u:                flag = !RageShowMyLocationClass.stringContains(str, _Module_.moreWeirdStuffWithArrayMethod<string>(2317967171u));                arg_A07_0 = 518847816u;                continue;            case 17u:                if (!RageShowMyLocationClass.stringContains(str, _Module_.moreWeirdStuffWithArrayMethod<string>(2819231837u)))                {                    arg_A07_0 = (num2 * 4001258734u ^ 2794988603u);                    continue;                }                goto IL_37;            case 18u:                arg_A07_0 = 1095514892u;                continue;            case 19u:                arg_A07_0 = (((!flag) ? 1527583088u : 2109597960u) ^ num2 * 878013766u);                continue;            case 20u:                arg_A07_0 = (((!flag) ? 2002989490u : 1582344353u) ^ num2 * 3157808375u);                continue;            case 21u:                arg_A07_0 = (num2 * 3700293985u ^ 3704111102u);                continue;            case 22u:                if (!RageShowMyLocationClass.stringContains(str, _Module_.weirdStuffWithArraysMethod<string>(383592340u)))                {                    arg_A07_0 = (num2 * 2784034762u ^ 2886152944u);                    continue;                }                goto IL_37;            case 23u:                arg_A07_0 = ((!(flag = !RageShowMyLocationClass.stringContains(str, _Module_.anotherFrickenWeirdArrayMethod<string>(1638824186u)))) ? 598346658u : 1652441249u);                continue;            case 24u:                arg_A07_0 = (num2 * 298413918u ^ 419533401u);                continue;            case 25u:                arg_A07_0 = ((flag ? 1471120031u : 449574949u) ^ num2 * 1090986640u);                continue;            case 26u:                if (!RageShowMyLocationClass.stringContains(str, _Module_.moreWeirdStuffWithArrayMethod<string>(3768302036u)))                {                    arg_A07_0 = 189345642u;                    continue;                }                goto IL_37;            case 27u:                arg_A07_0 = (((!flag) ? 3530534151u : 3451792104u) ^ num2 * 1630760521u);                continue;            case 28u:                if (!RageShowMyLocationClass.stringContains(str, _Module_.anotherFrickenWeirdArrayMethod<string>(1592407425u)))                {                    arg_A07_0 = (num2 * 1745275297u ^ 2130743422u);                    continue;                }                goto IL_37;            case 29u:                flag = !RageShowMyLocationClass.stringContains(str, _Module_.gahTheseWeirdArrayMethods<string>(1736165323u));                arg_A07_0 = (num2 * 1798303584u ^ 2604256298u);                continue;            case 30u:                num = 45;                arg_A07_0 = (num2 * 2096914510u ^ 1648591757u);                continue;            case 31u:                arg_A07_0 = (((!flag) ? 1477572108u : 1872927270u) ^ num2 * 4122510564u);                continue;            case 32u:                if (!RageShowMyLocationClass.stringContains(str, _Module_.whatsWithTheseWeirdArrayMethods<string>(3399381976u)))                {                    arg_A07_0 = (num2 * 2583433534u ^ 3416337560u);                    continue;                }                goto IL_37;            case 33u:                if (!RageShowMyLocationClass.stringContains(str, _Module_.weirdStuffWithArraysMethod<string>(2468950497u)))                {                    arg_A07_0 = (num2 * 1634612862u ^ 3948904254u);                    continue;                }                goto IL_7D;            case 34u:                arg_A07_0 = (num2 * 2307950894u ^ 3026956680u);                continue;            case 35u:                flag = !RageShowMyLocationClass.stringContains(str, _Module_.anotherFrickenWeirdArrayMethod<string>(4036579190u));                arg_A07_0 = 94323396u;                continue;            case 36u:                num = 25;                arg_A07_0 = (num2 * 4118102225u ^ 3793744434u);                continue;            case 37u:                arg_A07_0 = (((!flag) ? 2211349286u : 4127660130u) ^ num2 * 2529900294u);                continue;            case 38u:                arg_38_0 = !RageShowMyLocationClass.stringContains(str, _Module_.weirdStuffWithArraysMethod<string>(3288289335u));                goto IL_38;            case 39u:                if ((double)RageShowMyLocationClass.myCharacterPosition.Y <= 2123.0)                {                    arg_A07_0 = (num2 * 3912524576u ^ 2960417569u);                    continue;                }                goto IL_328;            case 40u:                arg_A07_0 = (((!(flag = !RageShowMyLocationClass.stringContains(str, _Module_.weirdStuffWithArraysMethod<string>(1313775186u)))) ? 2019826690u : 1669181814u) ^ num2 * 2801285610u);                continue;            case 41u:                flag = ((double)RageShowMyLocationClass.myCharacterPosition.X <= 1566.0);                arg_A07_0 = (num2 * 3887309013u ^ 1513409381u);                continue;            case 42u:                arg_A07_0 = 1411384156u;                continue;            case 43u:                arg_A07_0 = (num2 * 3199626276u ^ 292569221u);                continue;            case 44u:                arg_A07_0 = (num2 * 1947069278u ^ 1789613815u);                continue;            case 45u:                num = 50;                arg_A07_0 = (num2 * 264846280u ^ 970145168u);                continue;            case 46u:                arg_A07_0 = (((!flag) ? 44377980u : 1343602287u) ^ num2 * 2295745306u);                continue;            case 47u:                RageShowMyLocationClass.myCharacterPosition = RageShowMyLocationClass.getEntityPosition(myCharacter);                arg_A07_0 = (num2 * 2485583648u ^ 60390528u);                continue;            case 48u:                arg_A07_0 = (num2 * 1189507208u ^ 4155344223u);                continue;            case 49u:                arg_329_0 = ((double)RageShowMyLocationClass.myCharacterPosition.Y < 1698.0);                goto IL_329;            case 50u:                arg_A07_0 = 1195304129u;                continue;            case 51u:                arg_A07_0 = (num2 * 2801440782u ^ 599883688u);                continue;            case 52u:                arg_A07_0 = (num2 * 567034349u ^ 187656478u);                continue;            case 53u:                arg_A07_0 = 1195304129u;                continue;            case 54u:                arg_A07_0 = 199802338u;                continue;            case 55u:                arg_A07_0 = (num2 * 3452662357u ^ 1484317132u);                continue;            case 56u:                num = 60;                arg_A07_0 = 2130346010u;                continue;            case 57u:                arg_A07_0 = 1195304129u;                continue;            case 58u:                num = 35;                arg_A07_0 = (num2 * 2503515561u ^ 3079497829u);                continue;            case 59u:                num = 60;                arg_A07_0 = (num2 * 3678254058u ^ 2275424969u);                continue;            case 60u:                arg_A07_0 = 584287287u;                continue;            case 61u:                arg_A07_0 = (num2 * 302518341u ^ 639874230u);                continue;            case 62u:                arg_A07_0 = (num2 * 26535027u ^ 3825820666u);                continue;            case 63u:                arg_A07_0 = (num2 * 111695083u ^ 467375164u);                continue;            case 64u:                if (!RageShowMyLocationClass.stringContains(str, _Module_.anotherFrickenWeirdArrayMethod<string>(3001202039u)))                {                    arg_A07_0 = (num2 * 964743288u ^ 779683919u);                    continue;                }                goto IL_37;            case 65u:                if ((double)RageShowMyLocationClass.myCharacterPosition.X <= 426.0)                {                    arg_A07_0 = (num2 * 2550712109u ^ 3776988616u);                    continue;                }                goto IL_328;            case 66u:                arg_A07_0 = (num2 * 61489801u ^ 2408174421u);                continue;            case 67u:                num = 0;                arg_A07_0 = 797972359u;                continue;            case 68u:                arg_A07_0 = (num2 * 2311873047u ^ 2981749616u);                continue;            case 69u:                num = 60;                arg_A07_0 = (num2 * 3950334907u ^ 2744759752u);                continue;            case 70u:                if (!RageShowMyLocationClass.stringContains(str, _Module_.moreWeirdStuffWithArrayMethod<string>(1871450721u)))                {                    arg_A07_0 = (num2 * 718120668u ^ 582902188u);                    continue;                }                goto IL_7D;            case 71u:                arg_A07_0 = 998584921u;                continue;            case 72u:                arg_A07_0 = ((flag ? 773927035u : 1965139045u) ^ num2 * 1569406594u);                continue;            case 73u:                arg_A07_0 = (num2 * 480098699u ^ 1910761649u);                continue;            case 74u:                arg_A07_0 = (num2 * 3165695777u ^ 908574484u);                continue;            case 75u:                arg_A07_0 = 1438865383u;                continue;            case 76u:                num = 35;                arg_A07_0 = (num2 * 3156402321u ^ 3488518826u);                continue;            case 77u:                if (!RageShowMyLocationClass.stringContains(str, _Module_.whatsWithTheseWeirdArrayMethods<string>(671779999u)))                {                    arg_A07_0 = (num2 * 2766414941u ^ 2839716217u);                    continue;                }                goto IL_37;            case 78u:                arg_A07_0 = (num2 * 1747186307u ^ 1225064827u);                continue;            case 79u:                if (!RageShowMyLocationClass.stringContains(str, _Module_.moreWeirdStuffWithArrayMethod<string>(1248291652u)))                {                    arg_A07_0 = (num2 * 3415979315u ^ 354156584u);                    continue;                }                goto IL_37;            case 80u:                flag = ((double)RageShowMyLocationClass.myCharacterPosition.Y < 3483.0);                arg_A07_0 = (num2 * 458320840u ^ 2872363816u);                continue;            case 81u:                arg_A07_0 = ((flag = !RageShowMyLocationClass.stringContains(str, _Module_.gahTheseWeirdArrayMethods<string>(1680058532u))) ? 171992337u : 1642663775u);                continue;            case 83u:                arg_A07_0 = (num2 * 2617488199u ^ 2195418125u);                continue;            case 84u:                num = 35;                arg_A07_0 = (num2 * 4070440316u ^ 1164898463u);                continue;            case 85u:                flag = !RageShowMyLocationClass.stringContains(str, _Module_.weirdStuffWithArraysMethod<string>(2737562922u));                arg_A07_0 = 1211832157u;                continue;            case 86u:                arg_A07_0 = (num2 * 904457645u ^ 4255312724u);                continue;            case 87u:                arg_A07_0 = 1804079595u;                continue;            case 88u:                num = 45;                arg_A07_0 = (num2 * 3198070359u ^ 1267467033u);                continue;            case 89u:                num = 50;                arg_A07_0 = (num2 * 142446866u ^ 1526626208u);                continue;            case 90u:                arg_7E_0 = !RageShowMyLocationClass.stringContains(str, _Module_.whatsWithTheseWeirdArrayMethods<string>(4282145641u));                goto IL_7E;            case 91u:                arg_A07_0 = (num2 * 556035066u ^ 4038623669u);                continue;            case 92u:                num = 50;                arg_A07_0 = (num2 * 2084341818u ^ 1790284884u);                continue;            case 93u:                if (!RageShowMyLocationClass.stringContains(str, _Module_.moreWeirdStuffWithArrayMethod<string>(1763243372u)))                {                    arg_A07_0 = (num2 * 3179095568u ^ 1810163811u);                    continue;                }                goto IL_7D;            case 94u:                if (!RageShowMyLocationClass.stringContains(str, _Module_.moreWeirdStuffWithArrayMethod<string>(3699866766u)))                {                    arg_A07_0 = (num2 * 1445344332u ^ 1347306253u);                    continue;                }                goto IL_37;            }            return result;            IL_38:            arg_A07_0 = ((!(flag = arg_38_0)) ? 148361283u : 1068589504u);            continue;            IL_37:            arg_38_0 = false;            goto IL_38;            IL_7E:            flag = arg_7E_0;            arg_A07_0 = 1702064296u;            continue;            IL_7D:            arg_7E_0 = false;            goto IL_7E;            IL_329:            flag = arg_329_0;            arg_A07_0 = 1269605070u;            continue;            IL_328:            arg_329_0 = true;            goto IL_329;        }    }    return result;}

 

 

 

Edit: edited some of the function names in the code to make it a bit more understandable.

Edited by Jitnaught

Share this post


Link to post
Share on other sites
qiangqiang101

If someone wants to try and deobfuscate/figure out the RageShowMyLocation code used for getting the speed limit, here it is:

 

 

public static int GetSpeedLimitINT(string str){	int num = 0;	Ped entity_ = RageShowMyLocationClass.smethod_39(RageShowMyLocationClass.smethod_38());	int result;	while (true)	{		IL_B91:		uint arg_A07_0 = 1722625677u;		while (true)		{			uint num2;			bool flag;			bool arg_38_0;			bool arg_329_0;			bool arg_7E_0;			switch ((num2 = (arg_A07_0 ^ 1270910418u)) % 95u)			{			case 0u:				result = num;				arg_A07_0 = 1421080358u;				continue;			case 1u:				arg_A07_0 = (((!flag) ? 2555311153u : 3085115832u) ^ num2 * 3794914848u);				continue;			case 2u:				arg_A07_0 = (num2 * 3287755441u ^ 3769583326u);				continue;			case 3u:				arg_A07_0 = ((flag ? 4165463435u : 3868122613u) ^ num2 * 2377780836u);				continue;			case 4u:				arg_A07_0 = (num2 * 1176351684u ^ 1029257870u);				continue;			case 5u:				arg_A07_0 = ((!(flag = !RageShowMyLocationClass.smethod_25(str, <Module>.smethod_30<string>(1313775186u)))) ? 1638768977u : 412181316u);				continue;			case 6u:				num = 50;				arg_A07_0 = (num2 * 1776313437u ^ 3866335980u);				continue;			case 7u:				goto IL_B91;			case 8u:				arg_A07_0 = (num2 * 1279483495u ^ 667523092u);				continue;			case 9u:				arg_A07_0 = (num2 * 1134227873u ^ 2871097431u);				continue;			case 10u:				if (!RageShowMyLocationClass.smethod_25(str, <Module>.smethod_29<string>(1261978706u)))				{					arg_A07_0 = (num2 * 633882024u ^ 3792242465u);					continue;				}				goto IL_7D;			case 11u:				arg_A07_0 = (num2 * 1191558811u ^ 3181131227u);				continue;			case 12u:				num = 60;				arg_A07_0 = (num2 * 3090648510u ^ 1087202742u);				continue;			case 13u:				arg_A07_0 = (num2 * 1502362183u ^ 3726862419u);				continue;			case 14u:				flag = !RageShowMyLocationClass.smethod_25(str, <Module>.smethod_28<string>(1875235213u));				arg_A07_0 = (num2 * 1374238711u ^ 2834354517u);				continue;			case 15u:				flag = !RageShowMyLocationClass.smethod_25(str, <Module>.smethod_26<string>(591322001u));				arg_A07_0 = 27065765u;				continue;			case 16u:				flag = !RageShowMyLocationClass.smethod_25(str, <Module>.smethod_29<string>(2317967171u));				arg_A07_0 = 518847816u;				continue;			case 17u:				if (!RageShowMyLocationClass.smethod_25(str, <Module>.smethod_29<string>(2819231837u)))				{					arg_A07_0 = (num2 * 4001258734u ^ 2794988603u);					continue;				}				goto IL_37;			case 18u:				arg_A07_0 = 1095514892u;				continue;			case 19u:				arg_A07_0 = (((!flag) ? 1527583088u : 2109597960u) ^ num2 * 878013766u);				continue;			case 20u:				arg_A07_0 = (((!flag) ? 2002989490u : 1582344353u) ^ num2 * 3157808375u);				continue;			case 21u:				arg_A07_0 = (num2 * 3700293985u ^ 3704111102u);				continue;			case 22u:				if (!RageShowMyLocationClass.smethod_25(str, <Module>.smethod_30<string>(383592340u)))				{					arg_A07_0 = (num2 * 2784034762u ^ 2886152944u);					continue;				}				goto IL_37;			case 23u:				arg_A07_0 = ((!(flag = !RageShowMyLocationClass.smethod_25(str, <Module>.smethod_26<string>(1638824186u)))) ? 598346658u : 1652441249u);				continue;			case 24u:				arg_A07_0 = (num2 * 298413918u ^ 419533401u);				continue;			case 25u:				arg_A07_0 = ((flag ? 1471120031u : 449574949u) ^ num2 * 1090986640u);				continue;			case 26u:				if (!RageShowMyLocationClass.smethod_25(str, <Module>.smethod_29<string>(3768302036u)))				{					arg_A07_0 = 189345642u;					continue;				}				goto IL_37;			case 27u:				arg_A07_0 = (((!flag) ? 3530534151u : 3451792104u) ^ num2 * 1630760521u);				continue;			case 28u:				if (!RageShowMyLocationClass.smethod_25(str, <Module>.smethod_26<string>(1592407425u)))				{					arg_A07_0 = (num2 * 1745275297u ^ 2130743422u);					continue;				}				goto IL_37;			case 29u:				flag = !RageShowMyLocationClass.smethod_25(str, <Module>.smethod_27<string>(1736165323u));				arg_A07_0 = (num2 * 1798303584u ^ 2604256298u);				continue;			case 30u:				num = 45;				arg_A07_0 = (num2 * 2096914510u ^ 1648591757u);				continue;			case 31u:				arg_A07_0 = (((!flag) ? 1477572108u : 1872927270u) ^ num2 * 4122510564u);				continue;			case 32u:				if (!RageShowMyLocationClass.smethod_25(str, <Module>.smethod_28<string>(3399381976u)))				{					arg_A07_0 = (num2 * 2583433534u ^ 3416337560u);					continue;				}				goto IL_37;			case 33u:				if (!RageShowMyLocationClass.smethod_25(str, <Module>.smethod_30<string>(2468950497u)))				{					arg_A07_0 = (num2 * 1634612862u ^ 3948904254u);					continue;				}				goto IL_7D;			case 34u:				arg_A07_0 = (num2 * 2307950894u ^ 3026956680u);				continue;			case 35u:				flag = !RageShowMyLocationClass.smethod_25(str, <Module>.smethod_26<string>(4036579190u));				arg_A07_0 = 94323396u;				continue;			case 36u:				num = 25;				arg_A07_0 = (num2 * 4118102225u ^ 3793744434u);				continue;			case 37u:				arg_A07_0 = (((!flag) ? 2211349286u : 4127660130u) ^ num2 * 2529900294u);				continue;			case 38u:				arg_38_0 = !RageShowMyLocationClass.smethod_25(str, <Module>.smethod_30<string>(3288289335u));				goto IL_38;			case 39u:				if ((double)RageShowMyLocationClass.vector3_0.Y <= 2123.0)				{					arg_A07_0 = (num2 * 3912524576u ^ 2960417569u);					continue;				}				goto IL_328;			case 40u:				arg_A07_0 = (((!(flag = !RageShowMyLocationClass.smethod_25(str, <Module>.smethod_30<string>(1313775186u)))) ? 2019826690u : 1669181814u) ^ num2 * 2801285610u);				continue;			case 41u:				flag = ((double)RageShowMyLocationClass.vector3_0.X <= 1566.0);				arg_A07_0 = (num2 * 3887309013u ^ 1513409381u);				continue;			case 42u:				arg_A07_0 = 1411384156u;				continue;			case 43u:				arg_A07_0 = (num2 * 3199626276u ^ 292569221u);				continue;			case 44u:				arg_A07_0 = (num2 * 1947069278u ^ 1789613815u);				continue;			case 45u:				num = 50;				arg_A07_0 = (num2 * 264846280u ^ 970145168u);				continue;			case 46u:				arg_A07_0 = (((!flag) ? 44377980u : 1343602287u) ^ num2 * 2295745306u);				continue;			case 47u:				RageShowMyLocationClass.vector3_0 = RageShowMyLocationClass.smethod_40(entity_);				arg_A07_0 = (num2 * 2485583648u ^ 60390528u);				continue;			case 48u:				arg_A07_0 = (num2 * 1189507208u ^ 4155344223u);				continue;			case 49u:				arg_329_0 = ((double)RageShowMyLocationClass.vector3_0.Y < 1698.0);				goto IL_329;			case 50u:				arg_A07_0 = 1195304129u;				continue;			case 51u:				arg_A07_0 = (num2 * 2801440782u ^ 599883688u);				continue;			case 52u:				arg_A07_0 = (num2 * 567034349u ^ 187656478u);				continue;			case 53u:				arg_A07_0 = 1195304129u;				continue;			case 54u:				arg_A07_0 = 199802338u;				continue;			case 55u:				arg_A07_0 = (num2 * 3452662357u ^ 1484317132u);				continue;			case 56u:				num = 60;				arg_A07_0 = 2130346010u;				continue;			case 57u:				arg_A07_0 = 1195304129u;				continue;			case 58u:				num = 35;				arg_A07_0 = (num2 * 2503515561u ^ 3079497829u);				continue;			case 59u:				num = 60;				arg_A07_0 = (num2 * 3678254058u ^ 2275424969u);				continue;			case 60u:				arg_A07_0 = 584287287u;				continue;			case 61u:				arg_A07_0 = (num2 * 302518341u ^ 639874230u);				continue;			case 62u:				arg_A07_0 = (num2 * 26535027u ^ 3825820666u);				continue;			case 63u:				arg_A07_0 = (num2 * 111695083u ^ 467375164u);				continue;			case 64u:				if (!RageShowMyLocationClass.smethod_25(str, <Module>.smethod_26<string>(3001202039u)))				{					arg_A07_0 = (num2 * 964743288u ^ 779683919u);					continue;				}				goto IL_37;			case 65u:				if ((double)RageShowMyLocationClass.vector3_0.X <= 426.0)				{					arg_A07_0 = (num2 * 2550712109u ^ 3776988616u);					continue;				}				goto IL_328;			case 66u:				arg_A07_0 = (num2 * 61489801u ^ 2408174421u);				continue;			case 67u:				num = 0;				arg_A07_0 = 797972359u;				continue;			case 68u:				arg_A07_0 = (num2 * 2311873047u ^ 2981749616u);				continue;			case 69u:				num = 60;				arg_A07_0 = (num2 * 3950334907u ^ 2744759752u);				continue;			case 70u:				if (!RageShowMyLocationClass.smethod_25(str, <Module>.smethod_29<string>(1871450721u)))				{					arg_A07_0 = (num2 * 718120668u ^ 582902188u);					continue;				}				goto IL_7D;			case 71u:				arg_A07_0 = 998584921u;				continue;			case 72u:				arg_A07_0 = ((flag ? 773927035u : 1965139045u) ^ num2 * 1569406594u);				continue;			case 73u:				arg_A07_0 = (num2 * 480098699u ^ 1910761649u);				continue;			case 74u:				arg_A07_0 = (num2 * 3165695777u ^ 908574484u);				continue;			case 75u:				arg_A07_0 = 1438865383u;				continue;			case 76u:				num = 35;				arg_A07_0 = (num2 * 3156402321u ^ 3488518826u);				continue;			case 77u:				if (!RageShowMyLocationClass.smethod_25(str, <Module>.smethod_28<string>(671779999u)))				{					arg_A07_0 = (num2 * 2766414941u ^ 2839716217u);					continue;				}				goto IL_37;			case 78u:				arg_A07_0 = (num2 * 1747186307u ^ 1225064827u);				continue;			case 79u:				if (!RageShowMyLocationClass.smethod_25(str, <Module>.smethod_29<string>(1248291652u)))				{					arg_A07_0 = (num2 * 3415979315u ^ 354156584u);					continue;				}				goto IL_37;			case 80u:				flag = ((double)RageShowMyLocationClass.vector3_0.Y < 3483.0);				arg_A07_0 = (num2 * 458320840u ^ 2872363816u);				continue;			case 81u:				arg_A07_0 = ((flag = !RageShowMyLocationClass.smethod_25(str, <Module>.smethod_27<string>(1680058532u))) ? 171992337u : 1642663775u);				continue;			case 83u:				arg_A07_0 = (num2 * 2617488199u ^ 2195418125u);				continue;			case 84u:				num = 35;				arg_A07_0 = (num2 * 4070440316u ^ 1164898463u);				continue;			case 85u:				flag = !RageShowMyLocationClass.smethod_25(str, <Module>.smethod_30<string>(2737562922u));				arg_A07_0 = 1211832157u;				continue;			case 86u:				arg_A07_0 = (num2 * 904457645u ^ 4255312724u);				continue;			case 87u:				arg_A07_0 = 1804079595u;				continue;			case 88u:				num = 45;				arg_A07_0 = (num2 * 3198070359u ^ 1267467033u);				continue;			case 89u:				num = 50;				arg_A07_0 = (num2 * 142446866u ^ 1526626208u);				continue;			case 90u:				arg_7E_0 = !RageShowMyLocationClass.smethod_25(str, <Module>.smethod_28<string>(4282145641u));				goto IL_7E;			case 91u:				arg_A07_0 = (num2 * 556035066u ^ 4038623669u);				continue;			case 92u:				num = 50;				arg_A07_0 = (num2 * 2084341818u ^ 1790284884u);				continue;			case 93u:				if (!RageShowMyLocationClass.smethod_25(str, <Module>.smethod_29<string>(1763243372u)))				{					arg_A07_0 = (num2 * 3179095568u ^ 1810163811u);					continue;				}				goto IL_7D;			case 94u:				if (!RageShowMyLocationClass.smethod_25(str, <Module>.smethod_29<string>(3699866766u)))				{					arg_A07_0 = (num2 * 1445344332u ^ 1347306253u);					continue;				}				goto IL_37;			}			return result;			IL_38:			arg_A07_0 = ((!(flag = arg_38_0)) ? 148361283u : 1068589504u);			continue;			IL_37:			arg_38_0 = false;			goto IL_38;			IL_7E:			flag = arg_7E_0;			arg_A07_0 = 1702064296u;			continue;			IL_7D:			arg_7E_0 = false;			goto IL_7E;			IL_329:			flag = arg_329_0;			arg_A07_0 = 1269605070u;			continue;			IL_328:			arg_329_0 = true;			goto IL_329;		}	}	return result;}

 

 

 

So there are no native to do that? it sucks

Share this post


Link to post
Share on other sites
Jitnaught

Don't think so.

 

From looking at the code, it sort of looks like it just gets the current street name, checks an array if the street name is in it, and if it is, then set the speed limit to the one that is linked with that array. I can't confirm that, it just sort of looks like it.

Edited by Jitnaught

Share this post


Link to post
Share on other sites
jedijosh920

Spawn a ped inside a vehicle for the street you want then MarkAsNoLongerNeeded() or make IsPersistent to false and get their speed while they drive.

Share this post


Link to post
Share on other sites
Jitnaught

I was finally able to figure out how to deobfuscate the script. To do it I used NoFuserEx, ConfuserExSwitchKiller, and de4dot.

 

Here is the code relevant to getting the speed limit:

 

 

public static int GetSpeedLimitINT(string str) //str = street name{	Ped character = Game.LocalPlayer.Character;	RageShowMyLocationClass.vector3_0 = character.Position;	int result;	if (str.Contains("Los Santos Freeway") || str.Contains("Los Santos Fwy") || str.Contains("Del Perro") || str.Contains("Olympic") || str.Contains("La Puerta"))	{		if (!str.Contains("City"))		{			result = 60;		}		else		{			result = 45;		}	}	else if (!str.Contains("Great Ocean") && !str.Contains("Tongva Dr") && !str.Contains("Senora Fwy") && !str.Contains("Palomino Fwy") && !str.Contains("Senora Freeway") && !str.Contains("Palomino Freeway") && !str.Contains("Elysian Fields") && !str.Contains("Route") && !str.Contains("Droga") && !str.Contains("68"))	{		if (!str.Contains("Senora Rd"))		{			if (!str.Contains("Panorama Dr"))			{				if (str.Contains("Joshua Rd"))				{					if ((double)RageShowMyLocationClass.vector3_0.Y < 3483.0)					{						result = 60;					}					else					{						result = 50;					}				}				else if (!str.Contains("Baytree Canyon Rd"))				{					if (!str.Contains("County"))					{						if (str.Contains("City"))						{							result = 25;						}						else						{							result = 0;						}					}					else					{						result = 35;					}				}				else if ((double)RageShowMyLocationClass.vector3_0.X <= 426.0 && (double)RageShowMyLocationClass.vector3_0.Y <= 2123.0 && (double)RageShowMyLocationClass.vector3_0.Y >= 1698.0)				{					result = 35;				}				else				{					result = 50;				}			}			else			{				result = 50;			}		}		else if (!str.Contains("County"))		{			result = 35;		}		else		{			result = 60;		}	}	else	{		if (!str.Contains("City"))		{			result = 60;		}		else		{			result = 45;		}		if (str.Contains("68") && (double)RageShowMyLocationClass.vector3_0.X > 1566.0)		{			result = 50;		}	}	return result;}

 

 

 

I was kinda close (but still pretty far) when I guessed that the script was checking an array for the string. It's actually just checking if the string contains certain keywords and is in a certain area.

Edited by Jitnaught

Share this post


Link to post
Share on other sites
Cyron43

That sucks! I am still looking for a native which returns the speed limit for given street.

@Jitnaught Thanks anyway for your effort. :)

Share this post


Link to post
Share on other sites
LeeC2202

What you need is a list of every street name in the game. Then build that into a mod, where you just drive around the streets. When you drive on a new street, it will ask for the speed limit of that street and then store it. Once it has every street covered, it can write out a Dictionary<string, int> of street name, speed limit that you can use as a look-up source.

 

If someone knows how to get the street names, the rest is something I could possibly do with my infinite free-time. It'll be like therapy. :D I did the same kind of thing when I collected every bus-stop in the game.

 

I do have another mod that I used to collect all the CCTV camera locations but I don't think that would work for this. I was thinking that I could search for the speed limit road sign props, then get the nearest point on a road from the location of the sign but you can't guarantee that every road has a sign on it.

Share this post


Link to post
Share on other sites
LeeC2202

I don't know if this is any use to anyone but after digging through the global.oxt file and cross referencing with the GTA Wikia, I have this list, which is 220 218 Street names in alphabetical order. https://drive.google.com/file/d/0B7LFvItVrwd0MEo3SEptOGRhR0U/view?usp=sharing

 

GTA Wikia had around 164, so this list adds quite a few more.

 

I am going to drop this list into a mod and start driving round the map occasionally. As soon as I get a complete list of speed limits to match the streets, I will upload that data as well... unless someone else does it first.

 

Edit: I have just updated the list as I noticed a couple of duplicates. Jamestown St and South Shambles St were listed twice, sorry about that.

Edited by LeeC2202

Share this post


Link to post
Share on other sites
LeeC2202

Okay, for anyone who is interested, the file on the link in the previous post has been updated and is now in this format:

 

0x8CD2E019, Abattoir Ave
0xDDCBDC74, Abe Milton Pkwy
0x4B7B2734, Ace Jones Dr
0x40D0731C, Adam's Apple Blvd

etc...

 

Doing a second search proved useful as I found some that I had missed, so there are now 228 listed.

Share this post


Link to post
Share on other sites
LeeC2202

Just to add one more update on this. I did some checking the other day with a few natives that returned floats. Some return bit-flags as well but nothing returned anything that would resemble speed limits. This was the main one I was using GET_VEHICLE_NODE_PROPERTIES but it seemed to change when there were turnoffs or road types changed. I also tried these but had no luck.

    edit float _0x29C24BFBED8AB8FB(float p0, float p1) // 29C24BFBED8AB8FB 3FE8C5A0    edit float _0x8ABE8608576D9CE3(float p0, float p1, float p2, float p3) // 8ABE8608576D9CE3 3ED21C90    edit float _0x336511A34F2E5185(float left, float right) // 336511A34F2E5185 A07C5B7D    edit float _0x3599D741C9AC6310(float p0, float p1, float p2, float p3) // 3599D741C9AC6310 76751DD4

The other thing I noticed is that to do this, you would have to cross-reference road/street with zone name, because something like Route 68, goes through several zones and they don't all have the same speed limit. There are also truck speed limits in place on certain roads as well.

 

So based on what I have seen, I have to wonder if the speeds the AI drive at, are simply set as part of their tasks and not in response to any speed limits. They seem to drive very slow or very fast, no matter what the speed limits say. So maybe it's just a driving style that controls them and the road signs are simply there as real-life decoration.

 

If I find anything more, I will update the post...

Edited by LeeC2202

Share this post


Link to post
Share on other sites
K^2

It would be smart of developers to store flags on each node that report the type of road, and map these to a look-up table with actual speed limits. That would allow quickly changing the limits on a particular class of road without having to go through each node. So my money would be on this being the case.

Share this post


Link to post
Share on other sites
LeeC2202

Which would be a valid requirement, if the speed limits were relevant... but I suspect in this game, they're not. In a simulation, speed limits would be an essential factor but in a game where AI merely drives a world with preset tasks, just to put traffic on the roads, it's not so much an issue. They have driving styles which obey a limited set of rules and as such, have task processing that requires limited overhead. They don't need to care where they are on the map, just what their situation dictates that they do.

 

Given their already erratic behaviour, I would think that obeying another set of rules, would just cause them to create more obstacles, rather than drive freely. I think this is just a case of us requiring data that the game simply has no reason to store. My monitoring of the node flags showed no change at points in the road where speed limits were clearly being changed and I drove through several sections where speed limits were varying. This includes general traffic limits and isolated truck limits as well. I was watching them at a bit level, so any changes were very easy to spot.

 

As an example, I have just driven the full length of Route 68 again and 2 bits were used for the majority of the route. Bit 1 was set for the full length of the route and bit 7 was set when there was any kind of junction/intersection/turn-off. The only other variation on that was here, which I suspect marks the node as an access point to the roadside seller. Other than that it was either 130 or 2, those were the only values used and that road varies between 50mph and 60mph, with an additional 45mph limit for trucks.

 

wWsMTz0.jpg

 

There is a flag that marks a road as a slow road, which this native reads _GET_IS_SLOW_ROAD_FLAG(int nodeID)

Edited by LeeC2202

Share this post


Link to post
Share on other sites
K^2

There is a flag that marks a road as a slow road, which this native reads _GET_IS_SLOW_ROAD_FLAG(int nodeID)

I was about to say, while actual speed limits might not be necessary, there has to be some way of telling what speed AI should drive on the road that correlates with it. But are there really just two speed modes? Slow and fast?

Share this post


Link to post
Share on other sites
LeeC2202

 

There is a flag that marks a road as a slow road, which this native reads _GET_IS_SLOW_ROAD_FLAG(int nodeID)

I was about to say, while actual speed limits might not be necessary, there has to be some way of telling what speed AI should drive on the road that correlates with it. But are there really just two speed modes? Slow and fast?

 

 

The main thing that leads me to believe that the speed isn't a critical factor in their AI, is this page http://gtaforums.com/topic/822314-guide-driving-styles/

 

There are flags to obey traffic lights, avoid peds, avoid vehicles etc... but none that say "Drive within the speed limit", which I find rather odd if speed limits are in fact used. So what my thoughts were, is that when a vehicle is spawned, a task is set with a speed based on the type of road that spawn location is on. Then perhaps the transition onto a slow road occurs when a vehicle goes from freeway/highway to urban roads, reducing the speed the AI drives at to a slower rate. Or if they are spawned on a slow road, then their speed is increased when they transition onto a non-marked road.

 

I am going to add that slow road check to my output, to see what is going on, maybe seeing what are classed as slow roads, might open up a bit more information. I just need to chain a few natives together as it requires a nodetype to be passed to it and I have to work out if the int part of GET_NODE_PROPERTIES is the nodetype value it wants. All GET_NTH_CLOSEST_VEHICLE_NODE_ID says is "Returns the id.". So I will look through the scripts later and see what exactly it wants.

 

It has my interest peaked because as a game designer, I always find it interesting to see what decisions were made and how they implement those into the design. Separating the speed from the driving style is a curious decision, so I am intrigued to discover why. It also gives me an excuse to write lots of simple mods that just output debug data, which I find curiously entertaining. :D

 

Edit: Incidentally, that 111 value in the previous post that I thought was related to the roadside seller, that value is also used on the airfield near Trevor's house, on the sandy area in front of the main hangar. So it looks like that was maybe just catching the off-road flags for the side road I had wandered onto.

Edited by LeeC2202

Share this post


Link to post
Share on other sites
LeeC2202

Here's a small sample of what the game classes as "Slow" roads. It seems to be off-roads, limited access, that kind of thing.

 

JIrWLZo.jpg

Share this post


Link to post
Share on other sites
LeeC2202

Just a bit more info on where I am up to with this little research project.

 

I discovered a file the other night called paths.xml, a rather large (130MB+) xml file that seems to contain all the node data for the roads. Inside that, I found some interesting entries such as this:

<object guid="5B21040A-AE2A-4689-9DE2-395CBB4162FE" name="vnode23399" class="vehiclenode" superclass="helper">	<transform>		<object>			<position x="852.431763" y="96.631592" z="68.512962" />		</object>		<node>			<position x="852.431763" y="96.631592" z="68.512962" />		</node>	</transform>	<attributes class="VehicleNode" guid="{4F0E2CD1-0BCB-4ED6-8E9A-B9DB400DD3F6}">		<attribute name="Speed" type="int" value="3" />		<attribute name="Highway" type="bool" value="true" />		<attribute name="Density" type="int" value="12" />	</attributes>	<paramblocks />	<scene_link_hierarchy />	<user_properties />	<custom_attrs /></object>

You can see there is an attribute called Speed. So I thought I had hit on something useful, until I did a search for all instances of Speed in that document. There were 8717 instances IIRC and they had 1 of 3 values, 0, 2 or 3. There were no instances of 1 anywhere in the document.

 

So armed with that info, I started to cross reference locations, so that I could drive to ones that corresponded to each value, to see what the flags returned. This was the outcome on 3 of them.

 

HxLVDrZ.jpg

 

So the bit patterns showed nothing that reflected the node flag attributes regarding the speed. I looked through the other natives and I cannot find anything that seems to return values that relate to the speeds. I had a look in Codewalker and that did show other flags but none of them showed the speed related info either, as you can see from this image.

 

xdMIZQR.jpg

 

So the end result is that I don't really know where else to look to get this info in-game. If anyone else has any further ideas, shout up and I will look into it. At this point though, I am going to return back to current projects.

Share this post


Link to post
Share on other sites
nondin

@LeeC2202

 

First of all thank you so much because the info you showed here inspired me a lot.

I am interested in speed limit because I would like to set a constant speed limit for the GREAT OCEAN HIGHWAY.

I have been trying to find out the speed limit for a long time, and seeing that you know a lot more about coding than I do, I will share my findings and see if it helps you (and if you can help me).

 

1. path.xml is the file that controls speed limit of each road.

2. <attribute name="Speed" type="int" value="0" means roughly 20 mph

3. <attribute name="Speed" type="int" value="2" means roughly 40 mph

4. <attribute name="Speed" type="int" value="3" means roughly 60 mph

5. <attribute name="Speed" type="int" value="1" doesn't exist in the xml file, because all roads by default have the value="1", and that means roughly 30 mph

6. There is no entry that defines the speed limit of a street. Speed limit can only be set for each "vnode". Usually, the nodes of the same street have the same speed limit. But there are special cases (GREAT OCEAN HIGHWAY, for example).

7. Some vnodes come with street names, but most vnodes don't, making it hard to identify whether a vnode belongs to a particular street.

8. Each vnode has an ID, but the IDs are not necessarily in any order. Sometimes subsequent vnodes belong to the same street, sometimes they don't.

9. 12 vnodes share the same ID (vnode01). I don't know why. They obviously mean different things because they have different coordinates.

 

*Update: I am going to make a graph showing all the locations of nodes. Trying to use notepad++ and excel to complete this.

Edited by nondin

Share this post


Link to post
Share on other sites
Bob_74

@LeeC2202

 

First of all thank you so much because the info you showed here inspired me a lot.

I am interested in speed limit because I would like to set a constant speed limit for the GREAT OCEAN HIGHWAY.

I have been trying to find out the speed limit for a long time, and seeing that you know a lot more about coding than I do, I will share my findings and see if it helps you (and if you can help me).

 

1. path.xml is the file that controls speed limit of each road.

2. <attribute name="Speed" type="int" value="0" means roughly 20 mph

3. <attribute name="Speed" type="int" value="2" means roughly 40 mph

4. <attribute name="Speed" type="int" value="3" means roughly 60 mph

5. <attribute name="Speed" type="int" value="1" doesn't exist in the xml file, because all roads by default have the value="1", and that means roughly 30 mph

6. There is no entry that defines the speed limit of a street. Speed limit can only be set for each "vnode". Usually, the nodes of the same street have the same speed limit. But there are special cases (GREAT OCEAN HIGHWAY, for example).

7. Some vnodes come with street names, but most vnodes don't, making it hard to identify whether a vnode belongs to a particular street.

8. Each vnode has an ID, but the IDs are not necessarily in any order. Sometimes subsequent vnodes belong to the same street, sometimes they don't.

 

*Update: I am going to make a graph showing all the locations of nodes. Trying to use notepad++ and excel to complete this.

I wrote this quickly using ScriptHookVDotNet, it dumps the closest node position, type, density, flags and street name:

 

private int currentNodeID = 0;private void DrawClostestNodes(){	int numberOfNodesDisplayed = 10;	int numberOfNodeTypesToBrowse = 4;	Vector3 myPos = Game.Player.Character.Position;	for (int n = 0; n < numberOfNodesDisplayed; n++)	{		for (int i = 0; i < numberOfNodeTypesToBrowse; i++)		{			System.Drawing.Color color = System.Drawing.Color.Yellow;			int nodeID = Function.Call<int>(Hash.GET_NTH_CLOSEST_VEHICLE_NODE_ID, myPos.X, myPos.Y, myPos.Z, n, i, 300.0f, 300.0f);			if (Function.Call<bool>(Hash.IS_VEHICLE_NODE_ID_VALID, nodeID))			{				OutputArgument posOut = new OutputArgument();				Function.Call(Hash.GET_VEHICLE_NODE_POSITION, nodeID, posOut);				Vector3 nodePos = posOut.GetResult<Vector3>();				World.DrawMarker(MarkerType.DebugSphere, nodePos, Vector3.Zero, Vector3.Zero, new Vector3(1.0f, 1.0f, 1.0f), color);			}		}	}}private void WriteClosestNode(){	Vector3 myPos = Game.Player.Character.Position;	int lastNodeID = 0;	Dictionary<int, Vector3> nodesCoordinates = new Dictionary<int, Vector3>();	Dictionary<int, int> nodesTypes = new Dictionary<int, int>();	// We keep all nodes types corresponding to our coordinates	// we will select the closest one later.	for (int i = 0; i < 4; i++)	{		// nth = 0 : first occurence		// nodeType = i : every type of road		int nodeID = Function.Call<int>(Hash.GET_NTH_CLOSEST_VEHICLE_NODE_ID, myPos.X, myPos.Y, myPos.Z, 0, i, 50.0f, 50.0f);		if (nodeID != lastNodeID)		{			if (Function.Call<bool>(Hash.IS_VEHICLE_NODE_ID_VALID, nodeID))			{				OutputArgument posOut = new OutputArgument();				Function.Call(Hash.GET_VEHICLE_NODE_POSITION, nodeID, posOut);				Vector3 nodePos = posOut.GetResult<Vector3>();				nodesCoordinates.Add(nodeID, nodePos);				nodesTypes.Add(nodeID, i);				lastNodeID = nodeID;			}		}	}	if (nodesCoordinates.Count > 0)	{		int closestNodeID = 0;		Vector3 closestNodePos = Vector3.Zero;		float closestDistance = 10f;		// Finding only the closest node		foreach (int node in nodesCoordinates.Keys)		{			Vector3 nodePos = nodesCoordinates[node];			float distance = World.GetDistance(myPos, nodePos);			if (distance < closestDistance)			{				closestNodeID = node;				closestNodePos = nodePos;				closestDistance = distance;			}		}		// We don't want to spam the text file with the same node		if (closestNodeID != 0 && closestNodeID != currentNodeID)		{			currentNodeID = closestNodeID;			string fileName = "nodesDump.txt";			OutputArgument outDensity = new OutputArgument(), outFlags = new OutputArgument();			Function.Call(Hash.GET_VEHICLE_NODE_PROPERTIES, closestNodePos.X, closestNodePos.Y, closestNodePos.Z, outDensity, outFlags);			int density = outDensity.GetResult<int>(), flags = outFlags.GetResult<int>();			string text = "Node ID = " + closestNodeID.ToString() + Environment.NewLine						+ "Node coordinates = " + closestNodePos.ToString() + Environment.NewLine						+ "Node type = " + nodesTypes[closestNodeID].ToString() + Environment.NewLine						+ "Node density = " + density.ToString() + Environment.NewLine						+ "Node flags = " + GetIntBinaryString(flags, 8) + Environment.NewLine						+ "Street name = " + World.GetStreetName(closestNodePos);			System.IO.File.AppendAllText(fileName, text + Environment.NewLine + "**********************" + Environment.NewLine);		}	}}static string GetIntBinaryString(int n, int size){	char[] b = new char[size];	int pos = size - 1;	int i = 0;	while (i < size)	{		if ((n & (1 << i)) != 0)		{			b[pos] = '1';		}		else		{			b[pos] = '0';		}		pos--;		i++;	}	return new string(b);}
Just call DrawClostestNodes() and WriteClosestNode() in your Tick event.

 

It creates a text file (nodesDump.txt) in your main GTA V directory with only the closest node and show you the 10 closest nodes around you:

 

Node ID = 30212790Node coordinates = X:2706,75 Y:2778,25 Z:36,875Node type = 1Node density = 1Node flags = 00101011Street name = Señora Way**********************Node ID = 49283766Node coordinates = X:2812,25 Y:2860,75 Z:39,96875Node type = 1Node density = 15Node flags = 00001010Street name = Señora Way**********************
QBxKaIdl.png Edited by Bob_74

Share this post


Link to post
Share on other sites
nondin

@Bob74

Thank you so much! Saved me a lot of work!!!

Share this post


Link to post
Share on other sites
Bob_74

Forgot to write that line:

 

private int currentNodeID = 0;
This variable must be set in the class. It holds the last node written, it avoids to write the same node over and over.

The code above is fixed.

 

Also, i don't know if you've seen this, but there is a map with all the path nodes of the game available here http://gta.wikia.com/wiki/Paths_(GTA_V)

Edited by Bob_74

Share this post


Link to post
Share on other sites
nondin

The link in the Wiki is dead.

And it seems that the game has since been updated, because I can locate more than 77,000 nodes in paths.xml .

 

Anyway thank you for the codes. I am working on my project now.

Share this post


Link to post
Share on other sites
nondin

@LeeC2202

 

First of all thank you so much because the info you showed here inspired me a lot.

I am interested in speed limit because I would like to set a constant speed limit for the GREAT OCEAN HIGHWAY.

I have been trying to find out the speed limit for a long time, and seeing that you know a lot more about coding than I do, I will share my findings and see if it helps you (and if you can help me).

 

1. path.xml is the file that controls speed limit of each road.

2. <attribute name="Speed" type="int" value="0" means roughly 20 mph

3. <attribute name="Speed" type="int" value="2" means roughly 40 mph

4. <attribute name="Speed" type="int" value="3" means roughly 60 mph

5. <attribute name="Speed" type="int" value="1" doesn't exist in the xml file, because all roads by default have the value="1", and that means roughly 30 mph

6. There is no entry that defines the speed limit of a street. Speed limit can only be set for each "vnode". Usually, the nodes of the same street have the same speed limit. But there are special cases (GREAT OCEAN HIGHWAY, for example).

7. Some vnodes come with street names, but most vnodes don't, making it hard to identify whether a vnode belongs to a particular street.

8. Each vnode has an ID, but the IDs are not necessarily in any order. Sometimes subsequent vnodes belong to the same street, sometimes they don't.

9. 12 vnodes share the same ID (vnode01). I don't know why. They obviously mean different things because they have different coordinates.

 

*Update: I am going to make a graph showing all the locations of nodes. Trying to use notepad++ and excel to complete this.

Turns out there is one more file indicating speed limits, which is paths.ipl ( the one that appears in wiki as well http://gta.wikia.com/wiki/Paths_(GTA_V)).

What's lacking in the wiki page though, is that node flag 3 is not an unknown attribute. It is indeed the speed limit (0=20, 1=30, 2=40, 3=60)

 

Right now I am going to spend some time on this file, maybe it would explain why there seems to be no effect modifying the paths.xml alone.

My guess is that the paths.xml is simply a source file to generate the paths.ipl, which is read by the game engine.

 

I tried to edit the paths.ipl but the modified file becomes much smaller in size (9mb vs 60kb)and doesn't seem to have any effect on speed limit. Apparently the file can't be edited and saved using text editor alone. What kind of data is lost during the saving process is not known.

 

I think I have done all that I can do for now. I can only hope that openiv finds its way to open and save more encrypted files.

Edited by nondin

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
Sign in to follow this  

×

Important Information

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