darkphoenixxx 7 Posted May 31, 2015 Share Posted May 31, 2015 I made script that supposed to delete target entitiy, but this Entity ent;PLAYER::GET_PLAYER_TARGET_ENTITY(player, &ent);ENTITY::DELETE_ENTITY(&ent); Does not work (crashed the game). So does this. Entity ent;PLAYER::_GET_AIMED_ENTITY(player, &ent);ENTITY::DELETE_ENTITY(&ent); Any ideas where i do somethign wrong? when i do check like if (PLAYER::GET_PLAYER_TARGET_ENTITY) it does not pass it Link to post Share on other sites
c39687 62 Posted May 31, 2015 Share Posted May 31, 2015 (edited) you need to make sure the value returned for the target is not null and the handle is valid if nothing is targeted and you call the code i believe the returned value is null Edited May 31, 2015 by c39687 Link to post Share on other sites
darkphoenixxx 7 Posted June 1, 2015 Author Share Posted June 1, 2015 Wel, what i can do to actually GET the ped i am aiming at? Anyone done this before? Link to post Share on other sites
darkphoenixxx 7 Posted June 4, 2015 Author Share Posted June 4, 2015 (edited) Anyone? I am kinda confused why it does not work. Edited June 4, 2015 by darkphoenixxx Link to post Share on other sites
80T 6 Posted June 8, 2015 Share Posted June 8, 2015 I think this should work... local ent, aimedEnt = PLAYER._GET_AIMED_ENTITY(player, 1) if ent then print(aimedEnt) -- Entity handle print(ENTITY.GET_ENTITY_MODEL(aimedEnt)) -- Entity model print(GAMEPLAY.GET_HASH_KEY(ENTITY.GET_ENTITY_MODEL(aimedEnt))) -- Entity hash key end Link to post Share on other sites
spearminty 1 Posted June 8, 2015 Share Posted June 8, 2015 (edited) make sure you are using the player ID and not the player's ped ID Player player = PLAYER::PLAYER_ID(); NOT Ped player = PLAYER::PLAYER_PED_ID(); Edited June 8, 2015 by spearminty Link to post Share on other sites