-
Posts
111 -
Joined
-
Last visited
-
Days Won
1
Everything posted by beast99
-
Voltando, agora ele está dizendo o seguinte: https://imgur.com/FwmS0BE Eu sei que tem a ver com o source, mas não consegui resolver denovo. Server Side: local Entrar = createMarker (1310.129, -1368.674, 13.552-1, "cylinder", 1.2, 20, 70, 230, 95 ) local EntradaBlip = createBlipAttachedTo ( Entrar, 23 ) setBlipVisibleDistance ( EntradaBlip, 150 ) local Sair = createMarker(285.418, -40.954, 1001.516-1.1, "cylinder", 1.2, 20, 70, 230, 95) setElementInterior ( Sair, 1 ) local Porte2 = createMarker(296.087, -38.088, 1001.516-1.1, "cylinder", 1.2, 20, 70, 230, 95) setElementInterior(Porte2, 1) thePed = createPed(120, 296.103, -40.216, 1001.516) setElementInterior ( thePed, 1 )-- Creates a ped function cancelPedDamage() cancelEvent() -- Cancels the onClientPedDamage event end addEventHandler("onClientPedDamage", thePed, cancelPedDamage) function onmarker(marker,md) if (md) then if marker == Entrar then setTimer ( setElementInterior, 400, 1, source, 1 ) setTimer ( setElementPosition, 400, 1, source, 286.067, -39.416, 1001.516 ) setTimer ( setElementRotation, 900, 1, source, 0, 0, 358 ) fadeCamera ( source, false, 0.1, 0, 0, 0 ) setTimer ( fadeCamera, 900, 1, source , true, 0.5 ) end if marker == Sair then setTimer ( setElementInterior, 400, 1, source, 0 ) setTimer ( setElementDimension, 400, 1, source, 0 ) setTimer ( setElementPosition, 400, 1, source, 1310.116, -1371.456, 13.589 ) setTimer ( setElementRotation, 900, 1, source, 0, 0, 177 ) fadeCamera ( source, false, 0.1, 0, 0, 0 ) setTimer ( fadeCamera, 900, 1, source , true, 0.5 ) end end end addEventHandler("onPlayerMarkerHit",getRootElement(),onmarker) --------------------------- CODE ------------------------------------ addEvent("porte", true) addEventHandler("porte", root, function(player) if getElementData(player, "Porte") == false then setElementData(player, "Porte", true) outputChatBox("#727272[Porte]#ff0000Voce adquiriu o porte de arma", source, 255, 255, 255, true) else outputChatBox("#727272[Porte]#ff0000Voce já tem um porte de arma", source, 255, 255, 255, true) end end ) Client Side: local screenW,screenH = guiGetScreenSize() local resW, resH = 1366,768 local x, y = (screenW/resW), (screenH/resH) local render = false local Porte = createMarker(296.087, -38.088, 1001.516-1.1, "cylinder", 1.2, 20, 70, 230, 95) setElementInterior(Porte, 1) function botoes() botonfechar = guiCreateButton(875, 152, 42, 37,"",false) guiSetAlpha(botonfechar,255) porte = guiCreateButton(418, 467, 240, 103,"",false) guiSetAlpha(porte,255) glock = guiCreateButton(668, 467, 240, 103,"",false) guiSetAlpha(glock,255) addEventHandler("onClientGUIClick", porte, function() triggerServerEvent ("porte",getLocalPlayer(), comprar) end) addEventHandler("onClientGUIClick", glock, function() triggerServerEvent ("comprarglock",getLocalPlayer(),comprarglock) end) addEventHandler ("onClientGUIClick", botonfechar, function() removeEventHandler ("onClientRender", root, panel) destroyElement (botonfechar) destroyElement (porte) destroyElement (glock) botonfechar = nil porte = nil glock = nil showCursor (false) end) end addEventHandler("onClientGUIClick", porte, function() triggerServerEvent ("porte",getLocalPlayer(),porte) end) addEventHandler("onClientGUIClick", glock, glockear) function glockear() triggerServerEvent ("comprarglock",getLocalPlayer(),comprarglock) end function panel() dxDrawRectangle(395, 155, 523, 436, tocolor(0, 0, 0, 126), false) dxDrawLine(395 - 1, 152 - 1, 395 - 1, 189, tocolor(79, 0, 0, 208), 1, false) dxDrawLine(395 - 1, 189, 918, 189, tocolor(79, 0, 0, 208), 1, false) dxDrawLine(918, 189, 918, 152 - 1, tocolor(79, 0, 0, 208), 1, false) dxDrawRectangle(395, 152, 523, 37, tocolor(0, 0, 0, 208), false) dxDrawText("PORTE DE ARMAS", 393, 148, 918, 189, tocolor(255, 255, 255, 255), 1.20, "sans", "center", "center", false, false, false, false, false) dxDrawRectangle(413, 199, 489, 245, tocolor(0, 0, 0, 69), false) dxDrawText("LEMBRANDO, O PORTE DE ARMAS APENAS COBRE A GLOCK, E PARA ADQUIRIR A MESMA, TÉRA QUE A COMPRAR, A GLOCK CUSTA 100K POR SER LEGAL.", 416, 197, 902, 444, tocolor(255, 255, 255, 255), 1.50, "default", "center", "center", false, true, false, false, false) dxDrawRectangle(875, 152, 42, 37, tocolor(0, 0, 0, 186), false) dxDrawText("ADQUIRIR PORTE", 418, 463, 658, 570, tocolor(255, 255, 255, 255), 2.00, "default", "center", "center", false, false, false, false, false) dxDrawText("ADQUIRIR GLOCK", 669, 465, 908, 570, tocolor(255, 255, 255, 255), 2.00, "default", "center", "center", false, false, false, false, false) dxDrawText("X", 876, 148, 916, 188, tocolor(255, 255, 255, 255), 1.30, "default", "center", "center", false, false, false, false, false) end function markerPanel (hitPlayer, matchingDimension) if (hitPlayer == localPlayer) then addEventHandler("onClientRender", root, panel) render = true showCursor(true) botoes() end end addEventHandler ("onClientMarkerHit", Porte, markerPanel)
-
https://imgur.com/wYjSRah esse é o que aparece, e eu não percebi o porquê..
-
Ai lord, cheguei em casa, fui testar, não funcionou, porque será? Client: local screenW,screenH = guiGetScreenSize() local resW, resH = 1366,768 local x, y = (screenW/resW), (screenH/resH) local render = false local Porte = createMarker(296.087, -38.088, 1001.516-1.1, "cylinder", 1.2, 20, 70, 230, 95) setElementInterior(Porte, 1) function botoes() botonfechar = guiCreateButton(875, 152, 42, 37,"",false) guiSetAlpha(botonfechar,255) porte = guiCreateButton(418, 467, 240, 103,"",false) guiSetAlpha(porte,255) glock = guiCreateButton(668, 467, 240, 103,"",false) guiSetAlpha(glock,255) addEventHandler ("onClientGUIClick", botonfechar, function() removeEventHandler ("onClientRender", root, panel) destroyElement (botonfechar) destroyElement (porte) destroyElement (glock) botonfechar = nil porte = nil glock = nil showCursor (false) end) end addEventHandler("onClientGUIClick", porte, function() triggerServerEvent ("porte",getLocalPlayer(),porte) end) addEventHandler("onClientGUIClick", glock, glockear) function glockear() triggerServerEvent ("comprarglock",getLocalPlayer(),comprarglock) end function panel() dxDrawRectangle(395, 155, 523, 436, tocolor(0, 0, 0, 126), false) dxDrawLine(395 - 1, 152 - 1, 395 - 1, 189, tocolor(79, 0, 0, 208), 1, false) dxDrawLine(395 - 1, 189, 918, 189, tocolor(79, 0, 0, 208), 1, false) dxDrawLine(918, 189, 918, 152 - 1, tocolor(79, 0, 0, 208), 1, false) dxDrawRectangle(395, 152, 523, 37, tocolor(0, 0, 0, 208), false) dxDrawText("PORTE DE ARMAS", 393, 148, 918, 189, tocolor(255, 255, 255, 255), 1.20, "sans", "center", "center", false, false, false, false, false) dxDrawRectangle(413, 199, 489, 245, tocolor(0, 0, 0, 69), false) dxDrawText("LEMBRANDO, O PORTE DE ARMAS APENAS COBRE A GLOCK, E PARA ADQUIRIR A MESMA, TÉRA QUE A COMPRAR, A GLOCK CUSTA 100K POR SER LEGAL.", 416, 197, 902, 444, tocolor(255, 255, 255, 255), 1.50, "default", "center", "center", false, true, false, false, false) dxDrawRectangle(875, 152, 42, 37, tocolor(0, 0, 0, 186), false) dxDrawText("ADQUIRIR PORTE", 418, 463, 658, 570, tocolor(255, 255, 255, 255), 2.00, "default", "center", "center", false, false, false, false, false) dxDrawText("ADQUIRIR GLOCK", 669, 465, 908, 570, tocolor(255, 255, 255, 255), 2.00, "default", "center", "center", false, false, false, false, false) dxDrawText("X", 876, 148, 916, 188, tocolor(255, 255, 255, 255), 1.30, "default", "center", "center", false, false, false, false, false) end function markerPanel (hitPlayer, matchingDimension) if (hitPlayer == localPlayer) then addEventHandler("onClientRender", root, panel) render = true showCursor(true) botoes() end end addEventHandler ("onClientMarkerHit", Porte, markerPanel) Server: local Entrar = createMarker (1310.129, -1368.674, 13.552-1, "cylinder", 1.2, 20, 70, 230, 95 ) local EntradaBlip = createBlipAttachedTo ( Entrar, 23 ) setBlipVisibleDistance ( EntradaBlip, 150 ) local Sair = createMarker(285.418, -40.954, 1001.516-1.1, "cylinder", 1.2, 20, 70, 230, 95) setElementInterior ( Sair, 1 ) local Porte2 = createMarker(296.087, -38.088, 1001.516-1.1, "cylinder", 1.2, 20, 70, 230, 95) setElementInterior(Porte2, 1) thePed = createPed(120, 296.103, -40.216, 1001.516) setElementInterior ( thePed, 1 )-- Creates a ped function cancelPedDamage() cancelEvent() -- Cancels the onClientPedDamage event end addEventHandler("onClientPedDamage", thePed, cancelPedDamage) function onmarker(marker,md) if (md) then if marker == Entrar then setTimer ( setElementInterior, 400, 1, source, 1 ) setTimer ( setElementPosition, 400, 1, source, 286.067, -39.416, 1001.516 ) setTimer ( setElementRotation, 900, 1, source, 0, 0, 358 ) fadeCamera ( source, false, 0.1, 0, 0, 0 ) setTimer ( fadeCamera, 900, 1, source , true, 0.5 ) end if marker == Sair then setTimer ( setElementInterior, 400, 1, source, 0 ) setTimer ( setElementDimension, 400, 1, source, 0 ) setTimer ( setElementPosition, 400, 1, source, 1310.116, -1371.456, 13.589 ) setTimer ( setElementRotation, 900, 1, source, 0, 0, 177 ) fadeCamera ( source, false, 0.1, 0, 0, 0 ) setTimer ( fadeCamera, 900, 1, source , true, 0.5 ) end end end addEventHandler("onPlayerMarkerHit",getRootElement(),onmarker) --------------------------- CODE ------------------------------------ addEvent("porte", true) addEventHandler("porte", root, function(source) if ( getPlayerMoney (source) >= 100000 ) then if getElementData(source, "Porte") == false then takePlayerMoney(source, 300000) setElementData(source, "Porte3", true) outputChatBox("#727272[Porte]#ff0000Voce adquiriu o porte de arma", source, 255, 255, 255, true) else outputChatBox("#727272[Porte]#ff0000Voce já tem um porte de arma", source, 255, 255, 255, true) end end end)
-
Eu usei o debugscript, mas deve ter sido falta de atenção, vou testar assim que chegar em casa, valeu lord.
-
Bom dia, estou fazendo meu sistema de porte de armas, com o botão em gui no alpha 0, mas, parece que o triggerServerEvent não funciona, fiz o sistema de fechar no client funcionou de boa, agora quando clico no adquirir porte, ele não faz simplesmente nada. (no script abaixo vou deixar com alpha) Client Side: local screenW,screenH = guiGetScreenSize() local resW, resH = 1366,768 local x, y = (screenW/resW), (screenH/resH) local render = false local Porte = createMarker(296.087, -38.088, 1001.516-1.1, "cylinder", 1.2, 20, 70, 230, 95) setElementInterior(Porte, 1) function botoes() local botonfechar = guiCreateButton(875, 152, 42, 37,"",false) guiSetAlpha(botonfechar,0) local porte = guiCreateButton(418, 467, 240, 103,"",false) guiSetAlpha(porte,0) local glock = guiCreateButton(668, 467, 240, 103,"",false) guiSetAlpha(glock,0) addEventHandler("onClientGUIClick",botonfechar, function() removeEventHandler("onClientRender",root,panel) guiSetVisible(botonfechar,false) guiSetVisible(porte,false) guiSetVisible(glock,false) showCursor(false) end) end addEventHandler("onClientGUIClick", porte, clickarporte) function clickarporte() triggerServerEvent ("porte",getLocalPlayer(),porte) end addEventHandler("onClientGUIClick", glock, glockear) function glockear() triggerServerEvent ("comprarglock",getLocalPlayer(),comprarglock) end function panel() dxDrawRectangle(395, 155, 523, 436, tocolor(0, 0, 0, 126), false) dxDrawLine(395 - 1, 152 - 1, 395 - 1, 189, tocolor(79, 0, 0, 208), 1, false) dxDrawLine(395 - 1, 189, 918, 189, tocolor(79, 0, 0, 208), 1, false) dxDrawLine(918, 189, 918, 152 - 1, tocolor(79, 0, 0, 208), 1, false) dxDrawRectangle(395, 152, 523, 37, tocolor(0, 0, 0, 208), false) dxDrawText("PORTE DE ARMAS", 393, 148, 918, 189, tocolor(255, 255, 255, 255), 1.20, "sans", "center", "center", false, false, false, false, false) dxDrawRectangle(413, 199, 489, 245, tocolor(0, 0, 0, 69), false) dxDrawText("LEMBRANDO, O PORTE DE ARMAS APENAS COBRE A GLOCK, E PARA ADQUIRIR A MESMA, TÉRA QUE A COMPRAR, A GLOCK CUSTA 100K POR SER LEGAL.", 416, 197, 902, 444, tocolor(255, 255, 255, 255), 1.50, "default", "center", "center", false, true, false, false, false) dxDrawRectangle(875, 152, 42, 37, tocolor(0, 0, 0, 186), false) dxDrawText("ADQUIRIR PORTE", 418, 463, 658, 570, tocolor(255, 255, 255, 255), 2.00, "default", "center", "center", false, false, false, false, false) dxDrawText("ADQUIRIR GLOCK", 669, 465, 908, 570, tocolor(255, 255, 255, 255), 2.00, "default", "center", "center", false, false, false, false, false) dxDrawText("X", 876, 148, 916, 188, tocolor(255, 255, 255, 255), 1.30, "default", "center", "center", false, false, false, false, false) end function markerPanel (hitPlayer, matchingDimension) if (hitPlayer == localPlayer) then addEventHandler("onClientRender", root, panel) render = true showCursor(true) botoes() end end addEventHandler ("onClientMarkerHit", Porte, markerPanel) Server Side: local Entrar = createMarker (1310.129, -1368.674, 13.552-1, "cylinder", 1.2, 20, 70, 230, 95 ) local EntradaBlip = createBlipAttachedTo ( Entrar, 23 ) setBlipVisibleDistance ( EntradaBlip, 150 ) local Sair = createMarker(285.418, -40.954, 1001.516-1.1, "cylinder", 1.2, 20, 70, 230, 95) setElementInterior ( Sair, 1 ) local Porte2 = createMarker(296.087, -38.088, 1001.516-1.1, "cylinder", 1.2, 20, 70, 230, 95) setElementInterior(Porte2, 1) thePed = createPed(120, 296.103, -40.216, 1001.516) setElementInterior ( thePed, 1 )-- Creates a ped function cancelPedDamage() cancelEvent() -- Cancels the onClientPedDamage event end addEventHandler("onClientPedDamage", thePed, cancelPedDamage) function onmarker(marker,md) if (md) then if marker == Entrar then setTimer ( setElementInterior, 400, 1, source, 1 ) setTimer ( setElementPosition, 400, 1, source, 286.067, -39.416, 1001.516 ) setTimer ( setElementRotation, 900, 1, source, 0, 0, 358 ) fadeCamera ( source, false, 0.1, 0, 0, 0 ) setTimer ( fadeCamera, 900, 1, source , true, 0.5 ) end if marker == Sair then setTimer ( setElementInterior, 400, 1, source, 0 ) setTimer ( setElementDimension, 400, 1, source, 0 ) setTimer ( setElementPosition, 400, 1, source, 1310.116, -1371.456, 13.589 ) setTimer ( setElementRotation, 900, 1, source, 0, 0, 177 ) fadeCamera ( source, false, 0.1, 0, 0, 0 ) setTimer ( fadeCamera, 900, 1, source , true, 0.5 ) end end end addEventHandler("onPlayerMarkerHit",getRootElement(),onmarker) --------------------------- CODE ------------------------------------ addEvent("porte", true, porte3) addEventHandler("porte", getRootElement(), porte3) function porte3(source) if ( getPlayerMoney (source) >= 100000 ) then if getElementData(source, "Porte3") == false then takePlayerMoney(source, 300000) setElementData(source, "Porte3", true) outputChatBox("#727272[Porte]#ff0000Voce adquiriu o porte de arma", source, 255, 255, 255, true) else outputChatBox("#727272[Porte]#ff0000Voce já tem um porte de arma", source, 255, 255, 255, true) end end end
-
Use getElementData
-
porque você não coloca if (seat == 0) or (seat == 1) then ?
-
local Abordado = getElementData( source,"FeniXMTA_Suspeito") local cx, cy, cz = getElementPosition ( Abordado ) local px, py, pz = getElementPosition ( source ) local distance = getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz ) if ( distance >= 1.8 ) then msgFeniX(source, "Chegue Mais Perto Do Jogador vai efetuar esta função !", "error") if ( distance <= 1.7) then local vtr = viatura[source] if viatura[source] then attachElements (Abordado, vtr, 0.2, -1.5, 0, 0,0,90) setPedAnimation (Abordado, 'ped','CAR_dead_LHS') vrx, vry, vrz = getElementRotation(vtr) setElementRotation(Abordado, vrx, vry, vrz+83) setElementData ( Abordado, "FeniXMTA_Preso", true ) setElementData(Abordado, "FeniX_Preso", true) else msgFeniX(source, "Entre no carro e saia para executar esta função !", "error") end end end Bom dia, estava editando o script acima, e queria adicionar a opção de retirar o individuo do carro. No caso o individuo fica no porta mala, mas para meu script de prender, o mesmo precisa de ir dentro do DP.. Sendo assim queria adicionar um comando para retirar o mesmo do véiculo. Alguém poderia me ajudar? Ficaria eternamente grato.
-
Onde diz Grupo_01 sim, e os respetivos..
-
Bom dia, estou fazendo um script, quando o player der o comando, /prender (player) ele ocupe automaticamente a posição 4, mas não sei como faze-lo.. ( Por favor, que tenha verificação se não tem ninguem em cima, 'para não haver conflitos).. Estou disposto a ajudar.
-
Use a função de "<>" para postar seu código.
-
Renomeie onde diz "Grupo_X" , coloque a acl que você quer. Repita os procedimentos para todos os grupos.
-
Correção: Consegui fazer com que o veículo se destrua, mas quero que apenas dê se o player estiver a pé. Pois o painel funciona com toggleAllControls.. Se eu colocar o seguinte o painel so aparece 1 vez e depois não aparece mais.. local theVehicle = getPedOccupiedVehicle ( thePlayer ) if not theVehicle then Segue o codigo do Client: local check = 0; local check1 = 0; butao1 = "k" butao2 = "f" rt1 = 180 rt2 = 0 rt3 = 0 rt4 = 0 local arsenal = createMarker(2912.4116210938,-1960.0969238281,11.00625038147-1, "cylinder", 2, 255, 0, 0, 20) addEventHandler( "onClientRender", root, function() local x, y, z = getElementPosition( arsenal ) local Mx, My, Mz = getCameraMatrix( ) if ( getDistanceBetweenPoints3D( x, y, z, Mx, My, Mz ) <= 10 ) then local WorldPositionX, WorldPositionY = getScreenFromWorldPosition( x, y, z +1, 0.07 ) if ( WorldPositionX and WorldPositionY ) then dxDrawText("Viaturas", WorldPositionX - 1, WorldPositionY + 1, WorldPositionX - 1, WorldPositionY + 1, tocolor(255, 255, 255, 255), 2.52, "default-bold", "center", "center", false, false, false, false, false) -- dxDrawText("Alugue Bikes Aqui!", WorldPositionX - 1, WorldPositionY + 1, WorldPositionX - 1, WorldPositionY + 1, tocolor(255, 255, 255, 255), 2.50, "default-bold", "center", "center", false, false, false, false, false) end end end) function moverrt() dxDrawRectangle(386, 221, 298, 499, tocolor(62, 64, 66, 255), false) dxDrawRectangle(386, 222, 298, 75, tocolor(255, 0, 0, rt1), true) dxDrawRectangle(386, 313, 298, 75, tocolor(255, 0, 0, rt2), true) dxDrawRectangle(386, 404, 298, 75, tocolor(255, 0, 0, rt3), true) dxDrawRectangle(386, 495, 298, 75, tocolor(255, 0, 0, rt4), true) dxDrawText("FECHAR", 420, 250, 563, 355, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "top", false, false, false, false, false) dxDrawText("TRIAL BLAZER", 420, 330, 563, 355, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "top", false, false, false, false, false) dxDrawText("BLAZER", 420, 330+80, 563, 355, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "top", false, false, false, false, false) dxDrawText("GUARDAR VEICULO", 420, 330+180, 563, 355, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "top", false, false, false, false, false) dxDrawText("(Use as setas para mover)", 750, 330+180, 563, 355, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "top", false, false, false, false, false) end function moverrt2() if rt1 == 180 then rt1 = 0 rt2 = 180 elseif rt1 == 0 and rt2 == 180 then rt2 = 0 rt3 = 180 elseif rt1 == 0 and rt2 == 0 and rt3 == 180 then rt4 = 180 rt3 = 0 elseif rt1 == 0 and rt2 == 0 and rt3 == 0 and rt4 == 180 then rt4 = 0 rt1 = 180 end end function moverrt3() if rt4 == 180 then rt4 = 0 rt3 = 180 elseif rt3 == 180 and rt4 == 0 then rt3 = 0 rt2 = 180 elseif rt3 == 0 and rt2 == 180 then rt2 = 0 rt1 = 180 end end bindKey ( "arrow_d", "down", moverrt2 ) bindKey ( "arrow_u", "down", moverrt3) function tsstar() local mark = isElementWithinMarker if rt1 == 180 then if mark(getLocalPlayer(),arsenal) then removeEventHandler('onClientRender',root,moverrt); toggleAllControls(true) end end if mark(getLocalPlayer(),arsenal) then if rt3 == 180 then triggerServerEvent("blazer",getLocalPlayer()) removeEventHandler('onClientRender',root,moverrt) toggleAllControls(true) end end if mark(getLocalPlayer(),arsenal) then if rt2 == 180 then triggerServerEvent("trialblazer",getLocalPlayer()) removeEventHandler('onClientRender',root,moverrt) toggleAllControls(true) end end if mark(getLocalPlayer(),arsenal) then if rt4 == 180 then triggerServerEvent("destroy",getLocalPlayer()) removeEventHandler('onClientRender',root,moverrt) toggleAllControls(true) end end end bindKey ( "enter", "down", tsstar) local theVehicle = getPedOccupiedVehicle ( thePlayer ) function notvehicle(thePlayer) if thePlayer == getLocalPlayer() then if check == 0 then check = 1; rt1 = 180 rt2 = 0 rt3 = 0 rt4 = 0 addEventHandler('onClientRender',root,moverrt) if not theVehicle then toggleAllControls(false) else removeEventHandler('onClientRender',root,moverrt) toggleAllControls(true) check = 0; end end end end addEventHandler("onClientMarkerHit",arsenal,notvehicle)
-
Sim, está no server side..
-
Poderião me ajudar?
-
Bom dia, estou fazendo um script que é o seguinte: Você tem o painel para spawnar as viaturas, e quero colocar um Guardar Veículo, que se o veh estiver no marker "destroy", e o player apertar em guardar veículo, o veículo sumiria, segue uma print de exemplo: https://imgur.com/UDOecOr. Resumindo, quero deixar a viatura no marker, sair dela, ir no marker do painel e apertar guardar veículo.. O client já está arrumado, falta o server: Client Side: local check = 0; local check1 = 0; butao1 = "k" butao2 = "f" rt1 = 180 rt2 = 0 rt3 = 0 rt4 = 0 rt5 = 0 local arsenal = createMarker(2912.4116210938,-1960.0969238281,11.00625038147-1, "cylinder", 2, 255, 0, 0, 180) local destroy = createMarker(2912.2587890625,-1969.0013427734,11.00625038147-1, "cylinder", 2, 255, 0, 0, 180) addEventHandler( "onClientRender", root, function() local x, y, z = getElementPosition( arsenal ) local Mx, My, Mz = getCameraMatrix( ) if ( getDistanceBetweenPoints3D( x, y, z, Mx, My, Mz ) <= 20 ) then local WorldPositionX, WorldPositionY = getScreenFromWorldPosition( x, y, z +1, 0.07 ) if ( WorldPositionX and WorldPositionY ) then dxDrawText("Viaturas", WorldPositionX - 1, WorldPositionY + 1, WorldPositionX - 1, WorldPositionY + 1, tocolor(255, 255, 255, 255), 2.52, "default-bold", "center", "center", false, false, false, false, false) -- dxDrawText("Alugue Bikes Aqui!", WorldPositionX - 1, WorldPositionY + 1, WorldPositionX - 1, WorldPositionY + 1, tocolor(255, 255, 255, 255), 2.50, "default-bold", "center", "center", false, false, false, false, false) end end end) addEventHandler( "onClientRender", root, function() local x, y, z = getElementPosition( destroy ) local Mx, My, Mz = getCameraMatrix( ) if ( getDistanceBetweenPoints3D( x, y, z, Mx, My, Mz ) <= 20 ) then local WorldPositionX, WorldPositionY = getScreenFromWorldPosition( x, y, z +1, 0.07 ) if ( WorldPositionX and WorldPositionY ) then dxDrawText("Destruir", WorldPositionX - 1, WorldPositionY + 1, WorldPositionX - 1, WorldPositionY + 1, tocolor(255, 255, 255, 255), 2.52, "default-bold", "center", "center", false, false, false, false, false) -- dxDrawText("Alugue Bikes Aqui!", WorldPositionX - 1, WorldPositionY + 1, WorldPositionX - 1, WorldPositionY + 1, tocolor(255, 255, 255, 255), 2.50, "default-bold", "center", "center", false, false, false, false, false) end end end) function moverrt() dxDrawRectangle(386, 221, 298, 499, tocolor(62, 64, 66, 255), false) dxDrawRectangle(386, 222, 298, 75, tocolor(255, 0, 0, rt1), true) -- FECHAR dxDrawRectangle(386, 313, 298, 75, tocolor(255, 0, 0, rt2), true) -- TRIAL BLAZER dxDrawRectangle(386, 404, 298, 75, tocolor(255, 0, 0, rt3), true) -- BLAZER dxDrawRectangle(386, 495, 298, 75, tocolor(255, 0, 0, rt4), true) -- GUARDAR dxDrawText("FECHAR", 420, 250, 563, 355, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "top", false, false, false, false, false) dxDrawText("TRIAL BLAZER", 420, 330, 563, 355, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "top", false, false, false, false, false) dxDrawText("BLAZER", 420, 330+80, 563, 355, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "top", false, false, false, false, false) dxDrawText("GUARDAR VEICULO", 420, 330+180, 563, 355, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "top", false, false, false, false, false) end function moverrt2() if rt1 == 180 then rt1 = 0 rt2 = 180 elseif rt1 == 0 and rt2 == 180 then rt2 = 0 rt3 = 180 elseif rt1 == 0 and rt2 == 0 and rt3 == 180 then rt3 = 0 rt4 = 180 end end function moverrt3() if rt4 == 180 then rt4 = 0 rt3 = 180 elseif rt3 == 180 and rt4 == 0 then rt3 = 0 rt2 = 180 elseif rt3 == 0 and rt2 == 180 then rt2 = 0 rt1 = 180 elseif rt4 == 180 and rt3 == 0 then rt4 = 0 rt3 = 180 end end bindKey ( "arrow_d", "down", moverrt2 ) bindKey ( "arrow_u", "down", moverrt3) function tsstar() local mark = isElementWithinMarker if rt1 == 180 then if mark(getLocalPlayer(),arsenal) then removeEventHandler('onClientRender',root,moverrt); toggleAllControls(true) end end if mark(getLocalPlayer(),arsenal) then if rt3 == 180 then triggerServerEvent("blazer",getLocalPlayer()) removeEventHandler('onClientRender',root,moverrt); toggleAllControls(true) end end if mark(getLocalPlayer(),arsenal) then if rt2 == 180 then triggerServerEvent("trialblazer",getLocalPlayer()) removeEventHandler('onClientRender',root,moverrt); toggleAllControls(true) if mark(getLocalPlayer(),arsenal) then if rt4 == 180 then triggerServerEvent("guardar",getLocalPlayer()) removeEventHandler('onClientRender',root,moverrt); toggleAllControls(true) end end end end end bindKey ( "enter", "down", tsstar) function openAndClose(thePlayer) if thePlayer == getLocalPlayer() then if check == 0 then check = 1; rt1 = 180 rt2 = 0 rt3 = 0 addEventHandler('onClientRender',root,moverrt) toggleAllControls(false) else removeEventHandler('onClientRender',root,moverrt) toggleAllControls(true) check = 0; end end end addEventHandler("onClientMarkerHit",arsenal,openAndClose) Server side: local destroy = createMarker(2912.2587890625,-1969.0013427734,11.00625038147-1, "cylinder", 2, 255, 0, 0, 180) function movingMyGateBack () local accName = getAccountName(getPlayerAccount(source)) if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( "Policial" ) ) ) then --if aberto == true then moveObject (myGate1, 400, 1566.5546875, -1675.19140625, 16.589937210083 ) end end --end addEvent("abrir2",true) addEventHandler("abrir2",root,movingMyGateBack) ----------------------------------------------------------------------------------------------------------------- -- parte2 ARSENAL ----------- addEvent("trialblazer",true) addEventHandler("trialblazer",root, function() local accName = getAccountName(getPlayerAccount(source)) if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( "Policial" ) ) ) then veh = createVehicle ( 445,2906.423828125,-1948.9193115234,11.00625038147, -0, 0, 266.15621948242 ) warpPedIntoVehicle ( source, veh ) end end) addEvent("blazer",true) addEventHandler("blazer",root, function() local accName = getAccountName(getPlayerAccount(source)) if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( "Policial" ) ) ) then vehs = createVehicle ( 458,2906.423828125,-1950.9193115234,11.00625038147, -0, 0, 266.15621948242 ) warpPedIntoVehicle ( source, vehs ) end end)
-
Eu estava tentando mecher , pois não estava correspondendo.
-
como faço para abrir este painel neste marker ?
beast99 replied to wilborn's topic in Programação em Lua
Na linha 25 coloca o "p" de pdx em letra maiúscula. -
como faço para abrir este painel neste marker ?
beast99 replied to wilborn's topic in Programação em Lua
local screenW,screenH = guiGetScreenSize() local resW, resH = 1365,767 local x, y = (screenW/resW), (screenH/resH) local glock = createMarker(297.947, -80.809, 1000.600, "cylinder", 1, 255, 0, 0, 40) setElementInterior(glock, 4) function Pdx () -----Painel dxDrawLine(333 - 1, 194 - 1, 333 - 1, 574, tocolor(38, 237, 11, 254), 1, false) dxDrawLine(691, 194 - 1, 333 - 1, 194 - 1, tocolor(38, 237, 11, 254), 1, false) dxDrawLine(333 - 1, 574, 691, 574, tocolor(38, 237, 11, 254), 1, false) dxDrawLine(691, 574, 691, 194 - 1, tocolor(38, 237, 11, 254), 1, false) dxDrawRectangle((screenW - 358) / 2, (screenH - 380) / 2, 358, 380, tocolor(0, 0, 0, 138), false) dxDrawImage(333, 194, 358, 380, ":GUI/images/examples/new_city_sfundo.png", 0, 0, 0, tocolor(254, 254, 254, 50), false) dxDrawImage(417, 257, 202, 160, ":GUI/images/examples/G-18.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(333, 194, 358, 53, tocolor(21, 133, 6, 111), false) dxDrawRectangle(359, 468, 310, 80, tocolor(21, 133, 6, 111), false) dxDrawText("R$15.000", 346, 417, 681, 463, tocolor(255, 255, 255, 255), 2.00, "pricedown", "center", "center", false, false, false, false, false) dxDrawText("Glock-18", 338, 203, 681, 237, tocolor(255, 255, 255, 255), 2.00, "pricedown", "center", "center", false, false, false, false, false) dxDrawText("comprar", 372, 481, 659, 538, tocolor(255, 255, 255, 255), 2.00, "pricedown", "center", "center", false, false, false, false, false) end function render(hitPlayer, matchingdimension) if (hitPlayer == localPlayer) then addEventHandler("onClientRender", root, Pdx) render = true showCursor(true) end end addEventHandler ("onClientMarkerHit", glock, render) function abrir (_,state) -------Render do Painel if painel == false then showCursor(true) addEventHandler("onClientRender", root, Pdx) painel = true else showCursor(false) removeEventHandler("onClientRender", root, Pdx) painel = false end end addEvent("painelglock", true) addEventHandler("painelglock", root , abrir) function isCursorOnElement(x,y,w,h) ------Cursor local mx,my = getCursorPosition () local fullx,fully = guiGetScreenSize() cursorx,cursory = mx*fullx,my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end function arma (_,state) if painel == true then if state == "down" then if isCursorOnElement(372, 481, 659, 538) then triggerServerEvent ("glock", localPlayer) end end end end addEventHandler ("onClientClick", root, arma) Para mim funcionou, qual o seu problema no debugscript? Edit: https://imgur.com/a/opRPMbu ficou assim. -
como faço para abrir este painel neste marker ?
beast99 replied to wilborn's topic in Programação em Lua
function render(hitPlayer, matchingDimension) if (hitPlayer == localPlayer) then addEventHandler("onClientRender", root, Pdx) ----Erro render = true showCursor (true) end end addEventHandler("onClientMarkerHit", glock, render) Assim deverá funcionar -
como faço para abrir este painel neste marker ?
beast99 replied to wilborn's topic in Programação em Lua
local screenW,screenH = guiGetScreenSize() local resW, resH = 1365,767 local x, y = (screenW/resW), (screenH/resH) local glock = createMarker(297.947, -80.809, 1000.600, "cylinder", 1, 255, 0, 0, 40) setElementInterior(glock, 4) function Pdx () -----Painel dxDrawLine(333 - 1, 194 - 1, 333 - 1, 574, tocolor(38, 237, 11, 254), 1, false) dxDrawLine(691, 194 - 1, 333 - 1, 194 - 1, tocolor(38, 237, 11, 254), 1, false) dxDrawLine(333 - 1, 574, 691, 574, tocolor(38, 237, 11, 254), 1, false) dxDrawLine(691, 574, 691, 194 - 1, tocolor(38, 237, 11, 254), 1, false) dxDrawRectangle((screenW - 358) / 2, (screenH - 380) / 2, 358, 380, tocolor(0, 0, 0, 138), false) dxDrawImage(333, 194, 358, 380, ":GUI/images/examples/new_city_sfundo.png", 0, 0, 0, tocolor(254, 254, 254, 50), false) dxDrawImage(417, 257, 202, 160, ":GUI/images/examples/G-18.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(333, 194, 358, 53, tocolor(21, 133, 6, 111), false) dxDrawRectangle(359, 468, 310, 80, tocolor(21, 133, 6, 111), false) dxDrawText("R$15.000", 346, 417, 681, 463, tocolor(255, 255, 255, 255), 2.00, "pricedown", "center", "center", false, false, false, false, false) dxDrawText("Glock-18", 338, 203, 681, 237, tocolor(255, 255, 255, 255), 2.00, "pricedown", "center", "center", false, false, false, false, false) dxDrawText("comprar", 372, 481, 659, 538, tocolor(255, 255, 255, 255), 2.00, "pricedown", "center", "center", false, false, false, false, false) end function render(hitPlayer, matchingdimension) if (hitPlayer == localPlayer) then addEventHandler("onClientRender", root, Pdx) render = true showCursor(true) end end addEventHandler ("onClientMarkerHit", glock, render) function abrir (_,state) -------Render do Painel if painel == false then showCursor(true) addEventHandler("onClientRender", root, Pdx) painel = true else showCursor(false) removeEventHandler("onClientRender", root, Pdx) painel = false end end addEvent("painelglock", true) addEventHandler("painelglock", root , abrir) function isCursorOnElement(x,y,w,h) ------Cursor local mx,my = getCursorPosition () local fullx,fully = guiGetScreenSize() cursorx,cursory = mx*fullx,my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end function arma (_,state) if painel == true then if state == "down" then if isCursorOnElement(372, 481, 659, 538) then triggerServerEvent ("glock", localPlayer) end end end end addEventHandler ("onClientClick", root, arma) Se isso não funcionar, remova da linha 31 a 43 e tente denovo. -
Seria mais facil se você colocasse o código. Coloque seu código meta também..
-
Boa Tarde, estou desenvolvendo um script de loja de armas ilegais, mas , quando coloco as coordenadas do isCursorOnPosition no client, ele não fica alinhado com as coordenadas igual do rectangleDX, alguém poderia me ajudar? Edit: desculpem pelo nome inapropriado da função, mas foi meu amigo que me tentou ajudar e ele colocou assim o nome da função (não levem a mal rsrs) local screenW,screenH = guiGetScreenSize() local resW, resH = 1920,1080 local x, y = (screenW/resW), (screenH/resH) theMarker = createMarker(2796.24805, -2373.49243, 13.63160-1.1, "cylinder", 1, 255, 0, 0, 255) function botones() local botonCerrar = guiCreateButton(1207, 238, 38, 34,"",false) guiSetAlpha(botonCerrar,0) addEventHandler("onClientGUIClick",botonCerrar, function() removeEventHandler("onClientRender",root,estructuraDX) removeEventHandler("onClientRender",root,estructura) removeEventHandler("onClientRender",root,lettersdx) guiSetVisible(botonCerrar,false) showCursor(false) end) addEventHandler("onClientGUIClick",botonDar, function() local dinero = guiGetText(editDinero) local skin = guiGetText(editSkin) triggerServerEvent("valores",localPlayer,dinero,skin) end) ------------- end function estructuraDX2(hitPlayer, matchingdimension) if (hitPlayer == localPlayer) then addEventHandler("onClientRender", root, estructuraDX) addEventHandler("onClientRender", root, estructura) addEventHandler("onClientRender", root, lettersdx) addEventHandler("onClientRender", root, meupaudeoculos) botones() render = true showCursor(true) end end addEventHandler ("onClientMarkerHit", theMarker, estructuraDX2) function lettersdx() dxDrawText("DESERT EAGLE", 671, 328, 883, 367, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("SHOTGUN", 671, 528, 883, 367, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("UZI", 671, 728, 883, 367, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("AK47", 671, 928, 883, 367, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("PRECOS", 1371, 258, 883, 367, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("ARMAS", 671, 258, 883, 367, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("R$12000", 1371, 328, 883, 367, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("R$18000", 1371, 528, 883, 367, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("R$16000", 1371, 728, 883, 367, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("R$28000", 1371, 928, 883, 367, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false) end function estructura() if not cursorPosition( 692, 428, 529, 41 ) then dxDrawRectangle(692, 428, 529, 41, tocolor(14, 10, 10, 152), false) else dxDrawRectangle(692, 428, 529, 41, tocolor(255, 0, 0, 80), false) end if not cursorPosition( 692, 328, 529, 41 ) then dxDrawRectangle(692, 328, 529, 41, tocolor(14, 10, 10, 152), false) else dxDrawRectangle(692, 328, 529, 41, tocolor(255, 0, 0, 80), false) end if not cursorPosition( 692, 528, 529, 41 ) then dxDrawRectangle(692, 528, 529, 41, tocolor(14, 10, 10, 152), false) else dxDrawRectangle(692, 528, 529, 41, tocolor(255, 0, 0, 80), false) end if not cursorPosition( 692, 628, 529, 41 ) then dxDrawRectangle(692, 628, 529, 41, tocolor(14, 10, 10, 152), false) else dxDrawRectangle(692, 628, 529, 41, tocolor(255, 0, 0, 80), false) end if not cursorPosition( 1207, 238, 38, 34 ) then dxDrawRectangle(1207, 238, 38, 34, tocolor(14, 10, 10, 152), false) else dxDrawRectangle(1207, 238, 38, 34, tocolor(255, 0, 0, 80), false) end end function estructuraDX() dxDrawRectangle(665, 238, 581, 546, tocolor(1, 0, 0, 124), false) dxDrawLine(664, 273, 1245, 273, tocolor(253, 0, 0, 124), 2, false) dxDrawText("SHOP ARMAS ILEGAIS", 764, 236, 1129, 273, tocolor(255, 255, 255, 255), 2.00, "default", "center", "center", false, false, false, false, false) dxDrawText("SHOP ARMAS ILEGAIS", 764, 236, 1129, 273, tocolor(255, 255, 255, 255), 2.00, "default", "center", "center", false, false, false, false, false) dxDrawText("X", 1206, 236, 1245, 272, tocolor(231, 0, 0, 254), 2.00, "default", "center", "center", false, false, false, false, false) end function meupaudeoculos(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) if ( clickedElement ) then if (button == "left" and state == "up") then if isCursorOnElement ( 694, 327, 525, 42 ) then -- AK triggerServerEvent ("comprarak",getLocalPlayer(),comprarak) end end end end addEventHandler ( "onClientClick", getRootElement(), meupaudeoculos ) ---------------------------------------- function cursorPosition(x, y, width, height) if (not isCursorShowing()) then return false end local sx, sy = guiGetScreenSize() local cx, cy = getCursorPosition() local cx, cy = (cx*sx), (cy*sy) if (cx >= x and cx <= x + width) and (cy >= y and cy <= y + height) then return true else return false end end ---------------------------------------------------------------------------------------------------------------------------------------- function isCursorOnElement( x,y,w,h ) local mx,my = getCursorPosition () local fullx,fully = guiGetScreenSize() cursorx,cursory = mx*fullx,my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end ------------------------------------------------
-
Valeu pela ajuda!
-
Como eu posso saber as coordenadas no ecrã? Pois no isCursorOnElement preciso saber as coordenadas, tem alguma forma?
