Jan 23 2012, 05:23 PM Post #1 | |
Member Posts: 197 From: Liberty City, Shoreside Joined: 15-July 10 | I have the CPlaceable adress, how can I check is it car/ped/building etc.? |
Jan 23 2012, 08:06 PM Post #2 | |
Coding like a Rockstar! Posts: 1,468 From: ??? Joined: 28-May 09 | There are lots of ways, really. You can just check the value of the VMT field matches the VMT base address of a ped/vehicle etc. But you have to ensure to get all the right VMT addresses. For example, your code might end up assuming the pointer is not of a ped, because it doesn't match the CPed VMT address. You can loop through the entity pools and see which one has a pointer that matches. Of course, this way takes a lot more processing. However, it can be considered more sensible than checking the address of the VMT. Unfortunately, the best solution is also a solution which you'll have to do some documentation for first.. CEntity has members in which should actually specify what type of entity it is. There is the model (but model checking is probably not such a good idea). And of course... CODE 00000036 info db ? ; object type (low 3 bits: 0 - object, 1 - building... The low 3 bits apparently specify the object type... perhaps the rest of the flags contain info on what other type of entity it is. I recall seeing functions in SA using SOMETHING in the CEntity class ot check the entity type. But I can't recall where and the CEntity class is surprisingly not yet fully documented. So if you find anything else out about CEntity, please share -------------------- | CLEO 4.3.22 | A?i?a?o?3D | UI SDK | Black Market Mod 1.0.1 | GInput 0.3 | Cheat Keyboard | Tactile Cheat Activation | Stream Ini Extender 0.7 | SuperVars | ScrDebug | Vigilante Justice: San Andreas | |
Feb 9 2012, 01:57 PM Post #3 | |
Coding like a Rockstar! Posts: 1,468 From: ??? Joined: 28-May 09 | Probably a bit late now, but MTA had an enum of entity types (almost certainly provided by R*): CODE enum eEntityType { ENTITY_TYPE_NOTHING, ENTITY_TYPE_BUILDING, ENTITY_TYPE_VEHICLE, ENTITY_TYPE_PED, ENTITY_TYPE_OBJECT, ENTITY_TYPE_DUMMY, ENTITY_TYPE_NOTINPOOLS }; Defined where I said, in the class: CODE //********* BEGIN CEntityInfo **********// BYTE nType : 3; // what type is the entity // 54 (2 == Vehicle) BYTE nStatus : 5; // control status // 54 //********* END CEntityInfo **********// Definitely the best option -------------------- | CLEO 4.3.22 | A?i?a?o?3D | UI SDK | Black Market Mod 1.0.1 | GInput 0.3 | Cheat Keyboard | Tactile Cheat Activation | Stream Ini Extender 0.7 | SuperVars | ScrDebug | Vigilante Justice: San Andreas | |
Feb 12 2012, 12:56 AM Post #4 | |
Member Posts: 197 From: Liberty City, Shoreside Joined: 15-July 10 | Something like this CODE a = byte [Entity.type] // 0x36 a & 7 // and if a == ENTITY_TYPE_VEHICLE |
Feb 12 2012, 10:05 AM Post #5 | |
The Assistant Posts: 84 From: Matera, IT Joined: 16-June 11 | When I was writing the Full Nitro Control mod, I did these findings: CEntity + 0x36 - [byte] Entity type: 0x02 = Player as driver 0x12 = Quiet driver 0x1A = Suspicious driver (when slightly or heavily collided, unlike cops who are never quiet) 0x22 = No driver 0x2A = Destroyed 0x4A = Player as driver is exiting or being wasted, busted or hijacked This post has been edited by Wesser: Feb 12 2012, 11:07 AM |