Jump to content

Function

Members
  • Posts

    38
  • Joined

  • Last visited

Everything posted by Function

  1. Can you edit my script correctly as you mean please
  2. I think you can use "onPlayerJoin" for this
  3. function setTeamColor() for _,player in ipairs(getElementsByType("player")) do for _,blip in ipairs(getElementsByType("blip")) do local team = getPlayerTeam(player) local r,g,b = getTeamColor(team) if (team) then setPlayerNametagColor(player,r,g,b) setBlipColor(blip,r,g,b,255) end end end end setTimer(setTeamColor,50,0) function setRandomColor() for _,player in ipairs(getElementsByType("player")) do for _,blip in ipairs(getElementsByType("blip")) do local team = getPlayerTeam(player) local r,g,b = math.random(255),math.random(255),math.random(255) if not (team) then setPlayerNametagColor(player,r,g,b) setBlipColor(blip,r,g,b,255) end end end end setTimer(setRandomColor,50,0) Hi Guys, I have created a teamcolor script and it works very well when I enter into a team I get the color of the team in my name and blip. But when I leave the team, the colors from my name and blip change all the time to random colors. I want to change it only once to a random color not all the time. I think it is because the setTimer(setRandomColor,50,0) Please can anyone help me ?
  4. Function

    Hud help

    function drawHud() local screenW,screenH = guiGetScreenSize() local time = getRealTime() local hour = time.hour local minute = time.minute local health = getElementHealth(localPlayer) local armor = getPedArmor(localPlayer) local oxygen = getPedOxygenLevel(localPlayer) local weapon = getPedWeapon(localPlayer) local weaponname = getWeaponNameFromID(weapon) local currentammo = getPedAmmoInClip(localPlayer) local maxammo = getPedTotalAmmo(localPlayer)-(currentammo) local vehicle = getPedOccupiedVehicle(localPlayer) setPlayerHudComponentVisible("clock",false) setPlayerHudComponentVisible("armour",false) setPlayerHudComponentVisible("breath",false) setPlayerHudComponentVisible("health",false) setPlayerHudComponentVisible("money",false) setPlayerHudComponentVisible("wanted",false) setPlayerHudComponentVisible("weapon",false) setPlayerHudComponentVisible("ammo",false) dxDrawRectangle(screenW * 0.8631 - 3, screenH * 0.0644 - 3, screenW * 0.1175 + 6, screenH * 0.0256 + 6, tocolor(0, 0, 0, 255), false) dxDrawRectangle(screenW * 0.8631, screenH * 0.0644, screenW * 0.1175, screenH * 0.0256, tocolor(222, 0, 0, 100), false) dxDrawRectangle(screenW * 0.8631, screenH * 0.0644, screenW * 0.1175/100*health, screenH * 0.0256, tocolor(222, 0, 0, 255), false) dxDrawRectangle(screenW * 0.8631 - 3, screenH * 0.1011 - 3, screenW * 0.1175 + 6, screenH * 0.0256 + 6, tocolor(0, 0, 0, 255), false) dxDrawRectangle(screenW * 0.8631, screenH * 0.1011, screenW * 0.1175, screenH * 0.0256, tocolor(122, 122, 122, 100), false) dxDrawRectangle(screenW * 0.8631, screenH * 0.1011, screenW * 0.1175/100*armor, screenH * 0.0256, tocolor(122, 122, 122, 255), false) dxDrawText(hour..":"..minute.."", screenW * 0.8631 + 2, screenH * 0.0278 + 2, screenW * 0.9806, screenH * 0.0533, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(hour..":"..minute.."", screenW * 0.8631, screenH * 0.0278, screenW * 0.9806, screenH * 0.0533, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(math.floor(health).."%", screenW * 0.8631 + 2, screenH * 0.0644 + 2, screenW * 0.9806, screenH * 0.0900, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(math.floor(health).."%", screenW * 0.8631, screenH * 0.0644, screenW * 0.9806, screenH * 0.0900, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(math.floor(armor).."%", screenW * 0.8631 + 2, screenH * 0.1011 + 2, screenW * 0.9806, screenH * 0.1267, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(math.floor(armor).."%", screenW * 0.8631, screenH * 0.1011, screenW * 0.9806, screenH * 0.1267, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) if (isElementInWater(localPlayer)) or (isElementInWater(vehicle)) then dxDrawRectangle(screenW * 0.8631 - 3, screenH * 0.1378 - 3, screenW * 0.1175 + 6, screenH * 0.0256 + 6, tocolor(0, 0, 0, 255), false) dxDrawRectangle(screenW * 0.8631, screenH * 0.1378, screenW * 0.1175, screenH * 0.0256, tocolor(222, 222, 0, 100), false) dxDrawRectangle(screenW * 0.8631, screenH * 0.1378, screenW * 0.1175/1000*oxygen, screenH * 0.0256, tocolor(222, 222, 0, 255), false) dxDrawText(math.floor(oxygen).."%", screenW * 0.8631 + 2, screenH * 0.1378 + 2, screenW * 0.9806, screenH * 0.1633, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(math.floor(oxygen).."%", screenW * 0.8631, screenH * 0.1378, screenW * 0.9806, screenH * 0.1633, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(weaponname.." | "..currentammo.."/"..maxammo, screenW * 0.8631 + 2, screenH * 0.1744 + 2, screenW * 0.9806, screenH * 0.2000, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(weaponname.." | "..currentammo.."/"..maxammo, screenW * 0.8631, screenH * 0.1744, screenW * 0.9806, screenH * 0.2000, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) else dxDrawText(weaponname.." | "..currentammo.."/"..maxammo, screenW * 0.8631 + 2, screenH * 0.1744 + 2, screenW * 0.9806, screenH * 0.1300, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(weaponname.." | "..currentammo.."/"..maxammo, screenW * 0.8631, screenH * 0.1744, screenW * 0.9806, screenH * 0.1300, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) end end addEventHandler("onClientRender",root,drawHud) function deleteHud() setPlayerHudComponentVisible("clock",true) setPlayerHudComponentVisible("armour",true) setPlayerHudComponentVisible("breath",true) setPlayerHudComponentVisible("health",true) setPlayerHudComponentVisible("money",true) setPlayerHudComponentVisible("wanted",true) setPlayerHudComponentVisible("weapon",true) setPlayerHudComponentVisible("ammo",true) end addEventHandler("onClientResourceStop",root,deleteHud) Hey guys i need your help, I have created a hud but it does not work as it should. If i set my health or stamina stat to something like "1000" then it looks so, see the pictures here: (default stats)-http://imgur.com/a/Gm9z2 (custom stats)-http://imgur.com/a/sNBHl
  5. Only now i noticed that the script wrong, I forgot to use: "getTeamName" and "getTeamFromName" ....
  6. Yes, even if they join I do not want to create a blip, i want to get the existing blip from the player. Such as "getPlayerBlip" even if this does not exist...
  7. I know how to get the team color in the name the only problem is how can I get the blip from the player? local teamcolor = getTeamColor(team) setBlipColor(?,teamcolor) Do you know what i mean bra?
  8. addEventHandler("onPlayerQuit",getRootElement(), function() local team = getPlayerTeam(source) local account = getPlayerAccount(source) if (account) then setAccountData(source,"playerteam",team) end end) addEventHandler("onPlayerLogin",getRootElement(), function() local team = getAccountData(account,"playerteam") local account = getPlayerAccount(source) if (team) then setPlayerTeam(source,team) end end) addEventHandler("onPlayerLogout",getRootElement(), function() setPlayerTeam(source,nil) end) Please can anyone tell me how I can set the name and blip color in team color?
  9. Can you explain it better please, I think I need to start with a new function right?
  10. Can you explain it better please, I think I need to start with a new function right?
  11. Please guys how can I destroy a weapon when a player is on nodm mode and tries to set a weapon. function noDeathmatch(thePlayer) if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) setPlayerHudComponentVisible(thePlayer,"weapon",true) setPlayerHudComponentVisible(thePlayer,"ammo",true) toggleControl(thePlayer,"next_weapon",true) toggleControl(thePlayer,"previous_weapon",true) toggleControl(thePlayer,"fire",true) toggleControl(thePlayer,"aim_weapon",true) toggleControl(thePlayer,"vehicle_fire",true) toggleControl(thePlayer,"vehicle_secondary_fire",true) outputChatBox("#ffffff[DEATHMATCH] #ff6464You have disabled the no deathmatch mode.",thePlayer,255,255,255,true) else setElementData(thePlayer,"invincible",true) setElementHealth(thePlayer,1000) setPedArmor(thePlayer,100) setPedWeaponSlot(thePlayer,0) setPlayerHudComponentVisible(thePlayer,"weapon",false) setPlayerHudComponentVisible(thePlayer,"ammo",false) toggleControl(thePlayer,"next_weapon",false) toggleControl(thePlayer,"previous_weapon",false) toggleControl(thePlayer,"fire",false) toggleControl(thePlayer,"aim_weapon",false) toggleControl(thePlayer,"vehicle_fire",false) toggleControl(thePlayer,"vehicle_secondary_fire",false) outputChatBox("#ffffff[DEATHMATCH] #ff6464You have enabled the no deathmatch mode.",thePlayer,255,255,255,true) end end addCommandHandler("nodm",noDeathmatch)
×
×
  • Create New...