Narutimmy Posted July 14, 2013 Share Posted July 14, 2013 Tengo un error en "getTeamColor" , ayuda? local function playerJoin() local r, g, b = getTeamColor(getPlayerTeam(source)) local blip = createBlipAttachedTo(source, 0, 2, r, g, b, 255, 1) setElementParent(blip, playerBlipRoot) setTimer(updateBlipColor, 1000, 0, blip) --Upadate in 5 seconds, in case the server sets the color. end addEventHandler("onClientPlayerJoin", root, playerJoin) Link to comment
MTA Team 0xCiBeR Posted July 14, 2013 MTA Team Share Posted July 14, 2013 function playerJoin() local r, g, b = getTeamColor(getPlayerTeam(source)) local blip = createBlipAttachedTo(source, 0, 2, r, g, b, 255, 1) setElementParent(blip, playerBlipRoot) setTimer(updateBlipColor, 1000, 0, blip) --Upadate in 5 seconds, in case the server sets the color. end addEventHandler("onClientPlayerJoin", root, playerJoin) Link to comment
Narutimmy Posted July 14, 2013 Author Share Posted July 14, 2013 function playerJoin() local r, g, b = getTeamColor(getPlayerTeam(source)) local blip = createBlipAttachedTo(source, 0, 2, r, g, b, 255, 1) setElementParent(blip, playerBlipRoot) setTimer(updateBlipColor, 1000, 0, blip) --Upadate in 5 seconds, in case the server sets the color. end addEventHandler("onClientPlayerJoin", root, playerJoin) Gracias creo ya esta Link to comment
MTA Team 0xCiBeR Posted July 14, 2013 MTA Team Share Posted July 14, 2013 De nada Solo era quitar el local de tu funcion Link to comment
Narutimmy Posted July 14, 2013 Author Share Posted July 14, 2013 De nada Solo era quitar el local de tu funcion pero creo aun sale, le pone un blip rojo al jugador en lugar del color de su team Link to comment
MTA Team 0xCiBeR Posted July 14, 2013 MTA Team Share Posted July 14, 2013 Porque usas el evento onClientPlayerJoin...Aun no esta en ningun team..Proba usar esto: function playerJoin() local r, g, b = getTeamColor(getPlayerTeam(source)) local blip = createBlipAttachedTo(source, 0, 2, r, g, b, 255, 1) setElementParent(blip, playerBlipRoot) setTimer(updateBlipColor, 1000, 0, blip) --Upadate in 5 seconds, in case the server sets the color. end addEventHandler("onClientPlayerSpawn", root, playerJoin) Link to comment
Narutimmy Posted July 14, 2013 Author Share Posted July 14, 2013 Porque usas el evento onClientPlayerJoin...Aun no esta en ningun team..Proba usar esto: function playerJoin() local r, g, b = getTeamColor(getPlayerTeam(source)) local blip = createBlipAttachedTo(source, 0, 2, r, g, b, 255, 1) setElementParent(blip, playerBlipRoot) setTimer(updateBlipColor, 1000, 0, blip) --Upadate in 5 seconds, in case the server sets the color. end addEventHandler("onClientPlayerSpawn", root, playerJoin) Pues no funciona en unas ocaciones el blip sale rojo o no aparece local playerBlipRoot = createElement("playerBlipRoot", "playerBlipRoot") --This function creates blips for all players when the resource starts. local function resourceStart() for _, player in ipairs(getElementsByType("player")) do if player ~= localPlayer then local r, g, b = getTeamColor(getPlayerTeam(player)) local blip = createBlipAttachedTo(player, 0, 2, r, g, b, 255, 1) setElementParent(blip, playerBlipRoot) end end end addEventHandler("onClientResourceStart", root, resourceStart) function playerJoin() local r, g, b = getTeamColor(getPlayerTeam(source)) local blip = createBlipAttachedTo(source, 0, 2, r, g, b, 255, 1) setElementParent(blip, playerBlipRoot) setTimer(updateBlipColor, 1000, 0, blip) --Upadate in 5 seconds, in case the server sets the color. end addEventHandler("onClientPlayerSpawn", root, playerJoin) --This function destroys a players blip when they quit. local function playerQuit() for _, blip in ipairs(getElementChildren(playerBlipRoot)) do if getElementAttachedTo(blip) == source then destroyElement(blip) end end end addEventHandler("onClientPlayerQuit", root, playerQuit) --This function updates a blip's color, ensuring the blip colors always match. function updateBlipColor(blip) if player then local r, g, b = getTeamColor(getPlayerTeam(source)) setBlipColor(blip, r, g, b, 255) end end Link to comment
MTA Team 0xCiBeR Posted July 14, 2013 MTA Team Share Posted July 14, 2013 Prueba esto: local playerBlipRoot = createElement("playerBlipRoot", "playerBlipRoot") --This function creates blips for all players when the resource starts. local function resourceStart() for _, jugador in ipairs(getElementsByType("player")) do if jugador ~= localPlayer then local r, g, b = getTeamColor(getPlayerTeam(jugador)) local pin = createBlipAttachedTo(jugador, 0, 2, r, g, b, 255, 1) setElementParent(pin, playerBlipRoot) end end end addEventHandler("onClientResourceStart", root, resourceStart) function playerJoin() local r, g, b = getTeamColor(getPlayerTeam(source)) local pin = createBlipAttachedTo(source, 0, 2, r, g, b, 255, 1) setElementParent(pin, playerBlipRoot) setTimer(updateBlipColor, 1000, 0, pin) --Upadate in 5 seconds, in case the server sets the color. end addEventHandler("onClientPlayerSpawn", root, playerJoin) --This function destroys a players blip when they quit. local function playerQuit() for _, pin in ipairs(getElementChildren(playerBlipRoot)) do if getElementAttachedTo(pin) == source then destroyElement(pin) end end end addEventHandler("onClientPlayerQuit", root, playerQuit) --This function updates a blip's color, ensuring the blip colors always match. function updateBlipColor(pin) for i, jugador in ipairs(getElementsByType("player")) do local r, g, b = getTeamColor(getPlayerTeam(i)) setBlipColor(pin, r, g, b, 255) end end Link to comment
Recommended Posts