LeFix Posted July 13, 2015 Share Posted July 13, 2015 (edited) There are mehods in ScriptHookDotNet which read the actual rpm of a vehicle.I try to write some code just using the ScriptHookV SDK of Alexander Blade which does the same.Can anybody give me hint how to implement this or show some code snippet?(I already tried to install the ScriptHookDotNet SDK for further researches but I can't figure out how install it right..)I don't want a fix dependency on .NET because it's an additional source of problems for my mod users.My reserach trace in .NET SDK ended there:Vehicle.cpp float Vehicle::CurrentRPM::get(){ return MemoryAccess::GetVehicleRPM(this->Handle);} NativeMemory.cpp float MemoryAccess::GetVehicleRPM(int handle){ uintptr_t addr = GetAddressOfEntity(handle); if (addr == 0) { return 0.0f; } return *(float*)(addr + 2004);} uintptr_t MemoryAccess::GetAddressOfEntity(int Handle){ return *reinterpret_cast<uintptr_t*>(GetAddressOfItemInPool(*sAddressEntityPool, Handle) + 8);} uintptr_t MemoryAccess::GetAddressOfItemInPool(MemoryPool *PoolAddress, int Handle){ if (PoolAddress == nullptr) { return 0; } const int index = HandleToIndex(Handle); const int flag = PoolAddress->BoolAdr[index]; // flag should be equal to 2 if everything is ok // parity check? (taken from ScriptHookDotNet for IV if (flag & 0x80 || flag != (Handle & 0xFF)) { return 0; } return (PoolAddress->ListAddr + index * PoolAddress->ItemSize);} int MemoryAccess::HandleToIndex(int Handle){ return Handle >> 8; // == Handle / 256} I have no idea what this handle. Apparently it was ENTITY.ID befor according to changelog. Can anybody help me? Edited July 13, 2015 by LeFix Link to comment Share on other sites More sharing options...
LeFix Posted July 13, 2015 Author Share Posted July 13, 2015 (edited) I hope I interpretated it right, but in my opinion i need the memory adress of the actual vehicle (dont know how) and then skip 2004 entries further and there the rpm value is stored. Edit: Is there anybody who worked with the rpm of vehicles at all? Can anyone post some mods showing the rpm? Would be great. Edited July 15, 2015 by LeFix 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