mirror of
https://github.com/iDisaster/GTAConnected.git
synced 2026-03-08 09:25:23 +00:00
Fix vehicle spawning - use Vec3 and correct signed hash values
- Fix createCar to use Vec3 instead of separate x,y,z coordinates (GTAConnected requires Vec3 for second parameter) - Fix all vehicle hashes to use signed 32-bit integers (Previous code incorrectly used 0x prefix with decimal numbers) - All hash values verified against GTAConnected wiki
This commit is contained in:
@@ -1445,126 +1445,133 @@ const vehicleModels = [
|
|||||||
"taxi", "taxi2", "romantaxi"
|
"taxi", "taxi2", "romantaxi"
|
||||||
];
|
];
|
||||||
|
|
||||||
// Vehicle model hashes for GTA IV (matching clean names)
|
// Vehicle model hashes - SIGNED 32-bit integers from GTAConnected wiki
|
||||||
|
// DO NOT use 0x prefix with decimal numbers! Use actual values.
|
||||||
const vehicleHashes = {
|
const vehicleHashes = {
|
||||||
// Sports Cars
|
// Sports Cars
|
||||||
"infernus": 0x18F25AC7,
|
"infernus": 418536135,
|
||||||
"turismo": 0x8EF34547, // Fixed hash
|
"turismo": -1896659641,
|
||||||
"comet": 0x3F637729, // Fixed hash
|
"comet": 1063483177,
|
||||||
"banshee": 0xC1E908D2,
|
"banshee": -1041692462,
|
||||||
"sultan": 0x39DA2754,
|
"sultan": 970598228,
|
||||||
"coquette": 0x108773431,
|
"coquette": 108773431,
|
||||||
|
"supergt": 1821991593,
|
||||||
|
"futo": 2016857647,
|
||||||
// Muscle Cars
|
// Muscle Cars
|
||||||
"buccaneer": 0x682211828,
|
"buccaneer": -682211828,
|
||||||
"dukes": 0x2B26F456,
|
"dukes": 723973206,
|
||||||
"faction": 0x2119578145,
|
"faction": -2119578145,
|
||||||
"ruiner": 0x227741703,
|
"fortune": 627033353,
|
||||||
"sabre": 0x449022887,
|
"ruiner": -227741703,
|
||||||
"sabregt": 0x9B909C94,
|
"sabre": -449022887,
|
||||||
"vigero": 0xCEC6B9B7,
|
"sabregt": -1685021548,
|
||||||
|
"stallion": 1923400478,
|
||||||
|
"vigero": -825837129,
|
||||||
// Sedans
|
// Sedans
|
||||||
"admiral": 0x1264341792,
|
"admiral": 1264341792,
|
||||||
"cavalcade": 0x2006918058,
|
"cognoscenti": -2030171296,
|
||||||
"cognoscenti": 0x2030171296,
|
"emperor": -685276541,
|
||||||
"emperor": 0x685276541,
|
"esperanto": -276900515,
|
||||||
"esperanto": 0x276900515,
|
"feroci": 974744810,
|
||||||
"feroci": 0x974744810,
|
"feltzer": -1097828879,
|
||||||
"feltzer": 0x8911B9F5,
|
"intruder": 886934177,
|
||||||
"intruder": 0x886934177,
|
"lokus": -37030056,
|
||||||
"landstalker": 0x1269098716,
|
"marbella": 1304597482,
|
||||||
"lokus": 0x37030056,
|
"merit": -1260881538,
|
||||||
"marbella": 0x1304597482,
|
"oracle": 1348744438,
|
||||||
"merit": 0x1260881538,
|
"pinnacle": 131140572,
|
||||||
"oracle": 0x1348744438,
|
"premier": -1883869285,
|
||||||
"pinnacle": 0x131140572,
|
"presidente": -1962071130,
|
||||||
"premiere": 0x1883869285,
|
"primo": -1150599089,
|
||||||
"presidente": 0x1962071130,
|
"rebla": 83136452,
|
||||||
"primo": 0x1150599089,
|
"romero": 627094268,
|
||||||
"rebla": 0x83136452,
|
"schafter": -322343873,
|
||||||
"romero": 0x627094268,
|
"sentinel": 1349725314,
|
||||||
"schafter": 0x322343873,
|
"solair": 1344573448,
|
||||||
"sentinel": 0x1349725314,
|
"stratum": 1723137093,
|
||||||
"solair": 0x1344573448,
|
"stretch": -1961627517,
|
||||||
"stratum": 0x1723137093,
|
"vincent": -583281407,
|
||||||
"stretch": 0x1961627517,
|
"virgo": -498054846,
|
||||||
"vincent": 0x583281407,
|
"willard": 1937616578,
|
||||||
"virgo": 0x498054846,
|
"washington": 1777363799,
|
||||||
"willard": 0x1937616578,
|
|
||||||
"washington": 0x1777363799,
|
|
||||||
// SUVs & Trucks
|
// SUVs & Trucks
|
||||||
"bobcat": 0x1075851868,
|
"bobcat": 1075851868,
|
||||||
"boxville": 0x1987130134,
|
"cavalcade": 2006918058,
|
||||||
"biff": 0x850991848,
|
"habanero": 884422927,
|
||||||
"burrito": 0x1346687836,
|
"huntley": 486987393,
|
||||||
"chavos": 0x67282078,
|
"landstalker": 1269098716,
|
||||||
"dilettante": 0x1130810103,
|
"patriot": -808457413,
|
||||||
"flatbed": 0x1353720154,
|
"rancher": 1390084576,
|
||||||
"forklift": 0x1491375716,
|
// Vans & Commercial
|
||||||
"habanero": 0x884422927,
|
"benson": 2053223216,
|
||||||
"huntley": 0x486987393,
|
"biff": 850991848,
|
||||||
"moonbeam": 0x525509695,
|
"boxville": -1987130134,
|
||||||
"mule": 0x904750859,
|
"burrito": -1346687836,
|
||||||
"packer": 0x569305213,
|
"burrito2": -907477130,
|
||||||
"patriot": 0x808457413,
|
"cabby": 1884962369,
|
||||||
"perennial": 0x2077743597,
|
"flatbed": 1353720154,
|
||||||
"pony": 0x119658072,
|
"forklift": 1491375716,
|
||||||
"rancher": 0x1390084576,
|
"moonbeam": 525509695,
|
||||||
"speedo": 0x810318068,
|
"mule": 904750859,
|
||||||
"stockade": 0x1747439474,
|
"packer": 569305213,
|
||||||
"trashmaster": 0x1917016601,
|
"perennial": -2077743597,
|
||||||
"yankee": 0x1099960214,
|
"pony": -119658072,
|
||||||
|
"speedo": -810318068,
|
||||||
|
"stockade": 1747439474,
|
||||||
|
"trashmaster": 1917016601,
|
||||||
|
"yankee": -1099960214,
|
||||||
// Compacts
|
// Compacts
|
||||||
"blista": 0x344943009,
|
"blista": -344943009,
|
||||||
"futo": 0x2016857647,
|
"chavos": -67282078,
|
||||||
"ingot": 0x1289722222,
|
"dilettante": -1130810103,
|
||||||
"pmp600": 0x1376298265,
|
"ingot": -1289722222,
|
||||||
"sultanrs": 0x295689028,
|
"pmp600": 1376298265,
|
||||||
|
"sultanrs": -295689028,
|
||||||
// Motorcycles
|
// Motorcycles
|
||||||
"faggio": 0x1842748181,
|
"bobber": -1830458836,
|
||||||
"hellfury": 0x584879743,
|
"faggio": -1842748181,
|
||||||
"nrg900": 0x6F039A67,
|
"freeway": 1534326199,
|
||||||
"pcj600": 0x909201658,
|
"hellfury": 584879743,
|
||||||
"sanchez": 0x788045382,
|
"nrg900": 1203311498,
|
||||||
"zombie": 0x570033273,
|
"pcj600": -909201658,
|
||||||
|
"sanchez": 788045382,
|
||||||
|
"zombie": -570033273,
|
||||||
// Emergency
|
// Emergency
|
||||||
"ambulance": 0x1171614426,
|
"ambulance": 1171614426,
|
||||||
"firetruk": 0x1938952078,
|
"firetruk": 1938952078,
|
||||||
"police": 0x2046537925,
|
"police": 2046537925,
|
||||||
"police2": 0x1627000575,
|
"police2": -1627000575,
|
||||||
"police3": 0x350085182,
|
"policepatriot": -350085182,
|
||||||
"police4": 0x1127131465,
|
"fbi": 1127131465,
|
||||||
"nstockade": 0x1900572838,
|
"noose": 148777611,
|
||||||
"pstockade": 0x1911513875,
|
"nstockade": -1900572838,
|
||||||
"fbi": 0x432EA949,
|
"pstockade": 1911513875,
|
||||||
"noose": 0x148777611,
|
|
||||||
// Helicopters
|
// Helicopters
|
||||||
"annihilator": 0x837858166,
|
"annihilator": 837858166,
|
||||||
"maverick": 0x1660661558,
|
"maverick": -1660661558,
|
||||||
"polmav": 0x353883353,
|
"polmav": 353883353,
|
||||||
"tourmav": 0x2027357303,
|
"tourmav": 2027357303,
|
||||||
// Boats
|
// Boats
|
||||||
"dinghy": 0x1033245328,
|
"dinghy": 1033245328,
|
||||||
"jetmax": 0x861409633,
|
"jetmax": 861409633,
|
||||||
"marquis": 0x1043459709,
|
"marquis": -1043459709,
|
||||||
"predator": 0x488123221,
|
"predator": -488123221,
|
||||||
"reefer": 0x1759673526,
|
"reefer": 1759673526,
|
||||||
"squalo": 0x400514754,
|
"squalo": 400514754,
|
||||||
"tropic": 0x290013743,
|
"tropic": 290013743,
|
||||||
"tuga": 0x1064455782,
|
"tuga": 1064455782,
|
||||||
// Commercial
|
// Commercial & Special
|
||||||
"airtug": 0x1560980623,
|
"airtug": 1560980623,
|
||||||
"benson": 0x2053223216,
|
"bus": -713569950,
|
||||||
"burrito2": 0x907477130,
|
"mrtasty": 583100975,
|
||||||
"cabby": 0x1884962369,
|
// Trains (may not spawn)
|
||||||
// Special
|
"cablecar": -960289747,
|
||||||
"mrtasty": 0x583100975,
|
"subway": 800869680,
|
||||||
"cablecar": 0x960289747,
|
"eltrain": -1953988645,
|
||||||
"subway": 0x800869680,
|
|
||||||
"eltrain": 0x1953988645,
|
|
||||||
// Taxis
|
// Taxis
|
||||||
"taxi": 0x956048545,
|
"taxi": -956048545,
|
||||||
"taxi2": 0x1208856469,
|
"taxi2": 1208856469,
|
||||||
"romantaxi": 0x1932515764
|
"romantaxi": -1932515764
|
||||||
};
|
};
|
||||||
|
|
||||||
// Execute vehicle spawn using natives
|
// Execute vehicle spawn using natives
|
||||||
@@ -1603,9 +1610,11 @@ addNetworkHandler("ModMenu:ExecuteSpawnVehicle", function(vehicleName) {
|
|||||||
let spawnY = pos.y + Math.cos(-heading) * 5;
|
let spawnY = pos.y + Math.cos(-heading) * 5;
|
||||||
let spawnZ = pos.z + 0.5;
|
let spawnZ = pos.z + 0.5;
|
||||||
|
|
||||||
// Create the car using x, y, z coordinates
|
// Create spawn position as Vec3 (GTAConnected requires Vec3)
|
||||||
// GTA IV native: CREATE_CAR(hash, x, y, z, outVehicle, bool)
|
let spawnPos = new Vec3(spawnX, spawnY, spawnZ);
|
||||||
let vehicle = natives.createCar(modelHash, spawnX, spawnY, spawnZ, true);
|
|
||||||
|
// Create the car - GTAConnected: createCar(hash, Vec3, bool)
|
||||||
|
let vehicle = natives.createCar(modelHash, spawnPos, true);
|
||||||
|
|
||||||
if (vehicle) {
|
if (vehicle) {
|
||||||
// Set vehicle heading to match player
|
// Set vehicle heading to match player
|
||||||
|
|||||||
Reference in New Issue
Block a user