Jump to content

MKZ

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by MKZ

  1. Eu queria fazer uma auto escola mais na hora do teste com mais de uma pessoa fazendo ela buga por completo como posso resolver isso? Client_Side local rx,ry = guiGetScreenSize() local x,y = (rx/1440),(ry/900) local off_on = false local selected = "" markers = { [1] = {2809.625, -1576.302, 10.928}, [2] = {2840.45, -1571.208, 10.922}, } function painel() dxDrawRectangle(x*529, y*246, x*377, y*208, tocolor(75, 0, 0, 183), false) dxDrawRectangle(x*529, y*246, x*377, y*37, tocolor(11, 0, 0, 255), false) dxDrawText("Auto Escola", x*529, y*246, x*908, y*283, tocolor(255, 255, 255, 255), 2.00*x, "default", "center", "center", false, false, false, false, false) dxDrawRectangle(x*715, y*279, x*17, y*175, tocolor(11, 0, 0, 255), false) dxDrawRectangle(x*569, y*420, x*106, y*31, tocolor(38, 102, 18, 255), false) dxDrawRectangle(x*529, y*401, x*377, y*17, tocolor(11, 0, 0, 255), false) dxDrawRectangle(x*766, y*420, x*106, y*31, tocolor(254, 0, 0, 255), false) dxDrawRectangle(x*532, y*319, x*180, y*24, color1, false) if selected == "Moto" then else color1 = tocolor(0, 0, 0, 0) end if isCursorOnElement(x*532, y*319, x*180, y*24) then color1 = tocolor(255, 81, 81, 255) end dxDrawRectangle(x*532, y*349, x*180, y*24, color2, false) if selected == "Carro" then else color2 = tocolor(0, 0, 0, 0) end if isCursorOnElement(x*532, y*349, x*180, y*24) then color2 = tocolor(255, 81, 81, 255) end dxDrawRectangle(x*532, y*377, x*180, y*24, color3, false) if selected == "Caminhão" then else color3 = tocolor(0, 0, 0, 0) end if isCursorOnElement(x*532, y*377, x*180, y*24) then color3 = tocolor(255, 81, 81, 255) end dxDrawText("Categoria", x*529, y*283, x*716, y*306, tocolor(255, 255, 255, 255), 1.20*x, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Preço", x*732, y*283, x*906, y*306, tocolor(255, 255, 255, 255), 1.20*x, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Moto (A)", x*529, y*321, x*715, y*341, tocolor(255, 255, 255, 255), 1.00*x, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Carro (B)", x*529, y*351, x*715, y*371, tocolor(255, 255, 255, 255), 1.00*x, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Caminhão (C)", x*529, y*381, x*715, y*401, tocolor(255, 255, 255, 255), 1.00*x, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("R$: 2000", x*732, y*321, x*906, y*341, tocolor(255, 255, 255, 255), 1.00*x, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("R$: 5000", x*732, y*351, x*906, y*371, tocolor(255, 255, 255, 255), 1.00*x, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("R$: 7000", x*732, y*381, x*906, y*401, tocolor(255, 255, 255, 255), 1.00*x, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Fazer Carteira", x*569, y*420, x*675, y*451, tocolor(255, 255, 255, 255), 1.00*x, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Cancelar", x*766, y*420, x*872, y*451, tocolor(255, 255, 255, 255), 1.00*x, "default-bold", "center", "center", false, false, false, false, false) end function abrirAutoEscola() if not isEventHandlerAdded("onClientRender", root, painel) then addEventHandler("onClientRender", root, painel) showCursor(true) end end addEvent("AbrirPainelAutoEscola", true) addEventHandler("AbrirPainelAutoEscola", getRootElement(), abrirAutoEscola) --clicks local money = 0 addEventHandler ( "onClientClick", root, function(_,state) if isEventHandlerAdded("onClientRender", root, painel) then if state == "down" then if isCursorOnElement(x*532, y*319, x*180, y*24) then selected = "Moto" money = 2000 elseif isCursorOnElement(x*532, y*349, x*180, y*24) then selected = "Carro" money = 5000 elseif isCursorOnElement(x*532, y*377, x*180, y*24) then selected = "Caminhão" money = 7000 end if isCursorOnElement(x*766, y*420, x*106, y*31) then if isEventHandlerAdded("onClientRender", root, painel) then showCursor(false) selected = "" removeEventHandler("onClientRender", root, painel) end end if isCursorOnElement(x*569, y*420, x*106, y*31) then if selected == "" then triggerServerEvent("infoAutoEscola",localPlayer, localPlayer, "Selecione uma Categoria", "info") return end if getPlayerMoney(getLocalPlayer()) >= money then triggerServerEvent("IniciarAutoEscola", localPlayer, localPlayer, selected,money) triggerServerEvent("AutoEscolaTeste",localPlayer,localPlayer) else triggerServerEvent("infoAutoEscola",localPlayer, localPlayer, "Você não tem dinheiro suficiente", "error") end if isEventHandlerAdded("onClientRender", root, painel) then showCursor(false) selected = "" removeEventHandler("onClientRender", root, painel) end end end end end) addEvent("CreateMarkerAutoEscola", true) addEventHandler("CreateMarkerAutoEscola", root, function(number) local x, y, z = markers[number][1], markers[number][2], markers[number][3] marker = createMarker(x, y, z , "checkpoint", 2.0, 255, 255, 255) if number == 2 then terminou = true end end) addEventHandler ( "onClientMarkerHit", getRootElement(), function(source) triggerServerEvent("onMarkerHitAutoEscola", localPlayer, source) finalizar() end) function finalizar() if isElement(marker) then destroyElement(marker) end if getElementData(getLocalPlayer(), "AutoEscolaDataStarted",false) then triggerServerEvent("infoAutoEscola",localPlayer, localPlayer,"Você terminou o teste","success") end end addEvent("FinalizarTesteAutoEscola", true) addEventHandler ( "FinalizarTesteAutoEscola", root, finalizar) local x,y = guiGetScreenSize() function isCursorOnElement(x, y, w, h) if (not isCursorShowing()) then return false end 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 isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end Server_Side Abrir_AutoEscola = createMarker(2770.561, -1628.517, 11.177, "cylinder", 1.2,16, 111, 231, 90) Blip = createBlipAttachedTo ( Abrir_AutoEscola, 38 ) function OpenguiAE(thePlayer) local account = getPlayerAccount (thePlayer) if isGuestAccount (account) then outputChatBox ( "#106FE7✘ #ffffffAutoEscola #106FE7✘➺ #FFFFFFVocê não pode fazer a carta deslogado, Crie uma Conta!", thePlayer, 255,255,255,true) return end if isElementWithinMarker(thePlayer, Abrir_AutoEscola) then if getElementData(thePlayer, "AutoEscolaDataStarted", true) then exports.infobox:addBox(thePlayer,"Você ja começou um teste","warning") return end triggerClientEvent(thePlayer,"AbrirPainelAutoEscola",thePlayer) end end addEventHandler( "onMarkerHit", Abrir_AutoEscola, OpenguiAE ) function addBoxAutoEscola(element,msg,type) exports.infobox:addBox(element,msg,type) end addEvent("infoAutoEscola", true) addEventHandler("infoAutoEscola", root, addBoxAutoEscola) Moto_Teste = {} Carro_Teste = {} Caminhao_Teste = {} function iniciar(thePlayer, selected,money) exports.infobox:addBox(thePlayer,"Iniciou o Teste de "..selected,"info") setElementData(thePlayer, "AutoEscolaDataPlayer", 1) setElementData(thePlayer, "AutoEscolaDataStarted", true) takePlayerMoney(thePlayer,tonumber(money)) if selected == "Moto" then Moto_Teste[thePlayer] = createVehicle(581,2777.118, -1610.536, 10.922,-0, 0, 272.231) warpPedIntoVehicle(thePlayer, Moto_Teste[thePlayer]) elseif selected == "Carro" then Carro_Teste[thePlayer] = createVehicle(415,2777.118, -1610.536, 10.922,-0, 0, 272.231) warpPedIntoVehicle(thePlayer, Carro_Teste[thePlayer]) elseif selected == "Caminhão" then Caminhao_Teste[thePlayer] = createVehicle(515,2777.118, -1610.536, 10.922,-0, 0, 272.231) warpPedIntoVehicle(thePlayer, Caminhao_Teste[thePlayer]) end end addEvent("IniciarAutoEscola", true) addEventHandler("IniciarAutoEscola", root, iniciar) addEvent("onMarkerHitAutoEscola", true) function teste(element) if isElement(element) then local number = tonumber((getElementData(element, "AutoEscolaDataPlayer") or 1)) if getElementData(element, "AutoEscolaDataStarted", true) then triggerClientEvent(element,"CreateMarkerAutoEscola",element, number) end addEventHandler("onMarkerHitAutoEscola", root, function(source) if source == element then setElementData(source, "AutoEscolaDataPlayer", number +1) if number == 2 then triggerClientEvent(source,"FinalizarTesteAutoEscola",source) exports.infobox:addBox(source,"Você terminou o teste","success") setElementData(source, "AutoEscolaDataStarted", false) if Moto_Teste[source] and isElement(Moto_Teste[source]) then destroyElement ( Moto_Teste[source] ) end if Carro_Teste[source] and isElement(Carro_Teste[source]) then destroyElement ( Carro_Teste[source] ) end if Caminhao_Teste[source] and isElement(Caminhao_Teste[source]) then destroyElement ( Caminhao_Teste[source] ) end return end teste(source) end end) end end addEvent("AutoEscolaTeste", true) addEventHandler("AutoEscolaTeste", root, teste) addEventHandler ( "onVehicleExit", getRootElement(), function(thePlayer) if getElementData(thePlayer,"AutoEscolaDataStarted") then exports.infobox:addBox(thePlayer,"Você falhou no teste","error") destroyElement(markerCheckpoint) setElementData(thePlayer, "AutoEscolaDataPlayer", nil) if Moto_Teste[thePlayer] and isElement(Moto_Teste[thePlayer]) then destroyElement ( Moto_Teste[thePlayer] ) end if Carro_Teste[thePlayer] and isElement(Carro_Teste[thePlayer]) then destroyElement ( Carro_Teste[thePlayer] ) end if Caminhao_Teste[thePlayer] and isElement(Caminhao_Teste[thePlayer]) then destroyElement ( Caminhao_Teste[thePlayer] ) end setElementData(thePlayer, "AutoEscolaDataStarted", false) end end)
  2. eu estou fazendo um script de chamar a staff so que ele funciona tudo certo o problema e que quando eu uso a infobox ele avisa manda o aviso de que nao tem staff on para cada staff que nao ta trabalhando por exemplo se um staff nao esta trabalhando so ta fazendo rp quando eu der /staff vai aparece que tem staff on e que nao tem staff vai mandar os dois avisos como posso resolver isso? addCommandHandler("staff", function(playerSource,commandName) local db = getElementData(playerSource, "debounce") local ID = getElementData(playerSource, "ID") or "N/A" if db == false or not db then setElementData(playerSource,"debounce", true) for _, players in pairs(getElementsByType("player")) do if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(players)), aclGetGroup("Staff")) and getElementData(players, "onProt") then showinfo(players, "O Cidadão "..getPlayerName(playerSource).." ( "..ID.." ) ".."solicitou ajuda", "info") end if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(players)), aclGetGroup("Staff")) and getElementData(players, "onProt") == false then showinfo(playerSource,"Não tem staff ON", "error") else showinfo(playerSource, "Você chamou a staff !", "success") end end setTimer(function() setElementData(playerSource, "debounce", false) end, 1500, 1) else showinfo(playerSource,"Você ja chamou !Aguarde um pouco", "error") end end) function showinfo(element, typeinfo, msg) exports.infobox:addBox(element, typeinfo, msg) end
  3. eu tenho um codigo ele funciona normalmente mas tem um negocio que ta me inritando local pegapa = { } function message (player, message, type) triggerClientEvent(player, config.gerais.infobox, player, message, type) end for i = 1, #config.pegarpa do pegapa[i] = createMarker (config.pegarpa[i].x, config.pegarpa[i].y, config.pegarpa[i].z - 1, "cylinder", 1.2, config.pegarpa[i].cor[1], config.pegarpa[i].cor[2], config.pegarpa[i].cor[3], config.pegarpa[i].cor[4]) createBlipAttachedTo (pegapa[i], config.pegarpa[i].blip) addEventHandler ("onMarkerHit", pegapa[i], function (element) if getElementType (element) == "player" then if isGuestAccount (getPlayerAccount (element)) then return end if not isPedInVehicle (element) then if isElementWithinMarker(element, pegapa[i]) then message (element, "Use /comprarpa", "info") addCommandHandler("comprarpa", function(thePed) comprar(thePed) end) end end end end) end function comprar(thePed) local money = getPlayerMoney(thePed) local pa = tonumber(getElementData(thePed, "SCRP:pa")) or 0 if money >= config.gerais.valordapa then if getElementData (thePed, "SCRP:pa") == 5 then message (thePed, "Você comprou o maximo de pá", "error") else message (thePed, "Você comprou uma pá", "info") setElementData (thePed, "SCRP:pa", pa +1) end else message (thePed, "Você não tem dinheiro suficiente", "error") end end toda vez que uso o comprarpa ele pega a pa, mas se eu sair e entrar no marker denovo e usar o /comprarpa ele pega duas pa de uma vez, e se eu sair e entrar denovo no marker e uso o /comprarpa ele pega tres de uma vez pa, eu queria arrumar isso e colocar pra quando ele comprar so comprar uma pa
  4. esse e meu codigo: function Exit_Veh (thePed) if ( getElementModel ( source ) == 448 ) then if (Moto[thePed]) and isElement(Moto[thePed]) then exports.Scripts_dxInfo:dxInfoAddBox(thePed, "INFO : Você tem 1 minutos e meio para voltar pra van", "error") Tempo[thePed] = setTimer ( function(thePed) if isElement( Object_Pizza[thePed] ) then destroyElement( Object_Pizza[thePed] ) end if isElement( Marker_Entregar[thePed] ) then destroyElement( Marker_Entregar[thePed] ) end if isElement( Blip_Entregar[thePed] ) then destroyElement( Blip_Entregar[thePed] ) end if isElement( Marker_Moto[thePed] ) then destroyElement( Marker_Moto[thePed] ) end if isElement(Moto[thePed]) then destroyElement(Moto[thePed]) end removeCommandHandler("pizza", Pegar_Pizza_Object) setElementData(thePed, "Entrega_Acionada", false) setElementData(thePed, "DNL:Entregar_Pizzas", false) setElementData( thePed, "DNL:Pizza", 0 ) exports.Scripts_dxInfo:dxInfoAddBox(thePed, "INFO : Sua moto foi destruida e seu emprego foi encerrado", "error") end, 30000, 1 ) end end end addEventHandler ("onVehicleExit", root, Exit_Veh) function Enter_Veh (thePed) if (Moto[thePed]) and isElement(Moto[thePed]) then if isTimer(Tempo[thePed]) then killTimer(Tempo[thePed]) end end end addEventHandler ("onVehicleEnter", root, Enter_Veh) o setelementdata fica dando error no debug e a moto nao sumi e nao aparece a mensagem que a moto foi destruida
  5. eu fiz um sistema de /pro, so que quando o player morre ele continua com o pro, eu ja tentei desativar com o evento "onPlayerWasted" mas nao funciona. function godCommand(player) local conta = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..conta, aclGetGroup ( "Staff" ) ) then if getElementData(player,"onProt") then setElementData(player,"onProt",false) setElementModel(player, 0) outputChatBox("O staff "..getPlayerName(player).." esta OFF",root,255,255,0,true) else setElementData(player,"onProt",true) setElementModel(player, 10) outputChatBox("O staff "..getPlayerName(player).." esta ON",root,255,255,0,true) end end end addCommandHandler("pro",godCommand) eu queria colocar o onProt no false quando o player morrer.
  6. quando uma pessoa nova entra no server e faz o login, no local que eu coloquei pra spawnar, fica tudo invisivel em volta obs: ja troquei o local de spawn,e o mapa padrao do mta,e tem o mod savesystem e o meu play.
  7. usei o thePed no script do trabalho de caminhao e nao foi function Exit_Veh (thePed) if (getElementModel (source) == 514) then if getElementData(thePed, "Viagem") == true then triggerClientEvent(thePed, "addBox", root, "INFO : Você tem 1 Minutos e meio para que volte pro caminhão", "error") Tempo[thePed] = setTimer ( function(thePed) if isElement(Marker_Entregar[thePed]) then destroyElement(Marker_Entregar[thePed]) end if isElement(Blip_Entregar[thePed]) then destroyElement(Blip_Entregar[thePed]) end if isElement(Caminhao[thePed]) then destroyElement(Caminhao[thePed]) end if isElement(Carga_Caminhao[thePed]) then destroyElement(Carga_Caminhao[thePed]) end if isElement(Marker_Carga[thePed]) then destroyElement(Marker_Carga[thePed]) end if isElement(Blip_Carga[thePed]) then destroyElement(Blip_Carga[thePed]) end if isElement(Blip_Carga2[thePed]) then destroyElement(Blip_Carga2[thePed]) end if getElementData(thePed, "Viagem") == true then setElementData(source, "Viagem", false) else end triggerClientEvent(thePed, "addBox", root, "INFO : Você não voltou para o veiculo e acabou perdendo a viagem", "info") end, 90000, 1 ) end end end addEventHandler ("onVehicleExit", root, Exit_Veh) function Enter_Veh (thePed) if (Caminhao[thePed]) and isElement(Caminhao[thePed]) then if isTimer(Tempo[thePed]) then killTimer(Tempo[thePed]) end end end addEventHandler ("onVehicleEnter", root, Enter_Veh)
  8. vlw mano me ajudou muito
  9. eu estou tentando fazer com que quando o player saia da van do sedex e envie uma mensagem falando "Voce tem 10 minutos para voltar pra van" senao a van ia ser destruida. Tempo = {} function Exit_Veh (source) if (getElementModel (source) == 413) then if (Carro[source]) and isElement(Carro[source]) then triggerClientEvent(source, "addBox", root, "INFO : Você tem 5 minutos para voltar pra van", "info") Tempo[source] = setTimer ( function() if isElement( Object_Caixa[source] ) then destroyElement( Object_Caixa[source] ) end if isElement( Marker_Entregar[source] ) then destroyElement( Marker_Entregar[source] ) end if isElement( Blip_Entregar[source] ) then destroyElement( Blip_Entregar[source] ) end if isElement( Marker_Van[source] ) then destroyElement( Marker_Van[source] ) end destroyElement (Carro[source]) removeCommandHandler("caixa", Pegar_Caixa_Object) setElementData(source, "Entrega_Acionada", false) setElementData(source, "DNL:Entregar_Cargas", false) setElementData( source, "DNL:Cargas", 0 ) triggerClientEvent(source, "addBox", root, "INFO : Sua van foi destruida e seu emprego foi encerrado", "info") end, 300000, 1 ) end end end addEventHandler ("onVehicleExit", root, Exit_Veh) function Enter_Veh (source) if (Carro[source]) and isElement(Carro[source]) then if isTimer(Tempo[source]) then killTimer(Tempo[source]) end end end addEventHandler ("onVehicleEnter", root, Enter_Veh)
  10. Alguem sabe me dizer oque eu tenho que arrumar no meu script ?
  11. eu estou tentando fazer um aviso que quando o player sair do carro do sedex mandar uma mensagem falando que "voce tem 5 minutos para voltar pra van" senao iria destruir a van, so que o meu script nao ta indo. Tempo = {} function Exit_Veh (source) if (getElementModel (source) == 413) then if (Carro[source]) and isElement(Carro[source]) then triggerClientEvent(source, "addBox", root, "INFO : Você tem 5 minutos para voltar pra van", "info") Tempo[source] = setTimer ( function() if isElement( Object_Caixa[source] ) then destroyElement( Object_Caixa[source] ) end if isElement( Marker_Entregar[source] ) then destroyElement( Marker_Entregar[source] ) end if isElement( Blip_Entregar[source] ) then destroyElement( Blip_Entregar[source] ) end if isElement( Marker_Van[source] ) then destroyElement( Marker_Van[source] ) end destroyElement (Carro[source]) removeCommandHandler("caixa", Pegar_Caixa_Object) setElementData(source, "Entrega_Acionada", false) setElementData(source, "DNL:Entregar_Cargas", false) setElementData( source, "DNL:Cargas", 0 ) triggerClientEvent(source, "addBox", root, "INFO : Sua van foi destruida e seu emprego foi encerrado", "info") end, 300000, 1 ) end end end addEventHandler ("onVehicleExit", root, Exit_Veh) function Enter_Veh (source) if (Carro[source]) and isElement(Carro[source]) then if isTimer(Tempo[source]) then killTimer(Tempo[source]) end end end addEventHandler ("onVehicleEnter", root, Enter_Veh)
×
×
  • Create New...