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

no way to get entity handle #40

Closed
minipunch opened this issue Jan 13, 2023 · 6 comments
Closed

no way to get entity handle #40

minipunch opened this issue Jan 13, 2023 · 6 comments

Comments

@minipunch
Copy link
Contributor

is there no way to get the entity handle that you are targeting?

for the model one in particular

@minipunch
Copy link
Contributor Author

just wondering how I can get the player ID from a mp_m_freemode_01 ped I am looking at assuming it is a real player

@Taavi-AU
Copy link
Collaborator

yes, its possible, return the ent through targetData

@Taavi-AU
Copy link
Collaborator

Taavi-AU commented Jan 13, 2023

print(json.encode(targetData, {indent=true})) 

and look what it prints, I believe ent is inside it

@Taavi-AU
Copy link
Collaborator

local function onSelect(targetData, itemData)
  print(json.encode(targetData, {indent=true})) 
end

@minipunch
Copy link
Contributor Author

minipunch commented Jan 13, 2023

Yeah I didn't see anything in targetData

But I did get it with:

 onSelect = function(a, b, entityHandle)
		if DoesEntityExist(entityHandle) then
			local serverId = GetPlayerServerId(NetworkGetPlayerIndexFromPed(entityHandle))

seems like the handle is passed as the last arg for me

@Taavi-AU
Copy link
Collaborator

ah okay so itd be passed in a different arg

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

No branches or pull requests

2 participants