Search the Community
Showing results for tags 'progamando'.
-
eu queria fazer com que quando o player saia do carro de sedex ele tenha 10 segundos para voltar senao o carro despawnaria entao poderia me ajudar com isso
-
Boa noite, eu estudei um pouco na wiki e fiz um script de bar, assim, o script do bar não fui eu que fiz, apenas coloquei um painel e alguns sistemas, talvez eu venda + talvez não porque fiz outro parecido só que de limpar ficha e ficou mais exclusivo.. assim vamos lá, primeiramente são 4 bares, com o interior 11, assim que entra ne qualquer um deles, tem o ped, em cima do ped coloquei um dxDrawText mandando o player pressionar a letra "M" para abrir o cursor que é a função com nome de "Nametag", e depois clicar no ped para abrir o painel menu para compra a bebida que ele deseja, mas após abrir clicar no ped e o painel menu ter aberto, a função "Nametag" ( A que manda o player pressionar a letra M e clicar no ped, ou seja o texto continua no ped mesmo com o painel-menu aberto ), e também não seta o walkingStyle.. voces poderiam me informar o erro e como resolve-lo ? c.lua --[[ ################################################ # # # RESOURCE DESENVOLVIDO por: # # < #Horus > # # # # # ################################################ ]] local ped = createPed(240, 497.283, -77.876, 998.765, 0) local ped2 = createPed(240, 497.283, -77.876, 998.765, 0) local ped3 = createPed(240, 497.283, -77.876, 998.765, 0) local ped4 = createPed(240, 497.283, -77.876, 998.765, 0) setElementInterior(ped, 11) setElementDimension(ped, 1) setElementFrozen(ped, true) setElementInterior(ped2, 11) setElementDimension(ped2, 2) setElementFrozen(ped2, true) setElementInterior(ped3, 11) setElementDimension(ped3, 3) setElementFrozen(ped3, true) setElementInterior(ped4, 11) setElementDimension(ped4, 4) setElementFrozen(ped4, true) local dxfont0_fonte = dxCreateFont("font/fonte.ttf", 10) local screenW, screenH = guiGetScreenSize() local resW, resH = 1360,768 local x, y = (screenW/resW), (screenH/resH) function setBlur(state) setElementData(localPlayer, "showBlur", state) end function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end function dxDrawLinedRectangle( x, y, width, height, color, _width, postGUI ) _width = _width or 1 dxDrawLine ( x, y, x+width, y, color, _width, postGUI ) -- Top dxDrawLine ( x, y, x, y+height, color, _width, postGUI ) -- Left dxDrawLine ( x, y+height, x+width, y+height, color, _width, postGUI ) -- Bottom return dxDrawLine ( x+width, y, x+width, y+height, color, _width, postGUI ) -- Right end function cancelPedDamage(attacker) cancelEvent() end addEventHandler("onClientPedDamage", ped, cancelPedDamage) addEventHandler("onClientPedDamage", ped2, cancelPedDamage) addEventHandler("onClientPedDamage", ped3, cancelPedDamage) addEventHandler("onClientPedDamage", ped4, cancelPedDamage) function drawDrinks() tocolor1 = tocolor(0, 0, 0, 150) if isCursorOnElement(screenW * 0.3257, screenH * 0.4115, screenW * 0.3272, screenH * 0.0469) then -- CATUABA tocolor1 = tocolor(16, 102, 231, 100) end tocolor2 = tocolor(0, 0, 0, 150) if isCursorOnElement(screenW * 0.3257, screenH * 0.4583, screenW * 0.3272, screenH * 0.0469) then -- VODCA tocolor2 = tocolor(16, 102, 231, 100) end tocolor3 = tocolor(0, 0, 0, 150) if isCursorOnElement(screenW * 0.3257, screenH * 0.5052, screenW * 0.3272, screenH * 0.0469) then -- CERVEJA tocolor3 = tocolor(16, 102, 231, 100) end tocolorF = tocolor(217, 0, 5, 0) if isCursorOnElement(screenW * 0.6426, screenH * 0.3490, screenW * 0.0221, screenH * 0.0417) then -- CLOSE tocolorF = tocolor(217, 0, 5, 150) end -- ################# BACKGROUND ################# dxDrawRectangle(screenW * 0.3140, screenH * 0.3490, screenW * 0.3507, screenH * 0.3997, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.3140, screenH * 0.3490, screenW * 0.3507, screenH * 0.0417, tocolor(0, 0, 0, 150), false) -- ################# BUTTONS ################# dxDrawRectangle(screenW * 0.3257, screenH * 0.4115, screenW * 0.3272, screenH * 0.0469, tocolor1, false) -- CATUABA dxDrawRectangle(screenW * 0.3257, screenH * 0.4583, screenW * 0.3272, screenH * 0.0469, tocolor2, false) -- VODCA dxDrawRectangle(screenW * 0.3257, screenH * 0.5052, screenW * 0.3272, screenH * 0.0469, tocolor3, false) -- CERVEJA dxDrawRectangle(screenW * 0.6426, screenH * 0.3490, screenW * 0.0221, screenH * 0.0417, tocolorF, false) -- CLOSE -- ################# IMAGENS ################# dxDrawImage(screenW * 0.3287, screenH * 0.4180, screenW * 0.0191, screenH * 0.0352, "", 0, 0, 0, tocolor(255, 255, 255, 217), false) dxDrawImage(screenW * 0.3287, screenH * 0.5573, screenW * 0.0191, screenH * 0.0339, "", 0, 0, 0, tocolor(255, 255, 255, 217), false) dxDrawImage(screenW * 0.3257, screenH * 0.6458, screenW * 0.0265, screenH * 0.0430, "", 0, 0, 0, tocolor(254, 254, 254, 205), false) dxDrawImage(screenW * 0.3287, screenH * 0.4661, screenW * 0.0191, screenH * 0.0352, "", 0, 0, 0, tocolor(255, 255, 255, 217), false) dxDrawImage(screenW * 0.3287, screenH * 0.5143, screenW * 0.0191, screenH * 0.0352, "", 0, 0, 0, tocolor(255, 255, 255, 217), false) dxDrawImage(screenW * 0.3287, screenH * 0.6042, screenW * 0.0191, screenH * 0.0339, "", 0, 0, 0, tocolor(255, 255, 255, 217), false) -- ################# TEXTOS ################# dxDrawText("Bar Passa Tempo - MENU", screenW * 0.4280, screenH * 0.3600, screenW * 0.4324, screenH * 0.3984, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("X", screenW * 0.6500, screenH * 0.3555, screenW * 0.7610, screenH * 0.3984, tocolor(255, 255, 255, 202), 1.30, "default-bold", "left", "top", false, false, false, true, false) dxDrawText("Catuaba", screenW * 0.3522, screenH * 0.4232, screenW * 0.4632, screenH * 0.4661, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("Vodca", screenW * 0.3522, screenH * 0.4714, screenW * 0.4632, screenH * 0.5143, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("Cerveja", screenW * 0.3522, screenH * 0.5183, screenW * 0.4632, screenH * 0.5573, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("#FF0000R$ #FFFFFF200", screenW * 0.6044, screenH * 0.4245, screenW * 0.7154, screenH * 0.4674, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("#FF0000R$ #FFFFFF150", screenW * 0.6044, screenH * 0.4674, screenW * 0.7154, screenH * 0.5104, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("#FF0000R$ #FFFFFF100", screenW * 0.6044, screenH * 0.5182, screenW * 0.7154, screenH * 0.5612, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("Selecione uma bebida abaixo:", screenW * 0.4350, screenH * 0.3898, screenW * 0.4324, screenH * 0.7487, tocolor(255, 255, 255, 202), 0.8, dxfont0_fonte, "left", "top", false, false, false, true, false) end function render() local screenx, screeny, worldx, worldy, worldz = getCursorPosition() local px, py, pz = getCameraMatrix() local hit, x, y, z, elementHit = processLineOfSight ( px, py, pz, worldx, worldy, worldz ) local tx, ty, tz = getElementPosition(localPlayer) local rx, ry, rz = getElementPosition(ped) local distancia = getDistanceBetweenPoints3D(tx, ty, tz, rx, ry, rz) if not isEventHandlerAdded("onClientRender", root, drawDrink) then if (distancia < 5) then if hit then if elementHit == ped then addEventHandler("onClientRender", root, drawDrinks) showCursor(true) showChat(false) setElementData(localPlayer, "showBlur", true) end if elementHit == ped2 then addEventHandler("onClientRender", root, drawDrinks) showCursor(true) showChat(false) setElementData(localPlayer, "showBlur", true) end if elementHit == ped3 then addEventHandler("onClientRender", root, drawDrinks) showCursor(true) showChat(false) setElementData(localPlayer, "showBlur", true) end if elementHit == ped4 then addEventHandler("onClientRender", root, drawDrinks) showCursor(true) showChat(false) setElementData(localPlayer, "showBlur", true) end end end end end addEventHandler("onClientClick", root, render) local rootElement = getRootElement() local screenWidth, screenHeight = guiGetScreenSize() local maxrange = 9 function Nametag() local pedX, pedY, pedZ = getElementPosition(ped) local sx, sy = getScreenFromWorldPosition (pedX,pedY,pedZ +1) local cameraX, cameraY, cameraZ = getCameraMatrix() if sx then if getDistanceBetweenPoints3D(cameraX,cameraY,cameraZ,pedX,pedY,pedZ) <= maxrange then if not getElementData(localPlayer, "showBlur") then dxDrawRectangle(sx - x*110,sy + y*57, screenW * 0.2514, screenH * 0.0630, tocolor(0, 0, 0, 165), false) dxDrawText("Garçom - Bebidas e Diversão;",sx - 25 ,sy + 60,screenWidth, screenHeight,tocolor ( 255, 255, 255, 230 ), 0.9,dxfont0_fonte) dxDrawText('Pressione #FF0000"M" #FFFFFFe clique no garçom para abrir o menu!',sx - 100,sy + 80,screenWidth, screenHeight,tocolor ( 255, 255, 255, 230 ), 0.8,dxfont0_fonte, "left", "top", false, false, false, true, false) end end end end addEventHandler("onClientRender",rootElement, Nametag) function closePanel(_,state) if isEventHandlerAdded("onClientRender", root, drawDrinks) then if state == "down" then if isCursorOnElement(screenW * 0.6426, screenH * 0.3490, screenW * 0.0221, screenH * 0.0417) then showCursor(false) showChat(true) playSound("sfx/hit.mp3", false) removeEventHandler("onClientRender", root, drawDrinks) setElementData(localPlayer, "showBlur", false) end end end end addEventHandler("onClientClick", root, closePanel) function Catuaba(_,state) if isEventHandlerAdded("onClientRender", root, drawDrinks) then if state == "down" then if isCursorOnElement(screenW * 0.3257, screenH * 0.4115, screenW * 0.3272, screenH * 0.0469) then setBlur(false) elseif (not isTimer(timerExpireDrinks)) then triggerServerEvent("server:onPlayerBuyDrinkBVS", resourceRoot, 200) else playSound("sfx/hit.mp3", false) outputChatBox("Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) removeEventHandler("onClientRender", root, drawDrinks) showCursor(false) end end end end addEventHandler("onClientClick", root, Catuaba) function Vodca(_,state) if isEventHandlerAdded("onClientRender", root, drawDrinks) then if state == "down" then if isCursorOnElement(screenW * 0.3257, screenH * 0.4583, screenW * 0.3272, screenH * 0.0469) then setBlur(false) elseif (not isTimer(timerExpireDrinks)) then triggerServerEvent("server:onPlayerBuyDrinkBVS", resourceRoot, 150) else playSound("sfx/hit.mp3", false) outputChatBox("Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) removeEventHandler("onClientRender", root, drawDrinks) showCursor(false) end end end end addEventHandler("onClientClick", root, Vodca) function Cerveja(_,state) if isEventHandlerAdded("onClientRender", root, drawDrinks) then if state == "down" then if isCursorOnElement(screenW * 0.3257, screenH * 0.5052, screenW * 0.3272, screenH * 0.0469) then setBlur(false) elseif (not isTimer(timerExpireDrinks)) then triggerServerEvent("server:onPlayerBuyDrinkBVS", resourceRoot, 100) else playSound("sfx/hit.mp3", false) outputChatBox("Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) removeEventHandler("onClientRender", root, drawDrinks) showCursor(false) end end end end addEventHandler("onClientClick", root, Cerveja) function currentEffectDrinks() ---------------------------------------------------------- timerControlDrinks = setTimer(function() setPedControlState(localPlayer, "walk", true) end, 100, 0) setWindVelocity(100, 100, 0) setCameraShakeLevel(255) ---------------------------------------------------------- timerExpireDrinks = setTimer(function() ---------------------------------------------------------- resetWindVelocity() setCameraShakeLevel(1) if isTimer(timerControlDrinks) then killTimer(timerControlDrinks) end setPedControlState(localPlayer, "walk", false) outputChatBox("O efeito da bebida acabou.", 0, 255, 0) triggerServerEvent("resetWalkingStyle",resourceRoot) ---------------------------------------------------------- end, math.random(40000, 60000), 1) end addEvent("client:currentEffectDrinks", true) addEventHandler("client:currentEffectDrinks", resourceRoot, currentEffectDrinks) function isCursorOnElement( posX, posY, width, height ) if isCursorShowing( ) then local mouseX, mouseY = getCursorPosition( ) local clientW, clientH = guiGetScreenSize( ) local mouseX, mouseY = mouseX * clientW, mouseY * clientH if ( mouseX > posX and mouseX < ( posX + width ) and mouseY > posY and mouseY < ( posY + height ) ) then return true end end return false end s.lua local markersBarPositions = { {2348.547, -1372.678, 24.398, 501.900, -67.600, 999.700, 11, 1}, -- 1 {1000.592, -919.914, 42.328, 501.900, -67.600, 999.700, 11, 2}, -- 2 {2369.240, 1984.234, 10.820, 501.900, -67.600, 999.700, 11, 3}, -- 3 {-2432.25, -183.043, 35.312, 501.900, -67.600, 999.700, 11, 4}, -- 4 } local markersBarEnter = {} local markersBarExit = {} for i=1, #markersBarPositions do local xEnter, yEnter, zEnter, xExit, yExit, zExit, intEnter, dimEnter = unpack(markersBarPositions[i]) markersBarEnter[i] = createMarker(xEnter, yEnter, zEnter+1, "arrow", 1.5, 0, 16, 102, 231) local blip = createBlip(xEnter, yEnter, zEnter, 49) setBlipVisibleDistance(blip, 300) markersBarExit[i] = createMarker(xExit, yExit, zExit+0.1, "arrow", 1.5, 255, 0, 0, 255) setElementInterior(markersBarExit[i], intEnter, xExit, yExit, zExit-1) setElementDimension(markersBarExit[i], dimEnter) function enterBarBV:~(hitElement, matchingDimension) if (getElementType(hitElement) == "player") and (matchingDimension) then local vehicle = getPedOccupiedVehicle(hitElement) local playerAccount = getPlayerAccount(hitElement) if (not vehicle) then if (playerAccount) then if (not isGuestAccount(playerAccount)) then setElementInterior(hitElement, intEnter, xExit, yExit-2, zExit) setElementDimension(hitElement, dimEnter) setElementPosition(hitElement, xExit, yExit-2, zExit) setElementRotation(hitElement, 0, 0, 180) end end end end end addEventHandler("onMarkerHit", markersBarEnter[i], enterBarBV:~) function exitBarBV:~(hitElement, matchingDimension) if (getElementType(hitElement) == "player") and (matchingDimension) then setElementInterior(hitElement, 0, xEnter, yEnter-5, zEnter) setElementDimension(hitElement, 0) setElementPosition(hitElement, xEnter, yEnter-5, zEnter) end end addEventHandler("onMarkerHit", markersBarExit[i], exitBarBV:~) end function onPlayerBuyDrinkBVS(price) local money = getPlayerMoney(client) if (money >= price) then takePlayerMoney(client, price) local atualHealth = getElementHealth(client) setElementHealth(client, atualHealth + 20) playSound("sfx/hit.mp3", false) ----------------------------------------------------- setPedWalkingStyle(client, 126) triggerClientEvent(client, "client:currentEffectDrinks", resourceRoot) ----------------------------------------------------- outputChatBox("Drink comprado com sucesso.", client, 16, 102, 231) else playSound("sfx/hit.mp3", false) outputChatBox("Você não possui dinheiro suficiente.", client, 255, 0, 0) end end addEvent("server:onPlayerBuyDrinkBVS", true) addEventHandler("server:onPlayerBuyDrinkBVS", resourceRoot, onPlayerBuyDrinkBVS) function resetWalkingStyle() setPedWalkingStyle(client, 0) end addEvent("resetWalkingStyle", true) addEventHandler("resetWalkingStyle", resourceRoot, resetWalkingStyle)