Ragnar Posted August 7, 2019 Posted August 7, 2019 (edited) playerBlips = { } function oi () for index,value in ipairs(getElementsByType("player")) do if( playerBlips [ value ] ) then destroyElement( playerBlips[ value ] ) playerBlips [ value ] = nil end playerBlips[ value ] = createBlipAttachedTo ( value, 0,2,130,10,230) setElementVisibleTo(playerBlips[value],getRootElement( ),false) if(getTeamName(getPlayerTeam(value)) == "Preto") then for index1,value1 in ipairs(getElementsByType("player")) do if(getTeamName(getPlayerTeam(value1)) == "Preto") then setElementVisibleTo(playerBlips[value],value1,true) end end elseif(getTeamName(getPlayerTeam(value)) == "Colorido") then for index1,value1 in ipairs(getElementsByType("player")) do if(getTeamName(getPlayerTeam(value1)) == "Colorido") then setElementVisibleTo(playerBlips[value],value1,true) end end elseif(getTeamName(getPlayerTeam(value)) == "ForaPvP") then for index1,value1 in ipairs(getElementsByType("player")) do if(getTeamName(getPlayerTeam(value1)) == "ForaPvP") then setElementVisibleTo(playerBlips[value],value1,true) end end end end end addEventHandler("onElementModelChange",getRootElement(),oi) O recurso funciona na seguinte forma: Os Blip só são visíveis para cada time. O team "ForaPvp" são os que morreram... daí o que acontece é que quando o jogador morre o blip do time que ele estava continua visível, exemplo: o time Preto. Queria que quando o player morresse ele só conseguir ver o Blip dos cara que ta no team ForaPvP. Edit: Server-Side Edited August 7, 2019 by Ragnar
[M]ister Posted August 7, 2019 Posted August 7, 2019 (edited) playerBlips = { } function oi () for index,value in ipairs(getElementsByType("player")) do if( playerBlips [ value ] ) then destroyElement( playerBlips[ value ] ) playerBlips [ value ] = nil end playerBlips[ value ] = createBlipAttachedTo ( value, 0,2,130,10,230) setElementVisibleTo(playerBlips[value],getRootElement( ),false) if (getPlayerTeam(value)) then for _, p in ipairs(getPlayersInTeam(getPlayerTeam(value))) do setElementVisibleTo(playerBlips[value],p,true) end end end end addEventHandler("onElementModelChange",getRootElement(),oi) Edited August 7, 2019 by MaligNos 1
Ragnar Posted August 7, 2019 Author Posted August 7, 2019 (edited) Quando troco de skin pelo F1 ou pelo Pickup no mapa, ele seta o blip, mas quando morre o blip continua, ele não reconhece que skin foi alterada depois de morto. Teria que ser função onClientRender só que pra server-side? edit: Quando o Jogador sai do server, o blip continua lá também. Edited August 7, 2019 by Ragnar
Other Languages Moderators Lord Henry Posted August 7, 2019 Other Languages Moderators Posted August 7, 2019 onPlayerWasted onPlayerQuit 1
Ragnar Posted August 7, 2019 Author Posted August 7, 2019 Desta forma? function playerQuit() local playerBlips = playerBlips[source] destroyElement(playerBlips) playerBlips[source] = nil end addEventHandler("onPlayerQuit", root, playerQuit) function player_Wasted() local playerBlips = playerBlips[source] destroyElement(playerBlips) playerBlips[source] = nil end addEventHandler("onPlayerWasted", root, player_Wasted)
Ragnar Posted August 7, 2019 Author Posted August 7, 2019 Lua:5: Bad argument @ 'destroyElement' [Expected element at argument 1]
DNL291 Posted August 7, 2019 Posted August 7, 2019 function player_WastedOrQuit() if playerBlips[ source ] then destroyElement(playerBlips[ source ]) playerBlips[source] = nil end end addEventHandler("onPlayerQuit", root, player_WastedOrQuit) addEventHandler("onPlayerWasted", root, player_WastedOrQuit) 1
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