outlier Posted September 18, 2014 Share Posted September 18, 2014 (edited) Hey guys and girls, Sorry if this is not the correct section for this. I started messing with GTA V a while back. I see the great native research thread by Alex and others was posted recently so I thought I'd get back and (try) finish my simple vehicle spawner. Thanks to all the research already done and shared by others, I can see exactly what I was doing wrong before LOL... I am basically trying to call 3 natives. CREATE_VEHICLE/0xDD75460A, PLAYER_PED_ID/0xDD75460A and GET_ENTITY_COORDS/0x1647F1CB. I have the locations of these functions (0x82D02D70, 0x82CA4C80 and 0x82C57270 respectively). PLAYER_PED_ID and GET_ENTITY_COORDS seem to be right because I am able to call them and they're returning seemingly correct values but the game crashes a few seconds later. Here's what my debug logs say: Thread startedGTA V launchedD-Pad Up and Y button were pushedSuccessfully called PLAYER_PED_ID (2)Successfully called GET_ENTITY_COORDS (X: -686.525085, Y: -962.122314, Z: 20.057621) My ped id is 2 (was playing in SP as Franklin) and the entity coords seem to be correct (AFAIK anyway lol). I've tried just calling each function and no matter which one I call, the game crashes back to FSD. Assuming I have the correct memory locations, do I need to somehow hook into the default.xex thread and call myself from there perhaps? I was thinking it was some sort of thread access violation and I need to run as a child thread from the game's parent thread rather than my own thread from my own dll. I know how to do this in windows but not xdk. It seems docs for this stuff is non-existant (prolly a good thing) so I've been raking google for any clues for weeks now Any help (guidance) would be much appreciated. I don't want to be spoon fed, just directed on the right path. I mod for the challenge and I'm not a 15 year old kid who will abuse this priviledge. My RGH is not even online so I am SP bound only. I really could use a car spawner in the game, it would be quite handy Here's snippets of my code that I'm using: //defstypedef unsigned int u32;struct Vector3{ float x, y, z;};//function prototypestypedef u32 (*NATIVE_CREATE_VEHICLE)(u32 vehicleHash, float X, float Y, float Z, float heading, bool createNetworkHandle, bool createVehHandle);typedef u32 (*NATIVE_PLAYER_PED_ID)(void);typedef Vector3 (*NATIVE_GET_ENTITY_COORDS)(u32 p, bool b);//function pointersNATIVE_CREATE_VEHICLE CREATE_VEHICLE = (NATIVE_CREATE_VEHICLE)0x82D02D70;NATIVE_PLAYER_PED_ID PLAYER_PED_ID = (NATIVE_PLAYER_PED_ID)0x82CA4C80;NATIVE_GET_ENTITY_COORDS GET_ENTITY_COORDS = (NATIVE_GET_ENTITY_COORDS)0x82C57270;//function useu32 ped = PLAYER_PED_ID();Vector3 pos = GET_ENTITY_COORDS(ped, 0);CREATE_VEHICLE(0xB779A091 /* adder */, pos.x, pos.y, pos.z, 0.0, false, false); Edited September 18, 2014 by outlier Link to comment Share on other sites More sharing options...
Alexander Blade Posted September 18, 2014 Share Posted September 18, 2014 We are not doing console modding here , sorry As I said before in the main topic - you need to be inside the game's script engine , not just making calls XeClutch and Harsh IV 2 Link to comment Share on other sites More sharing options...
sasuke78200 Posted September 18, 2014 Share Posted September 18, 2014 Remebering that you shouldn't call game's functions in an other thread. Link to comment Share on other sites More sharing options...
XeClutch Posted September 18, 2014 Share Posted September 18, 2014 Since the TU17 update most functions cannot be called this way, as Alex said, you need to be inside the games script engine to do most things. You can do this by hooking the start of the virtual machine and patching 3 branches in the function that loads the natives. Afterward you need to remove the breakpoint and you'll be set. outlier 1 Link to comment Share on other sites More sharing options...
outlier Posted September 18, 2014 Author Share Posted September 18, 2014 Since the TU17 update most functions cannot be called this way, as Alex said, you need to be inside the games script engine to do most things. You can do this by hooking the start of the virtual machine and patching 3 branches in the function that loads the natives. Afterward you need to remove the breakpoint and you'll be set. Thanks! I am happy playing without any TU's Thanks again, it works great now. Link to comment Share on other sites More sharing options...
XeClutch Posted September 19, 2014 Share Posted September 19, 2014 Since the TU17 update most functions cannot be called this way, as Alex said, you need to be inside the games script engine to do most things. You can do this by hooking the start of the virtual machine and patching 3 branches in the function that loads the natives. Afterward you need to remove the breakpoint and you'll be set. Thanks! I am happy playing without any TU's Thanks again, it works great now. Not a problem, back on TU0 I used this to get ped id.. (I wasn't using the VM, I was reversing the functions so they worked when called) #define unsigned int uintuint PLAYER_PED_ID(){ uint val = (uint)ReadDword(0x83A14E04) + 4; if (val == 0) return Call(0x82DF0598); return Call(0x82395A98, val);} outlier 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now