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

Suggested change: Max Player #1

Open
IdrisDose opened this issue Apr 30, 2022 · 0 comments
Open

Suggested change: Max Player #1

IdrisDose opened this issue Apr 30, 2022 · 0 comments

Comments

@IdrisDose
Copy link

IdrisDose commented Apr 30, 2022

This function

function GetPlayerByEntityID(id)
for i=0,32 do
if(NetworkIsPlayerActive(i) and GetPlayerPed(i) == id) then return i end
end
return nil
end

should be changed to

function GetPlayerByEntityID(id)
	for i=0, GetConvarInt('sv_maxclients', 32) do
		if(NetworkIsPlayerActive(i) and GetPlayerPed(i) == id) then return i end
	end
	return nil
end

To account for more than 32 players or alternatively replace with returning NetworkGetPlayerIndexFromPed(id).

Ref:
citizenfx/cfx-server-data#199
citizenfx/cfx-server-data#214

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

1 participant