LucasBaker Posted November 1, 2014 Share Posted November 1, 2014 exports.scoreboard:addScoreboardColumn("id",getRootElement(),1) function getIDFromPlayer(player) if player then local theid players = getElementsByType("player") for id,p in ipairs(players) do if player == p then theid = i end end return theid else return false end end function getPlayerFromID(theID) if theID then theID = tonumber(theID) local theplayer players = getElementsByType("player") for id,p in ipairs(players) do if theID == id then theplayer = p end end return theplayer else return false end end why not appear on the scoreboard id? Link to comment
Castillo Posted November 1, 2014 Share Posted November 1, 2014 You mean that the column doesn't appear? Link to comment
LucasBaker Posted November 1, 2014 Author Share Posted November 1, 2014 You mean that the column doesn't appear? column appears but not the id Link to comment
WASSIm. Posted November 1, 2014 Share Posted November 1, 2014 exports.scoreboard:addScoreboardColumn("id", root, 1) addEventHandler("onResourceStart", root, function() for id,player in ipairs(getElementsByType("player")) do setElementData(player , "id", id) end end ) function getIDFromPlayer(player) return getElementData(player , "id") end function getPlayerFromID(theID) if theID then local players = getElementsByType("player") for i,p in ipairs(players) do local id = getElementData(p, "id") if theID == id then return p end end end return false end Link to comment
LucasBaker Posted November 1, 2014 Author Share Posted November 1, 2014 exports.scoreboard:addScoreboardColumn("id", root, 1) addEventHandler("onResourceStart", root, function() for id,player in ipairs(getElementsByType("player")) do setElementData(player , "id", id) end end ) function getIDFromPlayer(player) return getElementData(player , "id") end function getPlayerFromID(theID) if theID then local players = getElementsByType("player") for i,p in ipairs(players) do local id = getElementData(p, "id") if theID == id then return p end end end return false end Not to create another topic How does the marker back to dps than 2 seconds ? I thought about using SetTimer but I do not do the slightest idea of how to use could help me ? lixo1 = createMarker(1516.41675, -1847.13733, 13.54688, 'cylinder', 2.0, 255, 0, 0, 150) function aLixeiro (source) if getPlayerTeam (source, Lixeiros) then outputChatBox("Você pegou o lixo na casa!", source, 255, 0, 0) givePlayerMoney ( source, 50 ) destroyElement(lixo1) else outputChatBox("Você não é lixeiro!", source, 255, 0, 0) end end addEventHandler( "onMarkerHit", lixo1, aLixeiro ) Link to comment
WASSIm. Posted November 1, 2014 Share Posted November 1, 2014 local x, y, z = 1516.41675, -1847.13733, 13.54688 local lixo1 = createMarker(x, y, z, 'cylinder', 2.0, 255, 0, 0, 150) function aLixeiro (source) if getPlayerTeam (source, Lixeiros) then outputChatBox("Você pegou o lixo na casa!", source, 255, 0, 0) givePlayerMoney ( source, 50 ) destroyElement(lixo1) setTimer(function() lixo1 = createMarker(x, y, z, 'cylinder', 2.0, 255, 0, 0, 150) end, 2000, 1) else outputChatBox("Você não é lixeiro!", source, 255, 0, 0) end end addEventHandler( "onMarkerHit", lixo1, aLixeiro ) Link to comment
LucasBaker Posted November 1, 2014 Author Share Posted November 1, 2014 local x, y, z = 1516.41675, -1847.13733, 13.54688 local lixo1 = createMarker(x, y, z, 'cylinder', 2.0, 255, 0, 0, 150) function aLixeiro (source) if getPlayerTeam (source, Lixeiros) then outputChatBox("Você pegou o lixo na casa!", source, 255, 0, 0) givePlayerMoney ( source, 50 ) destroyElement(lixo1) setTimer(function() lixo1 = createMarker(x, y, z, 'cylinder', 2.0, 255, 0, 0, 150) end, 2000, 1) else outputChatBox("Você não é lixeiro!", source, 255, 0, 0) end end addEventHandler( "onMarkerHit", lixo1, aLixeiro ) marker appears again after the function is not repeated Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now