Jump to content
Fivem-DEV.cz
Sign in to follow this  
Dr.House

Fix na esx_scoreboard proti injectu

Recommended Posts

Je to jednoduché stačí escapovat znaky, přidáme funkci do server.cfg 

function escape(str)
	str = string.gsub( str, '&', '&' )
	str = string.gsub( str, '<', '&lt;' )
	str = string.gsub( str, '>', '&gt;' )
	str = string.gsub( str, '"', '&quot;' )
	str = string.gsub( str, "'", '&apos;' )
	str = string.gsub( str, "/", '&#47;' )
	return str
end

A upravíme funkci AddPlayerToScoreboard


function AddPlayerToScoreboard(xPlayer, update)
	local playerId = xPlayer.source

	connectedPlayers[playerId] = {}
	connectedPlayers[playerId].ping = GetPlayerPing(playerId)
	connectedPlayers[playerId].id = playerId
	connectedPlayers[playerId].name = escape(xPlayer.getName())
	connectedPlayers[playerId].job = xPlayer.job.name

	if update then
		TriggerClientEvent('esx_scoreboard:updateConnectedPlayers', -1, connectedPlayers)
	end

	Citizen.CreateThread(function()
		Citizen.Wait(3000)
		TriggerClientEvent('esx_scoreboard:toggleID', playerId, true)
	end)
end

 

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
23 hours ago, Deivik said:

Super ale koukám že tento esx_scoreboard už něco takového má. 
https://github.com/esx-community/esx_scoreboard )

Asi vydali update, toto jsem vyzkoušel na starší verzi, co používám já jelikož ji mám design upravenou, takže bych nechtěl stahovat novou verzi, tak jsem to sem dal, kdyby někdo potřeboval rychlo fix, ještě lepší řešení je toto dát přímo do es_extended na části, kde se bere name hráče

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

Our partners

rcore.cz
K4mb1
SLTH
×
×
  • Create New...