Jump to content

ber

Members
  • Posts

    167
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by ber

  1. No script de spawn do veículo vai ter uma linha mais ou menos assim: local veiculo = createVehicle(ID, coord X, coord Y, coord Z........) Ela indica o ID do veículo a ser criado e as coordenadas, mas é preciso dar um nome pra ela usando o local *nome* = para que você possa voltar nessa variável e seta a handling ai embaixo dessa linha apenas insira o setVehicleHandling(veiculo, .............)
  2. Então seria melhor usar o código que o Henry informou né? Pois o intuito do meu server é justamente rodar em todos os PCs kkk
  3. Sim, acho que vou fazer um if para não executar essa função para os players que tem a tag de Policial. E para os demais players irei setar para 500.
  4. Olá a todos. Todos já devem ter presenciado uma batida de um veículo 4 rodas em uma moto em que a moto apenas roda um pouco e o piloto nem cai, creio que isso aconteça por causa da perícia em veículos que é setada para o máximo no MTA. Há alguma maneira de diminuir isso para todos os players, fazendo com que em batidas de moto aumentem a chance do indivíduo cair dela e perder a ação. Pois em alguns servidores fica impossível você perder uma fuga de moto, por mais que os PM lhe passem lag você apenas roda e não cai da moto quase nunca. Se eu fizer algo do tipo: (onResourceStart > setPedStats) resolveria?
  5. Nossa ótima idéia, porque ficar excluindo partes do script é ruim porque os players precisam baixar toda vez que relogam. Muito obrigado
  6. Olá a todos. Achei um painel de login muito bem feito na net mas ele tem um problema, só permite uma conta por serial. Já tentei remover isso de todas as maneiras mas não consigo. Segue o script server-side: local badChars = {"!","\"","§","&","/","=","?","`","´","\\","{","}","³","²","@","€","*","+","#","'","~","|","<",">",".",":",",",";","%","(",")","$","[","]"} addEventHandler("onResourceStart", resourceRoot, function() for _, player in ipairs(getElementsByType"player") do logOut(player) end end) local function containsBadChars(n) for _, theChar in ipairs(badChars) do if string.find(n, tostring(theChar), 1, true) then return true end end return false end local function isPlayerRegistered(player) if #getAccountsBySerial(getPlayerSerial(player)) ~= 0 then return true else return false end end local function getPlayersFirstAccount(player) if #getAccountsBySerial(getPlayerSerial(player)) ~= 0 then return getAccountsBySerial(getPlayerSerial(player))[1] else return false end end addEvent("onClientFinishedLoading", true) addEventHandler("onClientFinishedLoading", root, function() local firstAccount = getPlayersFirstAccount(client) triggerClientEvent(client, "onServerRequestLoginRegister", getRootElement(), firstAccount and getAccountName(firstAccount) or false) end ) local function isAccountRegistered(n) local account = getAccount(n) if account then return true else return false end end addEvent("onClientExecute", true) addEventHandler("onClientExecute", root, function(s, inputs) if source ~= client then return end if s == 1 then local pA = getAccount(inputs[1]) if pA then local pL = logIn(client, pA, inputs[2]) if pL then triggerClientEvent(client, "onClientSuccess", client) triggerEvent("onClientLoggedIn", resourceRoot, client) triggerClientEvent(client, "addClientMessage", client, "|Info| #ff8000Type /report [text] for super very fast support :)", 255, 255, 255) return else triggerClientEvent(client, "showErrorMessage", client, "Senha incorreta") end else triggerClientEvent(client, "showErrorMessage", client, "Não foi possível encontrar essa conta!") end elseif s == 2 then for _, t in ipairs(inputs) do if t == nil or t == "" then triggerClientEvent(client, "showErrorMessage", client, "Nome de usuário ou senha incorreta") return end end if containsBadChars(inputs[1]) then triggerClientEvent(client, "showErrorMessage", client, "O nome da conta tem carateres inválidos") return elseif #inputs[2] < 6 then triggerClientEvent(client, "showErrorMessage", client,"Sua senha deve ter mais de 6 caracteres.") return elseif inputs[2] ~= inputs[3] then triggerClientEvent(client, "showErrorMessage", client,"Senhas não coincidem.") return elseif isAccountRegistered(inputs[1]) then triggerClientEvent(client, "showErrorMessage", client,"Esta conta já está registrada.") return elseif isPlayerRegistered(client) then triggerClientEvent(client, "showErrorMessage", client, "Você já está registrado.") return end local nA = addAccount(inputs[1], inputs[2]) if nA then logIn(client, nA, inputs[2]) triggerClientEvent(client, "onClientSuccess", client) setPlayerTeam(client, getTeamFromName("User")) --setAccountData(nA, "cash", 250000) triggerClientEvent(client, "onClientSuccess", client) else triggerClientEvent(client, "showErrorMessage", client, "Um erro ocorreu durante a criação da conta.") end end end) addEventHandler("onPlayerCommand", root, function(cmd) if cmd == "login" or cmd == "register" or cmd == "logout" then cancelEvent() end end) Estou suspeitando que talvez eu tenha conseguido ja remover essa confirmação de uma conta por serial, mas como já criei minha conta através do painel ele ja memorizou esse dado de que eu tenho uma conta e por isso não me permite criar mais mesmo já tendo excluído essa função do código, será que pode ser isso?
  7. Olá a todos. Achei um painel de login muito bem feito na net mas ele tem um problema, só permite uma conta por serial. Já tentei remover isso de todas as maneiras mas não consigo. Segue o script server-side: local badChars = {"!","\"","§","&","/","=","?","`","´","\\","{","}","³","²","@","€","*","+","#","'","~","|","<",">",".",":",",",";","%","(",")","$","[","]"} addEventHandler("onResourceStart", resourceRoot, function() for _, player in ipairs(getElementsByType"player") do logOut(player) end end) local function containsBadChars(n) for _, theChar in ipairs(badChars) do if string.find(n, tostring(theChar), 1, true) then return true end end return false end local function isPlayerRegistered(player) if #getAccountsBySerial(getPlayerSerial(player)) ~= 0 then return true else return false end end local function getPlayersFirstAccount(player) if #getAccountsBySerial(getPlayerSerial(player)) ~= 0 then return getAccountsBySerial(getPlayerSerial(player))[1] else return false end end addEvent("onClientFinishedLoading", true) addEventHandler("onClientFinishedLoading", root, function() local firstAccount = getPlayersFirstAccount(client) triggerClientEvent(client, "onServerRequestLoginRegister", getRootElement(), firstAccount and getAccountName(firstAccount) or false) end ) local function isAccountRegistered(n) local account = getAccount(n) if account then return true else return false end end addEvent("onClientExecute", true) addEventHandler("onClientExecute", root, function(s, inputs) if source ~= client then return end if s == 1 then local pA = getAccount(inputs[1]) if pA then local pL = logIn(client, pA, inputs[2]) if pL then triggerClientEvent(client, "onClientSuccess", client) triggerEvent("onClientLoggedIn", resourceRoot, client) triggerClientEvent(client, "addClientMessage", client, "|Info| #ff8000Type /report [text] for super very fast support :)", 255, 255, 255) return else triggerClientEvent(client, "showErrorMessage", client, "Senha incorreta") end else triggerClientEvent(client, "showErrorMessage", client, "Não foi possível encontrar essa conta!") end elseif s == 2 then for _, t in ipairs(inputs) do if t == nil or t == "" then triggerClientEvent(client, "showErrorMessage", client, "Nome de usuário ou senha incorreta") return end end if containsBadChars(inputs[1]) then triggerClientEvent(client, "showErrorMessage", client, "O nome da conta tem carateres inválidos") return elseif #inputs[2] < 6 then triggerClientEvent(client, "showErrorMessage", client,"Sua senha deve ter mais de 6 caracteres.") return elseif inputs[2] ~= inputs[3] then triggerClientEvent(client, "showErrorMessage", client,"Senhas não coincidem.") return elseif isAccountRegistered(inputs[1]) then triggerClientEvent(client, "showErrorMessage", client,"Esta conta já está registrada.") return elseif isPlayerRegistered(client) then triggerClientEvent(client, "showErrorMessage", client, "Você já está registrado.") return end local nA = addAccount(inputs[1], inputs[2]) if nA then logIn(client, nA, inputs[2]) triggerClientEvent(client, "onClientSuccess", client) setPlayerTeam(client, getTeamFromName("User")) --setAccountData(nA, "cash", 250000) triggerClientEvent(client, "onClientSuccess", client) else triggerClientEvent(client, "showErrorMessage", client, "Um erro ocorreu durante a criação da conta.") end end end) addEventHandler("onPlayerCommand", root, function(cmd) if cmd == "login" or cmd == "register" or cmd == "logout" then cancelEvent() end end) Estou suspeitando que talvez eu tenha conseguido ja remover essa confirmação de uma conta por serial, mas como já criei minha conta através do painel ele ja memorizou esse dado de que eu tenho uma conta e por isso não me permite criar mais mesmo já tendo excluído essa função do código, será que pode ser isso?
  8. Olá, vi que você é novo aqui no fórum. Aqui geralmente não damos scripts prontos, até porque não é difícil achar um painel policial de graça e descompilado pela internet. Dê uma estudada e tente começar de alguma maneira e quando se deparar com um problema poste aqui que ai sim poderemos lhe ajudar.
  9. Ao trancar/destrancar o veículo da um setElementData para indicar o status e quando alguém entrar no veículo e ele estiver trancado, da TP no player pra fora do veículo, usando algo mais ou menos assim: x, y, z = getElementPosition(veiculo) e getElementPosition(player, x + 2, y + 2, z) Também da pra fazer algo mais ou menos assim: (é bom que não precisa dar TP no player porque ele nem vai ter tempo de subir na moto e se for um server de RP deixa mais realista). function carLock() if getVehicleType(source) == Bike then if getElementData(source, "trancado") == true then cancelEvent() end end end addEventHandler("onVehicleStartEnter", root, carLock)
  10. Estou abrindo um servidor e desde o início dele a ideia foi fazer algo diferente dos demais servidores, então estou fazendo bastante scripts exclusivos e os poucos que eu pego na internet eu edito bastante, porém queria saber como faço para protegé-los de cópias, pois quando entro em servidores pequenos basicamente todos os scripts que baixei ficam na pasta do MTA, mas quando entro em servidores grandes os scripts ficam meio que só pela metade, imagino que isso seja proposital para evitar cópias. Queria saber como posso fazer isso com os meus. (compilar eu já sei como faz, mas creio que não é o suficiente)
  11. Vá no script do caixa eletrônico e procure por uma linha de código mais ou menos assim: get/setElementData(source, "Saldo:Banco"). Esse valor que está entre aspas é que irá armazenar o valor do player no banco, aí é só você colocar a mesma coisa na HUD.
  12. marker = createMarker (-2408.33, -601.385, 130.534, "cylinder", 1.5, 072,118,255,999 ) function msg(player) outputChatBox("Ola policial. Abaixos os comandos", player, 072, 118, 255, true) outputChatBox("/armamento #ff0000para pegar o armamento", player, 072, 118, 255, true) outputChatBox("/farda para pegar a farda", player, 072, 118, 255, true) outputChatBox("/vidacolete para pegar vida e colete", player, 072, 118, 255, true) end addEventHandler("onMarkerHit", marker, msg) function pegararmas(player) if isElementWithinMarker(player, marker) then giveWeapon(player, 31, 500) giveWeapon(player, 23, 500) giveWeapon(player, 17, 500) giveWeapon(player, 28, 500) giveWeapon(player, 3, 500) outputChatBox("Você pegou o armamento com suceso", player, 255, 0, 0) else outputChatBox("Você precisa estar no Marker para pegar os armamentos!", player, 255, 0, 0) end end addCommandHandler("armamento", pegararmas) Corrigido ai. Você errou bastante nas funções, sempre que for fazer usar uma função que ainda não a decorou, pesquise-a antes no wiki.mtasa
  13. Thank you all for your help, I managed to resolve. The problem was in the triggerServer / ClientEvent
  14. Faz uma função mais ou menos desse jeito. Todos os servidores usam essa, quando você entra no veículo ainda consegue dar uma acelerada de leve até o script rodar e desligar a engine. addEventHandler = onVehicleEnter if getElementHealth(source) <= 350 then setVehicleEngineState(source, false)
  15. No friend, getElementData is just to get the vehicle that was clicked on the Client-Side script.
  16. Hello everyone, this is my first time here on this forum, I have always managed to clarify my doubts without creating topics, just observing the others, but in this case it is very complicated and I can't find where I'm going wrong. I used this script before with just the click on the car and it was already running, but I started to have reports of players who clicked unintentionally and ended up losing 1 repair kit for nothing, so I decided to add a DX confirmation panel when the player clicks on the vehicle . This is the code I made, I have re-read it 10 times and I still haven't found where I may have gone wrong. Please, whoever can help me will be very grateful! (Caso algum BR veja isso, pode responder em português kkkk é nois ;D) ------------------------- SERVER ----------------------------------- function reparo() local veiculo = getElementData(source,"vehSelected") setElementFrozen(veiculo, true) setVehicleDoorOpenRatio(veiculo, 0, 1, 1000) setPedAnimation(source, "CAMERA", "piccrch_take", 14000, true, false, false, false) setTimer(function() fixVehicle(veiculo) setVehicleDamageProof(veiculo, false) setPedAnimation(source, "") setElementFrozen(veiculo, false) setVehicleDoorOpenRatio(veiculo, 0, 0, 1000) end, 14000, 1) end addEvent("reparando", true) addEventHandler("reparando", root, reparo) ------------------------- CLIENT ----------------------------------- addEventHandler("onClientClick", getRootElement(), function(button, state, _, _, _, _, _, veiculo) if button == "left" and state == "down" then if isElement(veiculo) then local x, y, z = getElementPosition(localPlayer) local ex, ey, ez = getElementPosition(veiculo) if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 2.5 then if getElementType(veiculo) == "vehicle" then if getVehicleController(veiculo) == false then if isElementFrozen(veiculo) == false then triggerEvent("openPainel", root) end end end end end end end) function startRepair() local sound = playSound("repair.mp3") setElementData(localPlayer, "vehSelected", veiculo) setElementData(localPlayer, "AirNewSCR_Inventario_Kit_Reparo", Kit_Reparo - 1) exports._infobox:addNotification("-1 Kit de reparo", "info") triggerServerEvent("reparando", localPlayer) setTimer(function() exports._infobox:addNotification("Você reparou o veículo!", "success") end, 14000, 1) end addEvent("startRepair", true) addEventHandler("startRepair", root, startRepair) ---------------------------------------------------------------- local screenW, screenH = guiGetScreenSize() local Kit_Reparo = getElementData ( localPlayer, "AirNewSCR_Inventario_Kit_Reparo" ) painel = false function painelR() dxDrawRectangle(screenW * 0.5447, screenH * 0.4115, screenW * 0.1398, screenH * 0.1732, tocolor(0, 0, 0, 198), false) dxDrawRectangle(screenW * 0.5447, screenH * 0.3724, screenW * 0.1406, screenH * 0.0391, tocolor(0, 0, 0, 255), false) dxDrawLine(screenW * 0.5447, screenH * 0.4115, screenW * 0.6845, screenH * 0.4128, tocolor(174, 78, 14, 255), 2, false) dxDrawRectangle(screenW * 0.5490, screenH * 0.5247, screenW * 0.1318, screenH * 0.0521, tocolor(207, 0, 0, 139), false) dxDrawRectangle(screenW * 0.5490, screenH * 0.4648, screenW * 0.1318, screenH * 0.0521, tocolor(45, 146, 18, 139), false) dxDrawText("REPARAR", screenW * 0.5439, screenH * 0.3724, screenW * 0.6845, screenH * 0.4115, tocolor(184, 184, 184, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("KITs de reparo: "..Kit_Reparo.., screenW * 0.5483, screenH * 0.4128, screenW * 0.6808, screenH * 0.4648, tocolor(255, 255, 255, 255), 1.00, "clear", "center", "center", false, false, false, false, false) dxDrawText("REPARAR", (screenW * 0.5490) - 1, (screenH * 0.4648) - 1, (screenW * 0.6808) - 1, (screenH * 0.5169) - 1, tocolor(0, 0, 0, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("REPARAR", (screenW * 0.5490) + 1, (screenH * 0.4648) - 1, (screenW * 0.6808) + 1, (screenH * 0.5169) - 1, tocolor(0, 0, 0, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("REPARAR", (screenW * 0.5490) - 1, (screenH * 0.4648) + 1, (screenW * 0.6808) - 1, (screenH * 0.5169) + 1, tocolor(0, 0, 0, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("REPARAR", (screenW * 0.5490) + 1, (screenH * 0.4648) + 1, (screenW * 0.6808) + 1, (screenH * 0.5169) + 1, tocolor(0, 0, 0, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("REPARAR", screenW * 0.5490, screenH * 0.4648, screenW * 0.6808, screenH * 0.5169, tocolor(255, 255, 255, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("CANCELAR", (screenW * 0.5490) - 1, (screenH * 0.5247) - 1, (screenW * 0.6808) - 1, (screenH * 0.5768) - 1, tocolor(0, 0, 0, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("CANCELAR", (screenW * 0.5490) + 1, (screenH * 0.5247) - 1, (screenW * 0.6808) + 1, (screenH * 0.5768) - 1, tocolor(0, 0, 0, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("CANCELAR", (screenW * 0.5490) - 1, (screenH * 0.5247) + 1, (screenW * 0.6808) - 1, (screenH * 0.5768) + 1, tocolor(0, 0, 0, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("CANCELAR", (screenW * 0.5490) + 1, (screenH * 0.5247) + 1, (screenW * 0.6808) + 1, (screenH * 0.5768) + 1, tocolor(0, 0, 0, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("CANCELAR", screenW * 0.5490, screenH * 0.5247, screenW * 0.6808, screenH * 0.5768, tocolor(255, 255, 255, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) end function openPainel() addEventHandler("onClientRender", root, painelR) painel = true showCursor(true) end addEvent("openPainel", true) addEventHandler("openPainel", root, openPainel) function closePainel(_,state) if state == "down" then if isCursorOnElement(screenW * 0.5490, screenH * 0.4648, screenW * 0.6808, screenH * 0.5169) then removeEventHandler("onClientRender", root, painelR) painel = false showCursor(false) end end end addEventHandler("onClientClick", root, closePainel) function repair(_,state) if state == "down" then if isCursorOnElement(screenW * 0.5490, screenH * 0.4648, screenW * 0.6808, screenH * 0.5169) then if Kit_Reparo >= 1 then triggerEvent("startRepair", root) removeEventHandler("onClientRender", root, painelR) painel = false showCursor(false) else exports._infobox:addNotification("Você não possui kit de reparo!", "error") end end end end addEventHandler("onClientClick", root, repair) ------------------------------------------------------------------------------------- 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
×
×
  • Create New...