Jump to content

DNL291

Retired Staff
  • Posts

    3,875
  • Joined

  • Days Won

    67

Everything posted by DNL291

  1. Tente isto: local basepfs addEventHandler( "onResourceStart", resourceRoot, function() basepfs = createMarker(238.66330, 140.54947, 1003.02344, 'cylinder', 1.0, 255, 0, 0, 150) setElementInterior ( basepfs, 3 ) end ) function sairBasePFFunc(hitPlayer) if getElementType(hitPlayer) == "player" then outputChatBox("[sERVER] Você entrou na HQ da Polícia Federal", hitPlayer, 0, 255, 0) --setElementPosition (hitPlayer, 238.65007, 140.62941, 1003.02344) --setElementInterior (hitPlayer, 0) end end addEventHandler( "onMarkerHit", basepfs, sairBasePFFunc ) addCommandHandler( "sairbasepf", function (psource) if isElementWithinMarker(psource, basepfs) then outputChatBox("[sERVER] Você saiu da HQ da Polícia Federal", psource, 0, 255, 0) setElementPosition (psource, 238.65007, 140.62941, 1003.02344) setElementInterior (psource, 0) else outputChatBox("[ERRO] Você não está no marker", psource, 250, 128, 114) end end, false, false ) Pelo que percebi, você quer fazer um comando para que o jogador saia do interior, certo? Porque seu código deu a entender isso. Além disso, você precisa editar a parte do teleporte para dentro do interior no código que passei.
  2. local adminList = { ["1C2F2D1B38C02ACAE922426CAFF701F3"] = true, ["BB324608511608C41E9D94A3D4E7F742"] = true } if adminList[getPlayerSerial(thePlayer)]then end I think that didn't understand what you want to do.
  3. Actually, he needs the maths part.
  4. That will draw many dx-lines on every render, is that what should be causing the problem with the performance. You can edit that code and see by yourself how many dx-lines are being drawn on every render.
  5. That's because dxDrawLine function is used several times. You have other alternatives to create that circle.
  6. Try this: function setPolice(policePlayer) local policeTeam = getTeamFromName("Police") local police = getPlayerName(policePlayer) setElementModel(policePlayer, 280) giveWeapon(policePlayer, 3) setPedWeaponSlot (policePlayer, 1) setElementPosition (policePlayer, -1626, 675, 7.1875) setPlayerTeam(policePlayer, policeTeam) outputChatBox("" .. police .. " on nyt Poliisi!", getRootElement(), 255, 255, 0) end addCommandHandler("police", setPolice)
  7. DNL291

    .

    What do you mean by 'characters'? I also realized that there are two functions called: timerReady. I see no more errors besides those, but I haven't tested that code though.
  8. DNL291

    .

    addEventHandler( "onMarkerLeave", hitMarker2) Was missing the 3rd argument which is the function.
  9. It has a typo at line 6 ('dinLocal' and 'dinRoot').
  10. Increasing a number using a string obviously it will not work.
  11. DNL291

    GUI Tooltips

    addEventHandler( "onClientResourceStart", resourceRoot, function() -- Create(x, y, text, foregroundColor, backgroundColor) local BGColor = tocolor(140, 140, 240) local FGColor = tocolor(0, 0, 0) tip = Create(200, 350, "Your tooltip text here", FGColor, BGColor) FadeIn(tip) -- Show the tip end )
  12. DNL291

    I need help

    function onChat(player, _, ...) local name = getPlayerName(player) local message = table.concat({...}," ") local team = getPlayerTeam(player) local r,g,b if team then r,g,b = getTeamColor(team) end if not r then r,g,b = getPlayerNametagColor(player) end local hexColor = string.format("#%.2X%.2X%.2X", r, g, b) outputChatBox(hexColor..""..name..":".."#FFFFFF"..message, player, 220, 220, 220, true) end
  13. DNL291

    I need help

    Try this: addEventHandler("onPlayerLogin", getRootElement(), function() bindKey(source, "x", "down", "genal","chatbox", "global") end) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do if isGuestAccount(getPlayerAccount(player)) then outputChatBox("You must be login to speak in chat!", player, 255, 0, 0) else bindKey(player, "x", "down", "genal", "chatbox", "global") end end end) function onChat(player, ...) local name = getPlayerName(player) local team = getPlayerTeam(player) local message = table.concat({...}," ") local r, g, b if team then r, g, b = getTeamColor(team) end if not r then r, g, b = getPlayerNametagColor(player) end local hexColor = string.format("#%.2X%.2X%.2X", r, g, b) outputChatBox(hexColor..name..": #FFFFFF"..message, player, 220, 220, 220, true) end addCommandHandler("genal", onChat)
  14. DNL291

    I need help

    addEventHandler("onResourceStart", resourceRoot, function() for index,player in pairs(getElementsByType("player")) do if isGuestAccount(getPlayerAccount(player)) then outputChatBox("You must be login to speak in chat!", player, 255, 0, 0) else bindKey(player, "x", "down", "genal" ,"chatbox", "global") end end end)
  15. Use a variable with the value of the first table index and increase it (+ 1) when the player hits the marker. And use that variable to get the next location, like: local x, y, z = unpack(stops[currentIndex]) 'currentIndex' must have the index which is the value of the next location.
  16. function getPlayersWithWantedLevel(level) if type(level) == "number" then local total = 0 for _,player in ipairs(getElementsByType("player")) do if getPlayerWantedLevel(player) == level then total = total + 1 end end return total end return false end e.g: outputChatBox( getPlayersWithWantedLevel(3) ) Is that what do you mean?
  17. DNL291

    Help

    Change encoding to: UTF-8 without BOM.
  18. XeroxMTA: Use this code and edit it the way you want, don't know if it's without bugs because I haven't tested. local dxButtons = {} local state = false addEventHandler( "onClientResourceStart", resourceRoot, function() dxButtons.acceptX, dxButtons.acceptY = 0, 0 -- dx-button pos dxButtons.acceptW, dxButtons.acceptH = 0, 0 -- dxButtons.cancelX, dxButtons.cancelY = 0, 0 dxButtons.cancelW, dxButtons.cancelH = 0, 0 addEventHandler("onClientClick", root, onClick) end ) addCommandHandler( "togglebuttons", function() _G[ (state and "add" or "remove").."EventHandler" ]( "onClientRender", root, drawDXButtons ) showCursor( state ) state = not state end ) function drawDXButtons() dxDrawRectangle(dxButtons.acceptX, dxButtons.acceptY, dxButtons.acceptW, dxButtons.acceptH, tocolor(0, 0, 0, 190)) dxDrawRectangle(dxButtons.cancelX, dxButtons.cancelY, dxButtons.cancelW, dxButtons.cancelH, tocolor(0, 0, 0, 190)) end addEvent( "onDXButtonClick" ) function onClick(button, state) if (button == "left") and (state == "up") then if isMouseWithinDxButton("accept") then triggerEvent("onDXButtonClick", resourceRoot, "accept") elseif isMouseWithinDxButton("cancel") then triggerEvent("onDXButtonClick", resourceRoot, "cancel") end end end addEventHandler( "onDXButtonClick", root function (buttonName) if buttonName == "accept" then -- elseif buttonName == "cancel" then -- end end ) function isMouseWithinDxButton(dxButtonName) if not dxButtonName then return false end if (dxButtonName == "accept") then return isMouseWithinRangeOf(dxButtons.acceptX, dxButtons.acceptW, dxButtons.acceptY, dxButtons.acceptH) elseif (dxButtonName == "cancel") then return isMouseWithinRangeOf(dxButtons.cancelX, dxButtons.cancelW, dxButtons.cancelY, dxButtons.cancelH) end return false end function isMouseWithinRangeOf(psx,pssx,psy,pssy) if not isCursorShowing() then return false end local cx,cy = getCursorPosition() local screenX, screenY = guiGetScreenSize() cx,cy = cx*screenX,cy*screenY if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then return true end return false end
  19. DNL291

    Help

    You're welcome.
  20. DNL291

    Help

    function dxDrawBorderedText(text, left, top, right, bottom, color, scale, outlinesize, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded) outlinesize = math.min(scale, outlinesize) if outlinesize > 0 then for offsetX=-outlinesize,outlinesize,outlinesize do for offsetY=-outlinesize,outlinesize,outlinesize do if not (offsetX == 0 and offsetY == 0) then dxDrawText(text:gsub("#%x%x%x%x%x%x",""), left+offsetX, top+offsetY, right+offsetX, bottom+offsetY, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, postGUI) end end end end dxDrawText(text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded) end Try it. dxDrawBorderedText(Text, x*150, y*540, x*1400, y*385, tocolor(255, 255, 255, 255), 1, 1, "clear", "center", "center", false, false, true, true) Just edit the arguments: scale and the size of the border, if it's nedded.
  21. Try this: addEvent("goLos", true) addEventHandler("goLos", root, function() if getPlayerMoney(source) >= 500 then takePlayerMoney(source, 500) fadeCamera ( source, false, 2.0, 0, 0, 0 ) setTimer ( fadeCameraDelayed, 3000, 1, source ) setTimer(theAir, 2000, 1, source) setTimer( function (source) if getElementInterior(source) == 1 then fadeCamera ( source, false, 2.0, 0, 0, 0 ) setTimer ( fadeCameraDelayed, 3000, 1, source ) setTimer(SpawLos, 2500, 1, source) end end, 30000, 1, source) end end )
  22. No need to use that event anyway, since toggleControl function works fine and this topic is already solved.
×
×
  • Create New...