Hize Posted February 14, 2019 Share Posted February 14, 2019 local screenW,screenH = guiGetScreenSize() local resW, resH = 1365,767 local x, y = (screenW/resW), (screenH/resH) painel = false function convertTime(ms) local min = math.floor ( ms/60000 ) local sec = math.floor( (ms/1000)%60 ) return min, sec end function dx () dxDrawRectangle((screenW - 323) / 2, (screenH - 465) / 2, 323, 465, tocolor(0, 0, 0, 185), false) dxDrawText("Ak 47", 657, 302, 710, 331, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "center", false, false, false, false, false) dxDrawRectangle(519, 299, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawImage(471, 321, 320, 110, "Img/30.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(519, 403, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawRectangle(519, 181, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawRectangle(519, 507, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawText("Deagle", 644, 406, 697, 435, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "center", false, false, false, false, false) dxDrawText("Uzi", 667, 184, 720, 213, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "center", false, false, false, false, false) dxDrawImage(513, 221, 240, 110, "Img/28.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(509, 425, 256, 128, "Img/24.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Trafico De Armas", 548, 151, 824, 181, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Fechar", 650, 564, 86, 31, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "top", false, false, false, false, false) end function painel_tempo () local timer = interpolateBetween(120000, 0, 0, 0, 0, 0, (getTickCount()-tick)/60000, "Linear") local minutes, seconds = convertTime(timer) dxDrawRectangle(17, 251, 116, 44, tocolor(0, 0, 0, 211), false) dxDrawRectangle(17, 242, 115, 19, tocolor(255, 255, 255, 255), false) dxDrawText("Tempo", 21, 245, 123, 261, tocolor(0, 0, 0, 254), 1.50, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(""..minutes..":"..seconds, 33, 266, 122, 290, tocolor(255, 255, 255, 255), 2.00, "default", "center", "top", false, false, false, false, false) end function abrirpainel () if painel == false then addEventHandler ("onClientRender", root, dx) tick = getTickCount() showCursor (true) painel = true end end addEvent ("open", true) addEventHandler ("open", root, abrirpainel) function fecharpainel (_,state) if painel == true then if state == "down" then if isCursorOnElement (640, 564, 86, 31) then removeEventHandler ("onClientRender", root, dx) showCursor (false) painel = false end end end end addEventHandler ("onClientClick", root, fecharpainel) function click (_,state) if painel == true then if state == "down" then if isCursorOnElement(471, 321, 320, 110) then triggerServerEvent("anim4", localPlayer) addEventHandler ("onClientRender", root, painel_tempo) removeEventHandler ("onClientRender", root, dx) setTimer(function() removeEventHandler("onClientRender", root, painel_tempo) showCursor (false) painel = false end, 120000, 1) elseif isCursorOnElement(513, 221, 240, 110) then triggerServerEvent("animuzi", localPlayer) addEventHandler ("onClientRender", root, painel_tempo) removeEventHandler ("onClientRender", root, dx) setTimer(function() removeEventHandler("onClientRender", root, painel_tempo) showCursor (false) painel = false end, 120000, 1) elseif isCursorOnElement(509, 425, 256, 128) then triggerServerEvent("animdesert", localPlayer) addEventHandler ("onClientRender", root, painel_tempo) removeEventHandler ("onClientRender", root, dx) setTimer(function() removeEventHandler("onClientRender", root, painel_tempo) showCursor (false) painel = false end, 120000, 1) end end end end addEventHandler("onClientClick", root, click) 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 Link to comment
Blaack Posted February 16, 2019 Share Posted February 16, 2019 Cade o server-side amigo? Link to comment
Hize Posted March 25, 2019 Author Share Posted March 25, 2019 se passou um mês e estou de volta querendo resolver local base = createMarker (181.3017578125,1922.0390625,16.909183502197, "cylinder", 1.5, 0, 255, 0, 90) function open2 (source) triggerClientEvent (source, "open200", root) end addEventHandler ("onMarkerHit", base, open2) function animPlantar () setPedAnimation(source , "BD_FIRE", "wash_up", 2000, true, false, false, false) setTimer (giveWeapon, 2000, 1, source, 31, 1000) end addEvent("DeniS:AnimPlantar",true) addEventHandler("DeniS:AnimPlantar", root, animPlantar) Link to comment
Other Languages Moderators Lord Henry Posted March 25, 2019 Other Languages Moderators Share Posted March 25, 2019 Em nenhum momento vc está chamando o evento "open" do cliente. Você chamou o evento "open200" que nem existe no cliente. Link to comment
Hize Posted March 25, 2019 Author Share Posted March 25, 2019 2 minutes ago, Lord Henry said: Em nenhum momento vc está chamando o evento "open" do cliente. Você chamou o evento "open200" que nem existe no cliente. sim Isso eu arrumei agr vou Ver se vai funcionar e ta faltando no server-side pra add a uzi deagle la so tem a da m4 Link to comment
Hize Posted March 25, 2019 Author Share Posted March 25, 2019 (edited) continua dando o seguinte erro: server triggered clientside event open200,but event is not added clientside local screenW,screenH = guiGetScreenSize() local resW, resH = 1365,767 local x, y = (screenW/resW), (screenH/resH) painel = false function convertTime(ms) local min = math.floor ( ms/60000 ) local sec = math.floor( (ms/1000)%60 ) return min, sec end function painelbase () dxDrawRectangle((screenW - 323) / 2, (screenH - 465) / 2, 323, 465, tocolor(0, 0, 0, 185), false) dxDrawText("Ak 47", 657, 302, 710, 331, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "center", false, false, false, false, false) dxDrawRectangle(519, 299, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawImage(471, 321, 320, 110, "Img/30.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(519, 403, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawRectangle(519, 181, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawRectangle(519, 507, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawText("Deagle", 644, 406, 697, 435, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "center", false, false, false, false, false) dxDrawText("Uzi", 667, 184, 720, 213, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "center", false, false, false, false, false) dxDrawImage(513, 221, 240, 110, "Img/28.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(509, 425, 256, 128, "Img/24.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Trafico De Armas", 548, 151, 824, 181, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Fechar", 650, 564, 86, 31, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "top", false, false, false, false, false) end function painel_tempo () local timer = interpolateBetween(120000, 0, 0, 0, 0, 0, (getTickCount()-tick)/60000, "Linear") local minutes, seconds = convertTime(timer) dxDrawRectangle(17, 251, 116, 44, tocolor(0, 0, 0, 211), false) dxDrawRectangle(17, 242, 115, 19, tocolor(255, 255, 255, 255), false) dxDrawText("Tempo", 21, 245, 123, 261, tocolor(0, 0, 0, 254), 1.50, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(""..minutes..":"..seconds, 33, 266, 122, 290, tocolor(255, 255, 255, 255), 2.00, "default", "center", "top", false, false, false, false, false) end ------------ [ ABRIR E FECHAR ]--------------------- function guiackapaTG() if painel == false then addEventHandler ("onClientRender", root, painelbase) tick = getTickCount() showCursor (true) painel = true end end addEvent("open200", true) addEventHandler("open200", getRootElement(), guiackapaTG) function fecharpainel (_,state) if painel == true then if state == "down" then if isCursorOnElement (640, 564, 86, 31) then removeEventHandler ("onClientRender", root, painelbase) showCursor (false) painel = false end end end end addEventHandler ("onClientClick", root, fecharpainel) ----------------------------------------------------- ------------ [ animaçao ]------------------------------ function click (_,state) if painel == true then if state == "down" then if isCursorOnElement(471, 321, 320, 110) then triggerServerEvent("anim4", localPlayer) addEventHandler ("onClientRender", root, painel_tempo) removeEventHandler ("onClientRender", root, painelbase) setTimer(function() removeEventHandler("onClientRender", root, painel_tempo) showCursor (false) painel = false end, 120000, 1) elseif isCursorOnElement(513, 221, 240, 110) then triggerServerEvent("animuzi", localPlayer) addEventHandler ("onClientRender", root, painel_tempo) removeEventHandler ("onClientRender", root, painelbase) setTimer(function() removeEventHandler("onClientRender", root, painel_tempo) showCursor (false) painel = false end, 120000, 1) elseif isCursorOnElement(509, 425, 256, 128) then triggerServerEvent("animdesert", localPlayer) addEventHandler ("onClientRender", root, painel_tempo) removeEventHandler ("onClientRender", root, painelbase) setTimer(function() removeEventHandler("onClientRender", root, painel_tempo) showCursor (false) painel = false end, 120000, 1) end end end end addEventHandler("onClientClick", root, click) 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 Edited March 25, 2019 by Hize Link to comment
Jonas^ Posted March 25, 2019 Share Posted March 25, 2019 (edited) Qual a necessidade de abrir o painel pelo server-side? Tente usar o client-side para abrir tente assim: local markerBase = createMarker(181.3017578125, 1922.0390625, 16.909183502197, "cylinder", 1.5, 0, 255, 0, 90) local screenW,screenH = guiGetScreenSize() local resW, resH = 1365,767 local x, y = (screenW/resW), (screenH/resH) local painel = false function convertTime(ms) local min = math.floor ( ms/60000 ) local sec = math.floor( (ms/1000)%60 ) return min, sec end function painelbase () dxDrawRectangle((screenW - 323) / 2, (screenH - 465) / 2, 323, 465, tocolor(0, 0, 0, 185), false) dxDrawText("Ak 47", 657, 302, 710, 331, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "center", false, false, false, false, false) dxDrawRectangle(519, 299, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawImage(471, 321, 320, 110, "Img/30.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(519, 403, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawRectangle(519, 181, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawRectangle(519, 507, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawText("Deagle", 644, 406, 697, 435, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "center", false, false, false, false, false) dxDrawText("Uzi", 667, 184, 720, 213, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "center", false, false, false, false, false) dxDrawImage(513, 221, 240, 110, "Img/28.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(509, 425, 256, 128, "Img/24.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Trafico De Armas", 548, 151, 824, 181, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Fechar", 650, 564, 86, 31, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "top", false, false, false, false, false) end function painel_tempo () local timer = interpolateBetween(120000, 0, 0, 0, 0, 0, (getTickCount()-tick)/60000, "Linear") local minutes, seconds = convertTime(timer) dxDrawRectangle(17, 251, 116, 44, tocolor(0, 0, 0, 211), false) dxDrawRectangle(17, 242, 115, 19, tocolor(255, 255, 255, 255), false) dxDrawText("Tempo", 21, 245, 123, 261, tocolor(0, 0, 0, 254), 1.50, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(""..minutes..":"..seconds, 33, 266, 122, 290, tocolor(255, 255, 255, 255), 2.00, "default", "center", "top", false, false, false, false, false) end function openPanel () if painel == false then addEventHandler ("onClientRender", root, painelbase) tick = getTickCount() showCursor (true) painel = true end end addEventHandler("onClientMarkerHit", markerBase, openPanel) function fecharpainel (_,state) if painel == true then if state == "down" then if isCursorOnElement (640, 564, 86, 31) then removeEventHandler ("onClientRender", root, painelbase) showCursor (false) painel = false end end end end addEventHandler ("onClientClick", root, fecharpainel) function click (_, state) if painel == true then if state == "down" then if isCursorOnElement(471, 321, 320, 110) then triggerServerEvent("anim4", localPlayer) addEventHandler ("onClientRender", root, painel_tempo) removeEventHandler ("onClientRender", root, painelbase) setTimer(function() removeEventHandler("onClientRender", root, painel_tempo) showCursor (false) painel = false end, 120000, 1) elseif isCursorOnElement(513, 221, 240, 110) then triggerServerEvent("animuzi", localPlayer) addEventHandler ("onClientRender", root, painel_tempo) removeEventHandler ("onClientRender", root, painelbase) setTimer(function() removeEventHandler("onClientRender", root, painel_tempo) showCursor (false) painel = false end, 120000, 1) elseif isCursorOnElement(509, 425, 256, 128) then triggerServerEvent("animdesert", localPlayer) addEventHandler ("onClientRender", root, painel_tempo) removeEventHandler ("onClientRender", root, painelbase) setTimer(function() removeEventHandler("onClientRender", root, painel_tempo) showCursor (false) painel = false end, 120000, 1) end end end end addEventHandler("onClientClick", root, click) 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 OBS: Não testado. Edited March 25, 2019 by Jonas^ Código indentado. Link to comment
Hize Posted March 25, 2019 Author Share Posted March 25, 2019 25 minutes ago, Jonas^ said: Qual a necessidade de abrir o painel pelo server-side? Tente usar o client-side para abrir tente assim: local markerBase = createMarker(181.3017578125, 1922.0390625, 16.909183502197, "cylinder", 1.5, 0, 255, 0, 90) local screenW,screenH = guiGetScreenSize()local resW, resH = 1365,767local x, y = (screenW/resW), (screenH/resH)local painel = falsefunction convertTime(ms) local min = math.floor ( ms/60000 ) local sec = math.floor( (ms/1000)%60 ) return min, sec endfunction painelbase () dxDrawRectangle((screenW - 323) / 2, (screenH - 465) / 2, 323, 465, tocolor(0, 0, 0, 185), false) dxDrawText("Ak 47", 657, 302, 710, 331, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "center", false, false, false, false, false) dxDrawRectangle(519, 299, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawImage(471, 321, 320, 110, "Img/30.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(519, 403, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawRectangle(519, 181, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawRectangle(519, 507, 323, 3, tocolor(67, 219, 0, 255), false) dxDrawText("Deagle", 644, 406, 697, 435, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "center", false, false, false, false, false) dxDrawText("Uzi", 667, 184, 720, 213, tocolor(255, 255, 255, 255), 2.00, "sans", "left", "center", false, false, false, false, false) dxDrawImage(513, 221, 240, 110, "Img/28.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(509, 425, 256, 128, "Img/24.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Trafico De Armas", 548, 151, 824, 181, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Fechar", 650, 564, 86, 31, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "top", false, false, false, false, false)endfunction painel_tempo () local timer = interpolateBetween(120000, 0, 0, 0, 0, 0, (getTickCount()-tick)/60000, "Linear") local minutes, seconds = convertTime(timer) dxDrawRectangle(17, 251, 116, 44, tocolor(0, 0, 0, 211), false) dxDrawRectangle(17, 242, 115, 19, tocolor(255, 255, 255, 255), false) dxDrawText("Tempo", 21, 245, 123, 261, tocolor(0, 0, 0, 254), 1.50, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(""..minutes..":"..seconds, 33, 266, 122, 290, tocolor(255, 255, 255, 255), 2.00, "default", "center", "top", false, false, false, false, false)end function openPanel () if painel == false then addEventHandler ("onClientRender", root, painelbase) tick = getTickCount() showCursor (true) painel = true end end addEventHandler("onClientMarkerHit", markerBase, openPanel) function fecharpainel (_,state) if painel == true then if state == "down" then if isCursorOnElement (640, 564, 86, 31) then removeEventHandler ("onClientRender", root, painelbase) showCursor (false) painel = false end end endendaddEventHandler ("onClientClick", root, fecharpainel)function click (_, state) if painel == true then if state == "down" then if isCursorOnElement(471, 321, 320, 110) then triggerServerEvent("anim4", localPlayer) addEventHandler ("onClientRender", root, painel_tempo) removeEventHandler ("onClientRender", root, painelbase) setTimer(function() removeEventHandler("onClientRender", root, painel_tempo) showCursor (false) painel = false end, 120000, 1) elseif isCursorOnElement(513, 221, 240, 110) then triggerServerEvent("animuzi", localPlayer) addEventHandler ("onClientRender", root, painel_tempo) removeEventHandler ("onClientRender", root, painelbase) setTimer(function() removeEventHandler("onClientRender", root, painel_tempo) showCursor (false) painel = false end, 120000, 1) elseif isCursorOnElement(509, 425, 256, 128) then triggerServerEvent("animdesert", localPlayer) addEventHandler ("onClientRender", root, painel_tempo) removeEventHandler ("onClientRender", root, painelbase) setTimer(function() removeEventHandler("onClientRender", root, painel_tempo) showCursor (false) painel = false end, 120000, 1) end end end endaddEventHandler("onClientClick", root, click)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 endend OBS: Não testado. Deu erro na linha 77 Link to comment
Hize Posted March 25, 2019 Author Share Posted March 25, 2019 <name>or '...' expected near Link to comment
Jonas^ Posted March 25, 2019 Share Posted March 25, 2019 (edited) Copie o código do site abaixo, o fórum tem um problema, as vezes alguns alienígenas colocam alguns caracteres especiais no código impossibilitando ele de funcionar. Código atualizado: https://pastebin.com/3kGX7Nei OBS: Tirei os que eu vi, se o erro continuar me informe a linha e o erro. @Hize Abra o novo link, achei mais 2 caracteres e removi, teste agora. Edited March 25, 2019 by Jonas^ Correção. 1 Link to comment
Hize Posted March 25, 2019 Author Share Posted March 25, 2019 Até agora abriu man vlw qualquer erro eu volto aqui dnv 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