Hello!
to be more rapid and handy, and usefull for some other people, i wanted to create a code that when i aim an entity that alreaty exists on map of gta 58 or placed myself the entity hashmodel.
I had this code but not working… Maybe any suggestions? thanks!
if IsControlPressed(0, Keys['Y']) then
local bool, entity = GetEntityPlayerIsFreeAimingAt(GetPlayerPed(-1), Citizen.ReturnResultAnyway())
if IsEntityAnObject(entity) == true then
if bool then
SetEntityAsMissionEntity(entity, true, true)
TriggerServerEvent('eden_garage:debug', GetEntityModel(entity))
TriggerServerEvent('eden_garage:debug', 'test')
end
TriggerServerEvent('eden_garage:debug', 'test2')
end
end
EDIT: i foud how to get entity i am aiming at, but now how to get model name / propname? (example: prop_cctv_pole_01a)
function getEntity(player) --Function To Get Entity Player Is Aiming At
local result, entity = GetEntityPlayerIsFreeAimingAt(player)
return entity
end
if IsControlPressed(0, Keys['Y']) then
local entity = getEntity(PlayerId())
SetEntityAsMissionEntity(entity, true, true)
TriggerServerEvent('eden_garage:debug', GetEntityModel(entity))
end