That_Guy28 0 Posted May 21, 2015 Share Posted May 21, 2015 (edited) I'm trying to make a script hook mod using lua that explodes whatever vehicle is nearest to the player. I'm not really sure why it isn't working. When I activate it, nothing happens. It doesn't even crash anything. I'm fairly confident that the part where it determines the player position is correct. I used that when I created my whale spawning mod. I tried changing all the bools in "EXPLODE_VEHICLE" to true instead of false and that still doesn't work. Is anyone able to see what I did wrong? There weren't any examples in the "native trainer" source code that I could go by since it has nothing to do with exploding vehicles. Here's my code: function explode_vehicle.tick() if(get_key_pressed(Keys.F5))then local playerPed = PLAYER.PLAYER_PED_ID() local player = PLAYER.GET_PLAYER_PED(playerPed) local playerPosition = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0) local vehicleToExplode = VEHICLE.GET_CLOSEST_VEHICLE(playerPosition.x,playerPosition.y,playerPosition.z, 1000, 0, 70) VEHICLE.EXPLODE_VEHICLE(vehicleToExplode, false, false)end Edited May 21, 2015 by That_Guy28 Link to post Share on other sites
Fireboyd78 382 Posted May 21, 2015 Share Posted May 21, 2015 (edited) I'd start with the basics and print out a debug message after getting the closest vehicle. You know to make sure it actually got a valid vehicle. Edited May 21, 2015 by CarLuver69 Link to post Share on other sites
That_Guy28 0 Posted May 21, 2015 Author Share Posted May 21, 2015 (edited) How do I do that? Using "print(insert whatever here)" won't show anything on the screen or dump the output to a log file. Is there a way to make print() work? Is there another way to print debug messages? There's not even a relevant log file anywhere in my game directory. Edited May 21, 2015 by That_Guy28 Link to post Share on other sites
Fireboyd78 382 Posted May 21, 2015 Share Posted May 21, 2015 Are you using headscript's Lua Scripthook? You should put both LUA.asi and LUA_SDK.asi and a console should appear once you enter story mode. Link to post Share on other sites
Colarocker 2 Posted June 4, 2015 Share Posted June 4, 2015 (edited) found this searching the game scripts: Searching armenian2.c4...Line 32500: v_1C = VEHICLE::GET_CLOSEST_VEHICLE(-36.5853, -1101.4737548828125, 26.3444, 5.0, $\bjxl\, 4);Line 32508: v_1C = VEHICLE::GET_CLOSEST_VEHICLE(-46.2593994140625, -1097.838623046875, 26.3444, 5.0, $\bjxl\, 4);Line 32516: v_1C = VEHICLE::GET_CLOSEST_VEHICLE(-50.08, -1094.4625244140625, 26.0671, 5.0, $\tailgater\, 4);Line 32524: v_1C = VEHICLE::GET_CLOSEST_VEHICLE(-37.41279983520508, -1088.561767578125, 26.0671, 5.0, $\tailgater\, 4);Line 32532: v_1C = VEHICLE::GET_CLOSEST_VEHICLE(-41.425899505615234, -1099.6480712890625, 26.0534, 5.0, $\tailgater\, 4);Line 41575: v_2C = VEHICLE::GET_CLOSEST_VEHICLE(ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), 1), 50.0, 0, v_2D);Line 43213: v_8 = VEHICLE::GET_CLOSEST_VEHICLE(-36.5853, -1101.4737548828125, 26.3444, 5.0, $\bjxl\, 4);Line 43217: v_8 = VEHICLE::GET_CLOSEST_VEHICLE(-46.2593994140625, -1097.838623046875, 26.3444, 5.0, $\schwarzer\, 2);Line 43221: v_8 = VEHICLE::GET_CLOSEST_VEHICLE(-50.08, -1094.4625244140625, 26.0671, 5.0, $\tailgater\, 4);Line 43225: v_8 = VEHICLE::GET_CLOSEST_VEHICLE(-37.41279983520508, -1088.561767578125, 26.0671, 5.0, $\tailgater\, 4);Line 43229: v_8 = VEHICLE::GET_CLOSEST_VEHICLE(-41.425899505615234, -1099.6480712890625, 26.0534, 5.0, $\baller\, 2); as you can see, it looks for a specific vehicle model with $\baller\ , im not sure about the 2 other numbers.. so its cords xyz, a number 5.0, vehiclemodel, and another number ^^ so what i think you can just look for a specific vehicle.. if you manage it to make a list for all vehicles and call it from that position it should be possible to search for all models as closest vehicle? found something similiar for GTA IV.. if you got it going pls update it, i'm gonna dig into it too now xD edit: okay in the game scripts they also use 0 instead of a model.. ^^ Edited June 4, 2015 by Colarocker Link to post Share on other sites