Lovono 5 Posted July 28, 2016 (edited) Hi everybody, Is there anyway we can detect if a model is a trailer so we can use the funciton: ATTACH_VEHICLE_TO_TRAILER Thank Update: The awesome answer is post #12 , thank 123iamking Edited August 3, 2016 by Lovono Quote Share this post Link to post Share on other sites
Jitnaught 377 Posted July 31, 2016 (edited) Use this function int GET_ENTITY_TYPE(Entity entity) // 8ACD366038D14505 0B1BD08DReturns:1 = peds2 = cars3 = objects14 = SCRIPT_GLASS_PANE13 = SCRIPT_TRAIN12 = SCRIPT_TRAILER11 = PLAYER10 = SCRIPT_SUBMARINE9 = SCRIPT_PLANE8 = SCRIPT_PICKUP_PLACEMENT7 = SCRIPT_PICKUP6 =5 =4 =3 = SCRIPT_DOOR2 = SCRIPT_BOAT1 = SCRIPT_BIKE0 = SCRIPT_AUTOMOBILE Or you can check if the model is contained within a list of the trailer models, which are 0xA7FF33F50x9E6B14D60xE82AE6560x1F3D44B50x806EFBEE0xD1ABB6660x3CC7F5960x153E1B0A0x174CB1720x782A236D0xCBB2BE0E0xA1DA3C910x8548036D0x2A72BEAB0x967620BE The GET_ENTITY_TYPE function would be the ideal way to go though because if there are more trailers added later you won't have to update your mod to add them. Or use the functions given in post #12. Edited August 3, 2016 by Jitnaught Quote Share this post Link to post Share on other sites
unknown modder 203 Posted July 31, 2016 Use this function int GET_ENTITY_TYPE(Entity entity) // 8ACD366038D14505 0B1BD08DReturns:1 = peds2 = cars3 = objects14 = SCRIPT_GLASS_PANE13 = SCRIPT_TRAIN12 = SCRIPT_TRAILER11 = PLAYER10 = SCRIPT_SUBMARINE9 = SCRIPT_PLANE8 = SCRIPT_PICKUP_PLACEMENT7 = SCRIPT_PICKUP6 =5 =4 =3 = SCRIPT_DOOR2 = SCRIPT_BOAT1 = SCRIPT_BIKE0 = SCRIPT_AUTOMOBILE Or you can check if the model is contained within a list of the trailer models, which are 0xA7FF33F50x9E6B14D60xE82AE6560x1F3D44B50x806EFBEE0xD1ABB6660x3CC7F5960x153E1B0A0x174CB1720x782A236D0xCBB2BE0E0xA1DA3C910x8548036D0x2A72BEAB0x967620BE The GET_ENTITY_TYPE function would be the ideal way to go though because if there are more trailers added later you won't have to update your mod to add them. GetEntityType only returns if its an object, ped or vehicle. not if its a trailer Quote Share this post Link to post Share on other sites
Jitnaught 377 Posted July 31, 2016 But it says "12 = SCRIPT_TRAILER"? Quote Share this post Link to post Share on other sites
Lovono 5 Posted August 1, 2016 Use this function int GET_ENTITY_TYPE(Entity entity) // 8ACD366038D14505 0B1BD08DReturns:1 = peds2 = cars3 = objects14 = SCRIPT_GLASS_PANE13 = SCRIPT_TRAIN12 = SCRIPT_TRAILER11 = PLAYER10 = SCRIPT_SUBMARINE9 = SCRIPT_PLANE8 = SCRIPT_PICKUP_PLACEMENT7 = SCRIPT_PICKUP6 =5 =4 =3 = SCRIPT_DOOR2 = SCRIPT_BOAT1 = SCRIPT_BIKE0 = SCRIPT_AUTOMOBILE Or you can check if the model is contained within a list of the trailer models, which are 0xA7FF33F50x9E6B14D60xE82AE6560x1F3D44B50x806EFBEE0xD1ABB6660x3CC7F5960x153E1B0A0x174CB1720x782A236D0xCBB2BE0E0xA1DA3C910x8548036D0x2A72BEAB0x967620BE The GET_ENTITY_TYPE function would be the ideal way to go though because if there are more trailers added later you won't have to update your mod to add them. Ah, since there is no native function help that, I think the solution 2 seems great. But what strange is that there are native functions like: IS_THIS_MODEL_A_PLANE_IS_THIS_MODEL_AN_EMERGENCY_BOATIS_THIS_MODEL_A_BOATIS_THIS_MODEL_A_HELIIS_THIS_MODEL_A_CARIS_THIS_MODEL_A_TRAIN... So I think there should be a native to determine if it's the trailer model, maybe we still haven't found it yet. Quote Share this post Link to post Share on other sites
InfamousSabre 224 Posted August 1, 2016 You can probably check for the position of the trailer hitch receiver bone. If it isnt 0,0,0, its a trailer. Quote Share this post Link to post Share on other sites
unknown modder 203 Posted August 1, 2016 (edited) You can probably check for the position of the trailer hitch receiver bone. If it isnt 0,0,0, its a trailer.that only works if it's spawned though. Also checking if boneindex is -1 would be easier. Edited August 1, 2016 by unknown modder Quote Share this post Link to post Share on other sites
InfamousSabre 224 Posted August 1, 2016 (edited) I assume its already spawned since he's trying to attach it to a vehicle. You're right, checking the boneIndex would be better. I'm just going off the top of my head. Edited August 1, 2016 by InfamousSabre Quote Share this post Link to post Share on other sites
unknown modder 203 Posted August 1, 2016 (edited) But it says "12 = SCRIPT_TRAILER"? But the native can literally only return 0(not an entity), 1, 2 or 3 Edited August 1, 2016 by unknown modder Quote Share this post Link to post Share on other sites
Lovono 5 Posted August 1, 2016 (edited) I assume its already spawned since he's trying to attach it to a vehicle. You're right, checking the boneIndex would be better. I'm just going off the top of my head. It's best to check before spawning, Imagine you want to draw a list of trailer to attach. I need a native function to check model trailer because who knows when will R* add new trailer model for the next DLC/Update. Edited August 1, 2016 by Lovono Quote Share this post Link to post Share on other sites
unknown modder 203 Posted August 1, 2016 I assume its already spawned since he's trying to attach it to a vehicle. You're right, checking the boneIndex would be better. I'm just going off the top of my head. It's best to check before spawning, Imagine you want to draw a list of trailer to attach. I need a native function to check model trailer because who knows when will R* add new trailer model for the next DLC/Update.the native function may not exist, natives are only made if the scripts need to use them. Quote Share this post Link to post Share on other sites
123iamking 20 Posted August 2, 2016 (edited) Here is how it's done you can use 2 native function VEHICLE::_GET_VEHICLE_MAX_SPEED(vehModel)//Later the function renamed to VEHICLE::_GET_VEHICLE_MODEL_MAX_SPEED by the authorVEHICLE::GET_VEHICLE_MODEL_ACCELERATION(vehModel)) The trailer always has the acceleration as 0, no doubt. And the speed as negative (-0.51). Just check a vehicle model if the acc is 0 or spd is negative and there you go. Have fun Edited August 2, 2016 by 123iamking Quote Share this post Link to post Share on other sites
bhavinbhai2707 17 Posted August 3, 2016 heyy guys sorry to interrupt n ask question from this topic. . . is their anyway to check if the car model is Michael,trevor,franklins personal vehicle. . .if u know please reply Quote Share this post Link to post Share on other sites
unknown modder 203 Posted August 3, 2016 heyy guys sorry to interrupt n ask question from this topic. . . is their anyway to check if the car model is Michael,trevor,franklins personal vehicle. . .if u know please reply car model or actual car Quote Share this post Link to post Share on other sites
bhavinbhai2707 17 Posted August 3, 2016 (edited) heyy guys sorry to interrupt n ask question from this topic. . . is their anyway to check if the car model is Michael,trevor,franklins personal vehicle. . .if u know please reply car model or actual cari mean to say their personal vehicles which have that blip on them. . . . i want to check whether the player ie(frank mike n trev) are in their personal vehicle or notfor ex:- if trev is in his truck then some code will activate i hope u understand what i mean Edited August 3, 2016 by bhavinbhai2707 Quote Share this post Link to post Share on other sites
Lovono 5 Posted August 4, 2016 heyy guys sorry to interrupt n ask question from this topic. . . is their anyway to check if the car model is Michael,trevor,franklins personal vehicle. . .if u know please reply Thank you for join my topic Did you try this native function BOOL _GET_VEHICLE_OWNER(Vehicle vehicle, Entity* entity)//0x8F5EBAB1F260CFCE Param: The entity should be Michael, Trevor, Franklin ped, and vehicle is the vehicle you want to check Quote Share this post Link to post Share on other sites
bhavinbhai2707 17 Posted August 5, 2016 heyy guys sorry to interrupt n ask question from this topic. . . is their anyway to check if the car model is Michael,trevor,franklins personal vehicle. . .if u know please reply Thank you for join my topic Did you try this native function BOOL _GET_VEHICLE_OWNER(Vehicle vehicle, Entity* entity)//0x8F5EBAB1F260CFCEParam:The entity should be Michael, Trevor, Franklin ped, and vehicle is the vehicle you want to check i didn't understand the param section can u please give an example Quote Share this post Link to post Share on other sites
Jitnaught 377 Posted August 5, 2016 (edited) That code would require you to know the Ped handles of each player. I don't know how to get each player's ped so I'll just give you the code regarding _GET_VEHICLE_OWNER. Ped michaelPed = /*get michael ped*/, trevorPed = /*get trevor ped*/, franklinPed = /*get franklin ped*/;Vehicle veh = /*vehicle you are checking*/;OutputArgument outArg = new OutputArgument();if (GTA.Native.Function.Call<bool>(Hash._GET_VEHICLE_OWNER, veh, outArg)){ Ped owner = (Ped)outArg.GetResult<Entity>(); //can you just cast it or should you use GET_PED_INDEX_FROM_ENTITY_INDEX? if (owner == michaelPed) { //... } else if //...}else GTA.UI.Notify("No owner found"); Edited August 5, 2016 by Jitnaught Quote Share this post Link to post Share on other sites
unknown modder 203 Posted August 5, 2016 That code would require you to know the Ped handles of each player. I don't know how to get each player's ped so I'll just give you the code regarding _GET_VEHICLE_OWNER. Ped michaelPed = /*get michael ped*/, trevorPed = /*get trevor ped*/, franklinPed = /*get franklin ped*/;Vehicle veh = /*vehicle you are checking*/;OutputArgument outArg = new OutputArgument();if (GTA.Native.Function.Call<bool>(Hash._GET_VEHICLE_OWNER, veh, outArg)){ Ped owner = (Ped)outArg.GetResult<Entity>(); //can you just cast it or should you use GET_PED_INDEX_FROM_ENTITY_INDEX? if (owner == michaelPed) { //... } else if //...}else GTA.UI.Notify("No owner found"); you dont need to use GET_PED_INDEX_FROM_ENTITY_INDEX, that native seems like its what R* use to cast an entity to a ped in the scripts, but in reality it just returns whatever was passed to it Quote Share this post Link to post Share on other sites
Jitnaught 377 Posted August 5, 2016 Thanks for the info! Quote Share this post Link to post Share on other sites