wilborn Posted July 30, 2019 Share Posted July 30, 2019 (edited) glock = createMarker(297.947, -80.809, 1000.600, "cylinder", 1, 255, 0, 0, 40) setElementInterior(glock, 4) local screenW, screenH = guiGetScreenSize() addEventHandler("onClientRender", root, function() dxDrawLine(365 - 1, 222 - 1, 365 - 1, 546, tocolor(48, 212, 5, 255), 1, false) dxDrawLine(660, 222 - 1, 365 - 1, 222 - 1, tocolor(48, 212, 5, 255), 1, false) dxDrawLine(365 - 1, 546, 660, 546, tocolor(48, 212, 5, 255), 1, false) dxDrawLine(660, 546, 660, 222 - 1, tocolor(48, 212, 5, 255), 1, false) dxDrawRectangle((screenW - 295) / 2, (screenH - 324) / 2, 295, 324, tocolor(28, 28, 28, 179), false) dxDrawRectangle(422, 254, 0, 66, tocolor(255, 255, 255, 255), false) dxDrawImage(365, 222, 295, 324, ":GUI/images/examples/new_city_sfundo.png", 0, 0, 0, tocolor(108, 108, 108, 77), false) dxDrawLine(375 - 1, 452 - 1, 375 - 1, 536, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(650, 452 - 1, 375 - 1, 452 - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(375 - 1, 536, 650, 536, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(650, 536, 650, 452 - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(375, 452, 275, 84, tocolor(21, 131, 10, 210), false) dxDrawText("R$15.000", 380 - 1, 398 - 1, 655 - 1, 448 - 1, tocolor(0, 0, 0, 255), 2.00, "pricedown", "center", "center", false, false, false, false, false) dxDrawText("R$15.000", 380 + 1, 398 - 1, 655 + 1, 448 - 1, tocolor(0, 0, 0, 255), 2.00, "pricedown", "center", "center", false, false, false, false, false) dxDrawText("R$15.000", 380 - 1, 398 + 1, 655 - 1, 448 + 1, tocolor(0, 0, 0, 255), 2.00, "pricedown", "center", "center", false, false, false, false, false) dxDrawText("R$15.000", 380 + 1, 398 + 1, 655 + 1, 448 + 1, tocolor(0, 0, 0, 255), 2.00, "pricedown", "center", "center", false, false, false, false, false) dxDrawText("R$15.000", 380, 398, 655, 448, tocolor(255, 255, 255, 255), 2.00, "pricedown", "center", "center", false, false, false, false, false) dxDrawText("comprar", 385, 464, 640, 526, tocolor(255, 255, 255, 255), 2.00, "pricedown", "center", "center", false, false, false, false, false) dxDrawRectangle(365, 222, 295, 32, tocolor(48, 212, 5, 255), false) dxDrawImage(442, 259, 150, 153, ":GUI/images/examples/G-18.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Glock-18", 369, 228, 654, 249, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false) end ) Edited July 30, 2019 by DNL291 Código adicionado com a formatação Lua Link to comment
DNL291 Posted July 30, 2019 Share Posted July 30, 2019 onClientMarkerHit addEventHandler onClientRender showCursor @wilborn 1 Link to comment
wilborn Posted July 31, 2019 Author Share Posted July 31, 2019 eu enviei o script errado perdão, vou mandar o correto! Client local screenW,screenH = guiGetScreenSize() local resW, resH = 358,380 local x, y = (screenW/resW), (screenH/resH) function Pdx () 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 abrir (_,state) 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 togglePanel() if getElementData(localPlayer,nomeDaACL_Comandante) then if not isEventHandlerAdded("onClientRender",root,onClientRender) then guiGridListClear(playerList) for id, player in ipairs(getElementsByType("player")) do guiGridListSetItemText(playerList, guiGridListAddRow(playerList), 1, getPlayerName(player):gsub('#%x%x%x%x%x%x', ''), false, false) end guiSetVisible(playerList,true) guiSetVisible(edit,true) aVisible = true rVisible = true addEventHandler("onClientRender",root,onClientRender) showCursor(true) else guiSetVisible(playerList,false) guiSetVisible(edit,false) removeEventHandler("onClientRender",root,onClientRender) showCursor(false) end 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 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) Server function showPanellr(thePlayer) accountname = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user." .. accountname, aclGetGroup("Porte")) then end end function onResStartlr() for index, player in ipairs(getElementsByType("player")) do bindKey(player, "k", "down", showPanellr) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onResStartlr) function onPlayerJoinlr() bindKey(source, "k", "down", showPanellr) end addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoinlr) function cleanAlllr(player) for index, player in ipairs(getElementsByType("player")) do unbindKey(player, "k", "down", showPanellr) end end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), cleanAlllr) function arma () giveWeapon( source, 22, 300, true ) outputChatBox ('( #ff0000INFO#ffffff ) #ffff00Você comprou #00ff00Glock-18 !',source,255,255,255,true) end addEvent("glock",true) addEventHandler ( "glock", getRootElement(), arma ) Poderia me ajudar a colocar esse painel dx no marker ? Marker glock = createMarker(297.947, -80.809, 1000.600, "cylinder", 1, 255, 0, 0, 40) setElementInterior(glock, 4) Link to comment
Jonas^ Posted July 31, 2019 Share Posted July 31, 2019 (edited) Ele já te deu todos eventos/funções que você precisa, porque não tenta? quem sabe você consegue, não adianta você baixar esse resource aí e não saber nem como ele funciona. Edited July 31, 2019 by Jonas^ Link to comment
wilborn Posted July 31, 2019 Author Share Posted July 31, 2019 2 minutes ago, Jonas^ said: Ele já te deu todos eventos/funções que você precisa, porque não tenta? quem sabe você consegue, não adianta você baixar esse resource aí e não saber nem como ele funciona. Mas eu estou fazendo do zero, o problema é que só aprendi a por pela bind, mas queria alterar para um marker, procurei por videos explicativos e não encontrei. Mas vou dar mais uma olhada nos tópicos! Link to comment
Jonas^ Posted July 31, 2019 Share Posted July 31, 2019 Ok, ainda acho estranho você me dizer que fez até aqui sozinho e não saber fazer uma coisa tão simples. Aqui está: Client local screenW, screenH = guiGetScreenSize () local resW, resH = 358, 380 local x, y = (screenW/resW), (screenH/resH) local markerWeapons = createMarker (x, y, z, "cylinder", 1.0, 255, 255, 255, 255) -- Coloque as coordenadas do seu marker aqui onde tem x, y, z. function Pdx () 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 addEventHandler ("onClientMarkerHit", markerWeapons, function (hitElement, matchingDimension) if (getElementType (hitElement) == "player") then abrir () end end) function abrir (_, state) 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) --[[ -- Não entendi necessidade disso aqui, deixei comentado. function togglePanel () if getElementData (localPlayer, nomeDaACL_Comandante) then if not isEventHandlerAdded ("onClientRender", root, onClientRender) then guiGridListClear (playerList) for id, player in ipairs(getElementsByType("player")) do guiGridListSetItemText (playerList, guiGridListAddRow(playerList), 1, getPlayerName(player):gsub('#%x%x%x%x%x%x', ''), false, false) end guiSetVisible (playerList, true) guiSetVisible (edit, true) aVisible = true rVisible = true addEventHandler ("onClientRender", root, onClientRender) showCursor (true) else guiSetVisible (playerList, false) guiSetVisible (edit, false) removeEventHandler ("onClientRender", root, onClientRender) showCursor (false) end 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 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) Server function arma () giveWeapon (source, 22, 300, true) outputChatBox ("( #ff0000INFO#ffffff ) #ffff00Você comprou #00ff00Glock-18 !", source, 255, 255, 255, true) end addEvent ("glock",true) addEventHandler ("glock", root, arma) OBS: Não testado, vale lembrar que é bom sempre você indentar o código, assim fica mais fácil de você entender e o código fica mais organizado. 1 Link to comment
MatheusWW Posted July 31, 2019 Share Posted July 31, 2019 13 hours ago, Jonas^ said: Ok, ainda acho estranho você me dizer que fez até aqui sozinho e não saber fazer uma coisa tão simples. Aqui está: Client local screenW, screenH = guiGetScreenSize () local resW, resH = 358, 380 local x, y = (screenW/resW), (screenH/resH) local markerWeapons = createMarker (x, y, z, "cylinder", 1.0, 255, 255, 255, 255) -- Coloque as coordenadas do seu marker aqui onde tem x, y, z. function Pdx () 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 addEventHandler ("onClientMarkerHit", markerWeapons, function (hitElement, matchingDimension) if (getElementType (hitElement) == "player") then abrir () end end) function abrir (_, state) 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) --[[ -- Não entendi necessidade disso aqui, deixei comentado. function togglePanel () if getElementData (localPlayer, nomeDaACL_Comandante) then if not isEventHandlerAdded ("onClientRender", root, onClientRender) then guiGridListClear (playerList) for id, player in ipairs(getElementsByType("player")) do guiGridListSetItemText (playerList, guiGridListAddRow(playerList), 1, getPlayerName(player):gsub('#%x%x%x%x%x%x', ''), false, false) end guiSetVisible (playerList, true) guiSetVisible (edit, true) aVisible = true rVisible = true addEventHandler ("onClientRender", root, onClientRender) showCursor (true) else guiSetVisible (playerList, false) guiSetVisible (edit, false) removeEventHandler ("onClientRender", root, onClientRender) showCursor (false) end 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 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) Server function arma () giveWeapon (source, 22, 300, true) outputChatBox ("( #ff0000INFO#ffffff ) #ffff00Você comprou #00ff00Glock-18 !", source, 255, 255, 255, true) end addEvent ("glock",true) addEventHandler ("glock", root, arma) OBS: Não testado, vale lembrar que é bom sempre você indentar o código, assim fica mais fácil de você entender e o código fica mais organizado. Muito, obrigado, estou em outra conta pois minha senha n ta entrando, mas você ajudou muito. Eu fiz o script faz tempo e agora quero retomalo Link to comment
MatheusWW Posted July 31, 2019 Share Posted July 31, 2019 (edited) 14 hours ago, Jonas^ said: Ok, ainda acho estranho você me dizer que fez até aqui sozinho e não saber fazer uma coisa tão simples. Aqui está: Client local screenW, screenH = guiGetScreenSize () local resW, resH = 358, 380 local x, y = (screenW/resW), (screenH/resH) local markerWeapons = createMarker (x, y, z, "cylinder", 1.0, 255, 255, 255, 255) -- Coloque as coordenadas do seu marker aqui onde tem x, y, z. function Pdx () 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 addEventHandler ("onClientMarkerHit", markerWeapons, function (hitElement, matchingDimension) if (getElementType (hitElement) == "player") then abrir () end end) function abrir (_, state) 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) --[[ -- Não entendi necessidade disso aqui, deixei comentado. function togglePanel () if getElementData (localPlayer, nomeDaACL_Comandante) then if not isEventHandlerAdded ("onClientRender", root, onClientRender) then guiGridListClear (playerList) for id, player in ipairs(getElementsByType("player")) do guiGridListSetItemText (playerList, guiGridListAddRow(playerList), 1, getPlayerName(player):gsub('#%x%x%x%x%x%x', ''), false, false) end guiSetVisible (playerList, true) guiSetVisible (edit, true) aVisible = true rVisible = true addEventHandler ("onClientRender", root, onClientRender) showCursor (true) else guiSetVisible (playerList, false) guiSetVisible (edit, false) removeEventHandler ("onClientRender", root, onClientRender) showCursor (false) end 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 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) Server function arma () giveWeapon (source, 22, 300, true) outputChatBox ("( #ff0000INFO#ffffff ) #ffff00Você comprou #00ff00Glock-18 !", source, 255, 255, 255, true) end addEvent ("glock",true) addEventHandler ("glock", root, arma) OBS: Não testado, vale lembrar que é bom sempre você indentar o código, assim fica mais fácil de você entender e o código fica mais organizado. O marker apareceu mas não abriu o painel, o debugscript não detectou nenhum erro. 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 addEventHandler("onClientHitMarker", glock, function ( hitElement, matchingDimension ) ------Abrir painel no Marker if (getElementType(hitElement) == "player") then abrir () end end) 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) meu script ta assim Edited July 31, 2019 by MatheusWW Link to comment
beast99 Posted July 31, 2019 Share Posted July 31, 2019 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. 1 Link to comment
MatheusWW Posted July 31, 2019 Share Posted July 31, 2019 (edited) function render(hitPlayer, matchingDimension) if (hitPlayer == localPlayer) then addEventHandler("onClientRender", root, pdx) ----Erro render = true showCursor (true) end end addEventHandler("onClientMarkerHit", glock, render) Apareceu só cursor, e o debug detectou um erro no addEventHandler http://prnt.sc/omkkhl Edited July 31, 2019 by MatheusWW Link to comment
beast99 Posted July 31, 2019 Share Posted July 31, 2019 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 1 Link to comment
MatheusWW Posted July 31, 2019 Share Posted July 31, 2019 36 minutes ago, MesaDowN said: function render(hitPlayer, matchingDimension) if (hitPlayer == localPlayer) then addEventHandler("onClientRender", root, Pdx) ----Erro render = true showCursor (true) endendaddEventHandler("onClientMarkerHit", glock, render) Assim deverá funcionar persiste o mesmo erro Link to comment
beast99 Posted July 31, 2019 Share Posted July 31, 2019 (edited) 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. Edited July 31, 2019 by MesaDowN 1 Link to comment
MatheusWW Posted July 31, 2019 Share Posted July 31, 2019 (edited) 25 Bad argument @ "addEventHandler" [expected function at argument 3, got nil] 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 () 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) 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) 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) eu digitei exatamente como tu me passou 19 minutes ago, MesaDowN said: local screenW,screenH = guiGetScreenSize()local resW, resH = 1365,767local 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) endfunction render(hitPlayer, matchingdimension) if (hitPlayer == localPlayer) then addEventHandler("onClientRender", root, Pdx) render = true showCursor(true) endendaddEventHandler ("onClientMarkerHit", glock, render)function abrir (_,state) -------Render do Painelif painel == false thenshowCursor(true)addEventHandler("onClientRender", root, Pdx)painel = trueelseshowCursor(false)removeEventHandler("onClientRender", root, Pdx)painel = falseendendaddEvent("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 endendfunction arma (_,state) if painel == true then if state == "down" then if isCursorOnElement(372, 481, 659, 538) then triggerServerEvent ("glock", localPlayer) end end endendaddEventHandler ("onClientClick", root, arma) Para mim funcionou, qual o seu problema no debugscript? Edit: https://imgur.com/a/opRPMbu ficou assim. é isso mesmo q tem que acontecer mas o meu ta dando esse erro nao sei pq Edited July 31, 2019 by MatheusWW Link to comment
beast99 Posted July 31, 2019 Share Posted July 31, 2019 Na linha 25 coloca o "p" de pdx em letra maiúscula. 1 Link to comment
MatheusWW Posted July 31, 2019 Share Posted July 31, 2019 Muito obrigado pela ajuda! Esta funcionando, agora vou dar uma estudada para ver como faz para ele fechar. Muito obrigado mesmo Link to comment
MatheusWW Posted July 31, 2019 Share Posted July 31, 2019 Pode me indicar algum tópico para eu colocar arma para vender, no retângulo ? A função que estava no retângulo já não funciona mais, quero por a pistola (22) para vender quando clica no retângulo comprar. Link to comment
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