K4stic Posted January 29, 2013 Share Posted January 29, 2013 i have take this script from community and some upgrade 1 bug. it's make all player's with red blip 2 bug. then player charge team the blip not charge color 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(player) local blip = createBlipAttachedTo(player, 0, 2, r, g, b, 255, 1) setElementParent(blip, playerBlipRoot) end end end addEventHandler("onClientResourceStart", root, resourceStart) --This function creates a blip for new players when they join. local function playerJoin() local r, g, b = getTeamColor(source) local blip = createBlipAttachedTo(source, 0, 2, r, g, b, 255, 1) setElementParent(blip, playerBlipRoot) setTimer(updateBlipColor, 1500, 1, blip) --Upadate in 2 seconds, in case the server sets the color. end addEventHandler("onClientPlayerJoin", 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(player) local attach = getElementAttachedTo(player) if ( attach ) then local r, g, b = getTeamColor(player) setBlipColor(blip, r, g, b, 255) end end setTimer(updateBlipColor, 500, 0) Link to comment
Lloyd Logan Posted January 29, 2013 Share Posted January 29, 2013 Try this I have not tried it yet. local playerBlipRoot = createElement("playerBlipRoot", "playerBlipRoot") --This function creates blips for all players when the resource starts. local function resourceStart(thePlayer) local r, g, b = getTeamColor(thePlayer) local blip = createBlipAttachedTo(thePlayer, 0, 2, r, g, b, 255, 1) setElementParent(blip, playerBlipRoot) end addEventHandler("onClientResourceStart", getRootElement(), resourceStart) --This function creates a blip for new players when they join. local function playerJoin(thePlayer) local r, g, b = getTeamColor(thePlayer) local blip = createBlipAttachedTo(thePlayer, 0, 2, r, g, b, 255, 1) setElementParent(blip, playerBlipRoot) setTimer(updateBlipColor, 1500, 1, blip) --Upadate in 2 seconds, in case the server sets the color. function updateBlipColor(thePlayer) local attach = getElementAttachedTo(thePlayer) if ( attach ) then local r, g, b = getTeamColor(thePlayer) setBlipColor(blip, r, g, b, 255) end setTimer(updateBlipColor, 500, 1) end end addEventHandler("onClientPlayerJoin", getRootElement(), playerJoin) local function playerQuit() for _, blip in ipairs(getElementChildren(playerBlipRoot)) do if getElementAttachedTo(blip) == source then destroyElement(blip) end end end addEventHandler("onClientPlayerQuit", root, playerQuit) Link to comment
K4stic Posted January 29, 2013 Author Share Posted January 29, 2013 (edited) super fail not see blips Edited January 29, 2013 by Guest Link to comment
K4stic Posted January 29, 2013 Author Share Posted January 29, 2013 (edited) i Fix it my self Edited January 29, 2013 by Guest Link to comment
K4stic Posted January 29, 2013 Author Share Posted January 29, 2013 but i need in same script other then i charge team or other's charge team the color of blip not charget why? local playerBlipRoot = createElement("playerBlipRoot", "playerBlipRoot") 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, 1500, 1, blip) end addEventHandler("onClientPlayerJoin", root, playerJoin) --This function destroys a players blip when they quit. function playerQuit() for _, blip in ipairs(getElementChildren(playerBlipRoot)) do if getElementAttachedTo(blip) == source then destroyElement(blip) end end end addEventHandler("onClientPlayerQuit", root, playerQuit) function updateBlipColor(player) local attach = getElementAttachedTo(player) if ( attach ) then local r,g,b = getTeamColor(getPlayerTeam(player)) setBlipColor(blip, r,g,b, 255) end end setTimer(updateBlipColor, 1000, 0) Link to comment
Lloyd Logan Posted January 29, 2013 Share Posted January 29, 2013 super fail not see blips Stop saying fail, the blips could not be showing because of one wrong letter in the script. 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