SkillZNT Posted January 14, 2020 Posted January 14, 2020 (edited) Eu tava modificando umas coisas aq mod de blitz e tipo o tapete de espinhos não estao furando mais os pneus dos carros ;( aqui pareçe ate que a barreira de espinhos está visual o resto dos objetos estão funcionando perfeitamente O objeto e stinger groupeName = "Blitz" function dxMsg(source, text, type) exports.dxmessages:outputDx(source, text, type) end function openRender(source) local accName = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user."..accName, aclGetGroup("BOPE")) or isObjectInACLGroup("user."..accName, aclGetGroup("PMRJ")) then triggerClientEvent(source, "renderBlitz", root) end end addCommandHandler("blitz", openRender) function createCone() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(1237, x, y, z - 1.2) end addEvent("createCone",true) addEventHandler("createCone", root, createCone) function createBarrier() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(1228, x, y, z - 0.6, 0, 0, rz + 90) end addEvent("createBarrier",true) addEventHandler("createBarrier", root, createBarrier) function createStinger() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(2899, x, y, z - 0.9, 0, 0, rz + 90) end addEvent("createStinger",true) addEventHandler("createStinger", root, createStinger) function createBarrier2() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(1427, x, y, z - 0.6) end addEvent("createBarrier2",true) addEventHandler("createBarrier2", root, createBarrier2) function destroyBlitz() restartResource(getThisResource()) end addEvent("destroyBlitz",true) addEventHandler("destroyBlitz", root, destroyBlitz) Edited January 14, 2020 by SkillZNT
Tommy. Posted January 14, 2020 Posted January 14, 2020 Cria um createColRectangle junto com o objeto e com o evento onClientColShapeHit você usa a função setVehicleWheelStates para furar os pneus. Parâmetros para furar o pneu: bool setVehicleWheelStates(vehicle theVehicle, 1, 1, 1, 1) DID I HELP YOU? ________________________________________________________________________ ム MY STEAM ________________________________________________________________________ MY SITE www.tommy.br.com
SkillZNT Posted January 14, 2020 Author Posted January 14, 2020 9 minutes ago, Tommy. said: Cria um createColRectangle junto com o objeto e com o evento onClientColShapeHit você usa a função setVehicleWheelStates para furar os pneus. Parâmetros para furar o pneu: bool setVehicleWheelStates(vehicle theVehicle, 1, 1, 1, 1) Não entendi muito bem
Tommy. Posted January 14, 2020 Posted January 14, 2020 1 minute ago, SkillZNT said: Não entendi muito bem Aonde cria o objeto Stinger, você cria junto uma colisão: createColRectangle Ai você abre uma nova função sendo chamada pelo o evento onClientColShapeHit (quando o cara passar pela a colisão) Dai nessa função você usa setVehicleWheelStates para furar os pneus. DID I HELP YOU? ________________________________________________________________________ ム MY STEAM ________________________________________________________________________ MY SITE www.tommy.br.com
SkillZNT Posted January 14, 2020 Author Posted January 14, 2020 5 minutes ago, Tommy. said: Aonde cria o objeto Stinger, você cria junto uma colisão: createColRectangle Ai você abre uma nova função sendo chamada pelo o evento onClientColShapeHit (quando o cara passar pela a colisão) Dai nessa função você usa setVehicleWheelStates para furar os pneus. Você consegue fazer pra mim e pq sou meio novato nessa area de linguagem Lua Se poder dar uma ajuda nessa kk obrigado! e pq to montando um servidor
Tommy. Posted January 14, 2020 Posted January 14, 2020 (edited) Vou fazer essa caridade pra você, kk groupeName = "Blitz" function dxMsg(source, text, type) exports.dxmessages:outputDx(source, text, type) end function openRender(source) local accName = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user."..accName, aclGetGroup("BOPE")) or isObjectInACLGroup("user."..accName, aclGetGroup("PMRJ")) then triggerClientEvent(source, "renderBlitz", root) end end addCommandHandler("blitz", openRender) function createCone() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(1237, x, y, z - 1.2) end addEvent("createCone",true) addEventHandler("createCone", root, createCone) function createBarrier() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(1228, x, y, z - 0.6, 0, 0, rz + 90) end addEvent("createBarrier",true) addEventHandler("createBarrier", root, createBarrier) colShape = {} function createStinger() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(2899, x, y, z - 0.9, 0, 0, rz + 90) colShape[source] = createColRectangle(x - 2, y - 2, 4.0, 4.0 ) end addEvent("createStinger",true) addEventHandler("createStinger", root, createStinger) addEventHandler( "onClientColShapeHit", resourceRoot, function(theElement, matchingDimension) if getElementType(theElement) == "vehicle" then setVehicleWheelStates(theElement, 1, 1, 1, 1) end end) function createBarrier2() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(1427, x, y, z - 0.6) end addEvent("createBarrier2",true) addEventHandler("createBarrier2", root, createBarrier2) function destroyBlitz() restartResource(getThisResource()) end addEvent("destroyBlitz",true) addEventHandler("destroyBlitz", root, destroyBlitz) EDIT: Não testei. Edited January 14, 2020 by Tommy. DID I HELP YOU? ________________________________________________________________________ ム MY STEAM ________________________________________________________________________ MY SITE www.tommy.br.com
SkillZNT Posted January 14, 2020 Author Posted January 14, 2020 6 minutes ago, Tommy. said: Vou fazer essa caridade pra você, kk groupeName = "Blitz"function dxMsg(source, text, type) exports.dxmessages:outputDx(source, text, type)end function openRender(source) local accName = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user."..accName, aclGetGroup("BOPE")) or isObjectInACLGroup("user."..accName, aclGetGroup("PMRJ")) then triggerClientEvent(source, "renderBlitz", root) endendaddCommandHandler("blitz", openRender)function createCone() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(1237, x, y, z - 1.2)end addEvent("createCone",true)addEventHandler("createCone", root, createCone)function createBarrier() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(1228, x, y, z - 0.6, 0, 0, rz + 90)end addEvent("createBarrier",true)addEventHandler("createBarrier", root, createBarrier)colShape = {}function createStinger() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(2899, x, y, z - 0.9, 0, 0, rz + 90) colShape[source] = createColRectangle(x - 2, y - 2, 4.0, 4.0 )end addEvent("createStinger",true)addEventHandler("createStinger", root, createStinger)addEventHandler( "onClientColShapeHit", resourceRoot, function(theElement, matchingDimension) if getElementType(theElement) == "vehicle" then setVehicleWheelStates(theElement, 1, 1, 1, 1) endend)function createBarrier2() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(1427, x, y, z - 0.6)end addEvent("createBarrier2",true)addEventHandler("createBarrier2", root, createBarrier2)function destroyBlitz() restartResource(getThisResource())end addEvent("destroyBlitz",true)addEventHandler("destroyBlitz", root, destroyBlitz) EDIT: Não testei. kkk obrigado 21 minutes ago, Tommy. said: Vou fazer essa caridade pra você, kk groupeName = "Blitz" function dxMsg(source, text, type) exports.dxmessages:outputDx(source, text, type) end function openRender(source) local accName = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user."..accName, aclGetGroup("BOPE")) or isObjectInACLGroup("user."..accName, aclGetGroup("PMRJ")) then triggerClientEvent(source, "renderBlitz", root) end end addCommandHandler("blitz", openRender) function createCone() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(1237, x, y, z - 1.2) end addEvent("createCone",true) addEventHandler("createCone", root, createCone) function createBarrier() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(1228, x, y, z - 0.6, 0, 0, rz + 90) end addEvent("createBarrier",true) addEventHandler("createBarrier", root, createBarrier) colShape = {} function createStinger() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(2899, x, y, z - 0.9, 0, 0, rz + 90) colShape[source] = createColRectangle(x - 2, y - 2, 4.0, 4.0 ) end addEvent("createStinger",true) addEventHandler("createStinger", root, createStinger) addEventHandler( "onClientColShapeHit", resourceRoot, function(theElement, matchingDimension) if getElementType(theElement) == "vehicle" then setVehicleWheelStates(theElement, 1, 1, 1, 1) end end) function createBarrier2() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(1427, x, y, z - 0.6) end addEvent("createBarrier2",true) addEventHandler("createBarrier2", root, createBarrier2) function destroyBlitz() restartResource(getThisResource()) end addEvent("destroyBlitz",true) addEventHandler("destroyBlitz", root, destroyBlitz) EDIT: Não testei. Não foi acho pq tem um segunda arquivo dele q tem o stinger E mais ou menos um painelzinho se poder dar uma verificada kkkk 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 resetData() if getElementData(localPlayer, "creatingBarrier2") then setElementData(localPlayer, "creatingBarrier2", false) end if getElementData(localPlayer, "creatingBarrier") then setElementData(localPlayer, "creatingBarrier", false) end if getElementData(localPlayer, "creatingStinger") then setElementData(localPlayer, "creatingStinger", false) end if getElementData(localPlayer, "creatingCone") then setElementData(localPlayer, "creatingCone", false) end end addEventHandler("onClientResourceStart", resourceRoot, resetData) 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 menu() dxDrawRectangle(x*403, y*563, x*554, y*197, tocolor(0, 0, 0, 194), false) dxDrawRectangle(x*403, y*563, x*554, y*25, tocolor(0, 0, 0, 194), false) dxDrawText("Sistema de Blitz - #1066e7Minigun 2", x*408, y*567, x*535, y*598, tocolor(255, 255, 255, 208), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText('Pressione #1066e7"M"#FFFFFF, selecione um objeto abaixo, e depois pressione #1066e7"M"#FFFFFF novamente.', x*408, y*598, x*535, y*619, tocolor(255, 255, 255, 208), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText('Para criar o objeto selecionado utilize a tecla #1066e7"Space"#FFFFFF.', x*408, y*619, x*535, y*640, tocolor(255, 255, 255, 208), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawRectangle(x*413, y*650, x*226, y*25, isCursorOnElement(x*413, y*650, x*226, y*25) and tocolor(16, 102, 231, 100) or tocolor(0, 0, 0, 194), false) dxDrawRectangle(x*413, y*675, x*226, y*25, isCursorOnElement(x*413, y*675, x*226, y*25) and tocolor(16, 102, 231, 100) or tocolor(0, 0, 0, 194), false) dxDrawRectangle(x*413, y*700, x*226, y*25, isCursorOnElement(x*413, y*700, x*226, y*25) and tocolor(16, 102, 231, 100) or tocolor(0, 0, 0, 194), false) dxDrawRectangle(x*413, y*725, x*226, y*25, isCursorOnElement(x*413, y*725, x*226, y*25) and tocolor(16, 102, 231, 100) or tocolor(0, 0, 0, 194), false) dxDrawText("Cone ", x*418, y*654, x*545, y*675, tocolor(255, 255, 255, 208), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("Barreira", x*418, y*679, x*545, y*700, tocolor(255, 255, 255, 208), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("Tapete de pregos", x*418, y*704, x*545, y*725, tocolor(255, 255, 255, 208), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("Barreira (2)", x*418, y*729, x*526, y*729, tocolor(255, 255, 255, 208), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawLine(x*663, y*650, x*663, y*745, tocolor(254, 254, 254, 90), 1, false) dxDrawRectangle(x*677, y*715, x*260, y*30, isCursorOnElement(x*677, y*715, x*260, y*30) and tocolor(16, 102, 231, 100) or tocolor(0, 0, 0, 194), false) dxDrawText("Destruir Blitz", x*759, y*719, x*886, y*740, tocolor(255, 255, 255, 208), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("Para destruir a Blitz pressione o botão", x*677, y*650, x*804, y*671, tocolor(255, 255, 255, 208), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("#1066e7abaixo#FFFFFF.", x*677, y*671, x*804, y*692, tocolor(255, 255, 255, 208), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) if getElementData(localPlayer, "creatingCone") then dxDrawRectangle(x*413, y*650, x*3, y*25, tocolor(16, 102, 231, 160), false) end if getElementData(localPlayer, "creatingBarrier") then dxDrawRectangle(x*413, y*675, x*3, y*25, tocolor(16, 102, 231, 160), false) end if getElementData(localPlayer, "creatingStinger") then dxDrawRectangle(x*413, y*700, x*3, y*25, tocolor(16, 102, 231, 160), false) end if getElementData(localPlayer, "creatingBarrier2") then dxDrawRectangle(x*413, y*725, x*3, y*25, tocolor(16, 102, 231, 160), false) end end function render() if not isEventHandlerAdded("onClientRender", root, menu) then addEventHandler("onClientRender", root, menu) end end addEvent("renderBlitz", true) addEventHandler("renderBlitz", root, render) function closePanel() if isEventHandlerAdded("onClientRender", root, menu) then removeEventHandler("onClientRender", root, menu) end end addEvent("removeRenderBlitz", true) addEventHandler("removeRenderBlitz", root, render) function blitzButtons(_,state) if isEventHandlerAdded("onClientRender", root, menu) then if state == "down" then -- #CONE if isCursorOnElement(x*413, y*650, x*226, y*25) then if getElementData(localPlayer, "creatingBarrier2") then setElementData(localPlayer, "creatingBarrier2", false) end if getElementData(localPlayer, "creatingBarrier") then setElementData(localPlayer, "creatingBarrier", false) end if getElementData(localPlayer, "creatingStinger") then setElementData(localPlayer, "creatingStinger", false) end setElementData(localPlayer, "creatingCone", true) playSound("sfx/hit.mp3", false) end -- #createBarrier if isCursorOnElement(x*413, y*675, x*226, y*25) then if getElementData(localPlayer, "creatingBarrier2") then setElementData(localPlayer, "creatingBarrier2", false) end if getElementData(localPlayer, "creatingCone") then setElementData(localPlayer, "creatingCone", false) end if getElementData(localPlayer, "creatingStinger") then setElementData(localPlayer, "creatingStinger", false) end setElementData(localPlayer, "creatingBarrier", true) playSound("sfx/hit.mp3", false) end -- #createBarrier2 if isCursorOnElement(x*413, y*725, x*226, y*25) then if getElementData(localPlayer, "creatingBarrier") then setElementData(localPlayer, "creatingBarrier", false) end if getElementData(localPlayer, "creatingCone") then setElementData(localPlayer, "creatingCone", false) end if getElementData(localPlayer, "creatingStinger") then setElementData(localPlayer, "creatingStinger", false) end setElementData(localPlayer, "creatingBarrier2", true) playSound("sfx/hit.mp3", false) end -- #createStinger if isCursorOnElement(x*413, y*700, x*226, y*25) then if getElementData(localPlayer, "creatingBarrier2") then setElementData(localPlayer, "creatingBarrier2", false) end if getElementData(localPlayer, "creatingCone") then setElementData(localPlayer, "creatingCone", false) end if getElementData(localPlayer, "creatingBarrier") then setElementData(localPlayer, "creatingBarrier", false) end setElementData(localPlayer, "creatingStinger", true) playSound("sfx/hit.mp3", false) end if isCursorOnElement(x*677, y*715, x*260, y*30) then triggerServerEvent("destroyBlitz", localPlayer) playSound("sfx/hit.mp3", false) end end end end addEventHandler("onClientClick", root, blitzButtons) function createSelectedObject() if isEventHandlerAdded("onClientRender", root, menu) then if getElementData(localPlayer, "creatingCone") then triggerServerEvent("createCone", localPlayer) end if getElementData(localPlayer, "creatingBarrier") then triggerServerEvent("createBarrier", localPlayer) end if getElementData(localPlayer, "creatingBarrier2") then triggerServerEvent("createBarrier2", localPlayer) end if getElementData(localPlayer, "creatingStinger") then triggerServerEvent("createStinger", localPlayer) end end end bindKey("Space", "down", createSelectedObject) 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
Tommy. Posted January 14, 2020 Posted January 14, 2020 (edited) Ta na mão, rs groupeName = "Blitz" function dxMsg(source, text, type) exports.dxmessages:outputDx(source, text, type) end function openRender(source) local accName = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user."..accName, aclGetGroup("BOPE")) or isObjectInACLGroup("user."..accName, aclGetGroup("PMRJ")) then triggerClientEvent(source, "renderBlitz", root) end end addCommandHandler("blitz", openRender) function createCone() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(1237, x, y, z - 1.2) end addEvent("createCone",true) addEventHandler("createCone", root, createCone) function createBarrier() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(1228, x, y, z - 0.6, 0, 0, rz + 90) end addEvent("createBarrier",true) addEventHandler("createBarrier", root, createBarrier) colShape = { byObject = {} } function createStinger(source) local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(2899, x, y, z - 0.9, 0, 0, rz + 90) colShape.byObject["stinger"] = createColRectangle(x - 2, y - 2, 4.0, 4.0 ) end addEvent("createStinger",true) addEventHandler("createStinger", root, createStinger) addEventHandler("onElementColShapeHit", root, function(colShapeHit) if colShapeHit == colShape.byObject["stinger"] then if getElementType(source) == "vehicle" then setVehicleWheelStates(source, 1, 1, 1, 1) end end end) function createBarrier2() local rx, ry, rz = getElementRotation(source) local x, y, z = getElementPosition(source) createObject(1427, x, y, z - 0.6) end addEvent("createBarrier2",true) addEventHandler("createBarrier2", root, createBarrier2) function destroyBlitz() restartResource(getThisResource()) end addEvent("destroyBlitz",true) addEventHandler("destroyBlitz", root, destroyBlitz) EDIT: Testado. Edited January 14, 2020 by Tommy. DID I HELP YOU? ________________________________________________________________________ ム MY STEAM ________________________________________________________________________ MY SITE www.tommy.br.com
Moderators Lord Henry Posted January 15, 2020 Moderators Posted January 15, 2020 Olha, não recomendo que faça com createColRectangle. Pois não tem como criá-lo com ângulos Z diferentes de 0, 90, 180, 270. Sugiro criar com createColSphere, que funciona com qualquer ângulo. Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanks! Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment Discord Oficial do MTA: https://mtasa.com/discord Blacklist e Whitelist de Scripters: Planilha Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.
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