Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetVehicleID() #25

Open
Montero98 opened this issue Dec 30, 2015 · 8 comments
Open

GetVehicleID() #25

Montero98 opened this issue Dec 30, 2015 · 8 comments

Comments

@Montero98
Copy link

Dear developers of the API, i am missing the function "GetVehicleID" with which users would be able to read a vehicles ID on the server. I really need this function for my program, so i would be very happy, if this could be included.

I hope, i'll get a reply soon. Best Regards, Montero

@Montero98
Copy link
Author

@mschnitzer now it should be correct ;)

@JohnnyCrazy
Copy link
Contributor

@Montero98 👍

@myudev
Copy link

myudev commented Jan 1, 2016

@Montero98 you mean to get the vehicle by id? or to get the ID based on a GTA:SA vehicle ptr?

@Montero98
Copy link
Author

@myudev I mean, the specific ID of the vehicle i am sitting in.

@myudev
Copy link

myudev commented Jan 1, 2016

@Montero98 oh, ok I can provide you guys with offsets, implementing isn't that hard @marcelgerber .
samp.dll+0x1B0A0 is a class function where you can get the Vehicle ID by GTA:SA Ptr.
It's easy to scan for it via pattern (here is the pattern: "\xE8\x00\x00\x00\x00\x66\x3B\xC3", "x????xxx").

The Class pointer is a bit "harder", but i successfully got it since sa-mp 0.3z via pattern scanning offset (samp.dll+0xA6C66) and reading the following 3 mov instructions.
The class is the "Vehicle pool" class.

Here is inline assembler code (or... just cast it):

DWORD dwVehicle = 0x0;
DWORD FindVehicleIDFromGtaPtr = 0x1B0A0; // or "\xE8\x00\x00\x00\x00\x66\x3B\xC3", "x????xxx"
static unsigned short vehicleID_Return;
vehicleID_Return = 65535;
if (dwVehicle != nullptr && FindVehicleIDFromGtaPtr != nullptr)
{
    __asm mov eax, dwVehicle
    __asm push eax
    __asm mov ecx, dwVehiclePool
    __asm call FindVehicleIDFromGtaPtr
    __asm mov[vehicleID_Return], ax
}

Hope it helps.

@ghost
Copy link

ghost commented Jan 1, 2016

@myudev Nice work, we implement it, if an developer (also you) have time 👍

@Montero98
Copy link
Author

Thank you for your help @myudev . But i am not as good as to implement your code into the api - so i have to hope, that some developers of the api have the time to implement it as soon as possible, because i really need this function.

@Montero98
Copy link
Author

How is it going? @marcelgerber @shadowlif @myudev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants