-
Posts
115 -
Joined
-
Last visited
-
Days Won
1
Everything posted by PashaBiceps
-
Boa noite, gostaria de saber porque isso apenas funciona quando renicio o resource e não quando o jogador entra naquela dimensão. Tem solução? local joao = createPed (202, -23, -57, 1003, 0) setElementInterior(ManuelChapeiro, 6) setElementDimension(ManuelChapeiro, 90) local dimensao = getElementDimension(localPlayer) function wolrdTexts() if dimensao == 90 then dxDrawTextOnElement(joao,"#FFFFFFAtendente #4682B4João #FFFFFF(Frentista)\n #FFFFFFAperta 'N' e clique em mim",1,20,255,255,255,255,1 ,Font_4) end end addEventHandler("onClientRender",root, wolrdTexts)
-
Boa tarde, estou tentando colocar o nome do ped na sua cabeça.. porém to tentando de tudo e não consigo de jeito nenhum. Teriam uma base para me ajudar? Obrigado desde já! Tenho isto. addEventHandler( "onClientRender", root, function( ) local ped = { getPedBonePosition( ped, 8 ) } ped[ 3 ] = ped[ 3 ] + 0.3 local x, y = getScreenFromWorldPosition( ped[ 1 ], ped[ 2 ], ped[ 3 ] ) local dist = getDistanceBetweenPoints3D( ped[ 1 ], ped[ 2 ], ped[ 3 ], getElementPosition( localPlayer ) ) local cam = { getCameraMatrix( ) } if x and y then if dist < 30 then if isLineOfSightClear( cam[ 1 ], cam[ 2 ], cam[ 3 ], ped[ 1 ], ped[ 2 ], ped[ 3 ] + 0.3, true, false, false ) then local scale = math.min( 5 / dist, 1 ) local alpha = math.min( 400 / dist, 255 ) dxDrawText( "(NPC) Empregos", x + 2, y + 2, x, y, tocolor(35, 35, 35, alpha), scale, fonts[ 2 ], "center", "center" ) dxDrawText( "#b070ff(NPC)#FFFFFF Empregos", x, y, x, y, tocolor(255, 255, 255, alpha), scale, fonts[ 2 ], "center", "center", false, false, false, true ) end end end end )
-
Resolvido! Obrigado!
-
for i = 1, #peds do ped = createPed(peds[i][1], peds[i][3], peds[i][4], peds[i][5]) setElementRotation(ped, 0, 0, peds[i][6]) setElementData(ped, "name", peds[i][2], true) setElementInterior (ped, 6) setElementDimension (ped, 90) setPedAnimation ( ped, "ped", "IDLE_CHAT", 1 ) end function clickPed(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) if (clickedElement) and (getElementType(clickedElement) == "ped" ) then local x, y, z = getElementPosition(getLocalPlayer()) local wx, wy, wz = getElementPosition(clickedElement) local jij = getLocalPlayer() if (getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3) and (button == "left") and (state == "down" ) then local ped = getElementData(clickedElement, "name") if (ped=="John") then Dx_Posto () end end end end addEventHandler("onClientClick", getRootElement(), clickPed, true) Bom eu coloquei isso, e está tudo funcional porém ao clicar no ped o painel "Dx_Posto" aparece e some no mesmo instante. Gostaria de solicitar ajuda.
-
Hello, im trying to export a funcion to another resource using: exports["portaomecanico"]:Portao1() <script src="Portao.lua" type="shared" /> <export function="Portao1" type="shared" /> <export function="Portao2" type="shared" /> My objective is clicking on the keys from inventory to open the gate, but is not opening. Im trying to use the first funcion that is that open the gate. I already tried to put create and moving object directly in the key but he is always open the gate and creating a new one. If someone can help me, i aprecciate. Frente = createObject ( 9625, 2325.1000976563, -1912.8399658203, 15.560000419617, 0, 0, 0 ) function Portao1(thePlayer) for _, group in ipairs ({"Mecanico"}) do if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group )) then moveObject (Frente, 2000, 2325.1000976563, -1912.8399658203, 21.290000915527 ) end end end function Portao2(thePlayer) for _, group in ipairs ({"Mecanico"}) do if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group )) then moveObject (Frente, 2000, 2325.1000976563, -1912.8399658203, 15.560000419617 ) end end end
-
Boa tarde, estou tentando exportar uma função para outro resource usando: exports["portaomecanico"]:Portao1() <script src="Portao.lua" type="shared" /> <export function="Portao1" type="shared" /> <export function="Portao2" type="shared" /> O meu objetivo é que ao clicar nas chaves do inventário abra o portão, porém não está abrindo. Estou tentando só com a primeira função que é a que abre. Já tentei colocar o create e mover objeto diretamente na chave mas estava sempre a abrir e criar um novo portão ao usar a chave. Se me puderem ajudar, agradeço Frente = createObject ( 9625, 2325.1000976563, -1912.8399658203, 15.560000419617, 0, 0, 0 ) function Portao1(thePlayer) for _, group in ipairs ({"Mecanico"}) do if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group )) then moveObject (Frente, 2000, 2325.1000976563, -1912.8399658203, 21.290000915527 ) end end end function Portao2(thePlayer) for _, group in ipairs ({"Mecanico"}) do if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group )) then moveObject (Frente, 2000, 2325.1000976563, -1912.8399658203, 15.560000419617 ) end end end
-
Oxi.. Se fosse a mesma, postaria lá não aqui kkk
-
Boa tarde, eu construi um inventário e quase tudo está funcionando perfeitamente. Porém o inventário está para todo mundo no servidor, todo mundo usa o mesmo inventário e o que eu queria cada um ter o seu inventário. Não sei o que está errado, o que pode ser? Não dá erros nem nada, desanimei muito. Obrigado pela ajuda desde já É assim que abro o inventário bindKey('i', 'down', function () if isPedDead(localPlayer) then outputChatBox("Tu não podes abrir o inventário morto!", 255, 255, 255, true) return end if getElementData(localPlayer, 'charFollow') or false then outputChatBox("Não podes abrir o inventário porque alguém te leva!", 255, 255, 255, true) return end if getElementData(localPlayer, 'timedOut') or false then outputChatBox("Só podes abrir o inventário em 5 segundos!", 255, 255, 255, true) return end if getElementData(localPlayer, 'algemado') or false then outputChatBox("Não podes abrir o inventário porque estás algemado!", 255, 255, 255, true) return end if not startCraft then showInventory = not showInventory if showInventory then cursorInSlot = {-1, -1, -1, -1} movedItem = {-1, -1, -1, -1} openInventory(localPlayer) activeInvState = 'bag' craftTick = 0 playSound("files/sounds/open.mp3", false) setTimer(function() removeEventHandler('onClientRender', root, drawInventory) addEventHandler('onClientRender', root, drawInventory, true, 'low-5') end, 50, 1) toggleControl ("fire", false) else bodySearch = true showInventory = false cursorinInventory = false isMove = false cursorInSlot = {-1, -1, -1, -1} movedItem = {-1, -1, -1, -1} itemTable = playerItemTable playSound("files/sounds/close.mp3", false) setElementData(localPlayer, "playerInUse", false) setElementData(localPlayer, 'char >> element', false) removeEventHandler('onClientRender', root, drawInventory) if getElementType(inventoryElement) == 'vehicle' then setElementData(inventoryElement, "clickToVehicle", 0) setElementData(inventoryElement, "inUse", false) triggerServerEvent('krtMTA->#doorState', inventoryElement, inventoryElement, 0) end toggleControl ("fire", true) inventoryElement = localPlayer end end end)
-
Não funcionou infelizmente, passou de nil value para string value.
-
Porque está dando esse erro nesta função? Como posso corrigi-lo? Estava a tudo a funcionar perfeitamente, do nada começou a dar esse erro. A linha do erro está marcada. Obrigado desde já! attempt to perform arithmetic on a nil value addEvent("traficante:sementesSuccess", true) addEventHandler("traficante:sementesSuccess", root, function() local account = getPlayerAccount(source); setElementData(source,"droga.sementes", tonumber(getElementData(source,"droga.sementes") or 0) +1) << LINHA DO ERRO setAccountData(account,"droga.sementes",getElementData(source,"droga.sementes")) exports["krt_items"]:giveItem(source, 145, 1, 1, 1) outputChatBox("#996600[Traficante] #32CD32Sucesso. #FFFFFFTu apanhas-te 1 Folha de #996600Canábis#ffffff e agora estás com: #996600"..getElementData(source,"droga.sementes").." #FFFFFFfolha(s) de #996600Canábis.", source, 255, 255, 255, true); end )
-
Olá, eu gostaria de fazer algo mas não sei bem como o fazer.. Bom como se pode ver abaixo está a salvar a data normalmente, os peixes no caso, e está perfeitamente funcional mas eu criei um inventário e quero atribuir ao inventário a mesma quantidade que existe na data ( pescador.peixe ) para atribuir um item é da seguinte forma. -- ( ID DO ITEM, QUANTIDADE ) exports["krt_items"]:giveItem(player, 218, 10) A minha pergunta é como eu posso fazer com que invés de escrever a quantidade do item, ele detete o valor que existe na data e a atribua o item com esse valor? Assim está o script de salvamento. Obrigado por toda ajuda desde já function onResourceStart() local players = getElementsByType("player") for i, p in ipairs(players) do local sourceAccount = getPlayerAccount(p) if isGuestAccount(sourceAccount) then setElementData(p, "pescador.peixe", 0) else if getAccountData(sourceAccount, "pescador.peixe") then setElementData(p, "pescador.peixe", getAccountData(sourceAccount, "pescador.peixe")) exports["krt_items"]:giveItem(player, 218, 10) end if not getAccountData(sourceAccount, "pescador.peixe") then setElementData(p, "pescador.peixe", 0) end end end end addEventHandler("onResourceStart", resourceRoot, onResourceStart)
-
Estou tento esse erro nessa linha, como posso resolver? Obrigado a toda ajuda dbExec(database, "CREATE TABLE IF NOT EXISTS items (id INT, itemValue TEXT, itemID INT, type TEXT, owner TEXT, slot INT, index INT)") dbExec failed; (1) near "index": syntax error
-
Sem qualquer erro, mas não salva ao relogar ainda. Obrigado por estar ajudando Como estou a atribuir a data, um exemplo: addCommandHandler("droga", function(player) local acc = getPlayerAccount ( player ) setElementData(player,"droga.maconha", tonumber(getElementData(player,"droga.maconha") or 0) +10) setAccountData(acc,"droga.maconha",getElementData(player,"droga.maconha")) setElementData(player,"droga.coca", tonumber(getElementData(player,"droga.coca") or 0) +10) setAccountData(acc,"droga.coca",getElementData(player,"droga.coca")) setElementData(player,"droga.ax", tonumber(getElementData(player,"droga.ax") or 0) +10) setAccountData(acc,"droga.ax",getElementData(player,"droga.ax")) end ) Como está o salvamento: ---------------------------- SALVAR function onPlayerQuitOrResStop (prevAcc, _) if eventName == "onResourceStop" then for i, player in ipairs(getElementsByType("player")) do savePlayerData (player) end elseif eventName == "onPlayerQuit" then savePlayerData (source) elseif eventName == "onPlayerLogout" then savePlayerData (source, prevAcc) end end addEventHandler ("onResourceStop", resourceRoot, onPlayerQuitOrResStop) addEventHandler ("onPlayerQuit", getRootElement(), onPlayerQuitOrResStop) addEventHandler ("onPlayerLogout", getRootElement(), onPlayerQuitOrResStop) function loadMyData (_, currAcc) if eventName == "onResourceStart" then for i, player in ipairs(getElementsByType("player")) do loadPlayerData (player) end elseif eventName == "onPlayerLogin" then loadPlayerData (source, currAcc) end end addEventHandler ("onResourceStart", resourceRoot, loadMyData) addEventHandler ("onPlayerLogin", getRootElement(), loadMyData) function savePlayerData (p, acc) local playeraccount = false if acc then playeraccount = acc else playeraccount = getPlayerAccount (p) end if (playeraccount) and not isGuestAccount (playeraccount) then --local trabalhotr = playerTraficante[p] or "n/a" local ax = playerAx[p] local coca = playerCoca[p] local bagulho = playerBagulho[p] local IngAx1 = playerIngAx1[p] local IngAx2 = playerIngAx2 [p] local IngCoca1 = playerIngCoca1 [p] local IngCoca2 = playerIngCoca2 [p] local IngCoca3 = playerIngCoca3 [p] local sementes = playerSementes [p] setAccountData (playeraccount, "droga.ax", ax) setAccountData (playeraccount, "droga.coca", coca) setAccountData (playeraccount, "droga.maconha", bagulho) setAccountData (playeraccount, "droga.ingax1", IngAx1) setAccountData (playeraccount, "droga.ingax2", IngAx2) setAccountData (playeraccount, "droga.ingcoca1", IngCoca1) setAccountData (playeraccount, "droga.ingcoca2", IngCoca2) setAccountData (playeraccount, "droga.ingcoca3", IngCoca3) setAccountData (playeraccount, "droga.sementes", sementes) end end function loadPlayerData (p, acc) local playeraccount = false if acc then playeraccount = acc else playeraccount = getPlayerAccount (p) end if (playeraccount) and not isGuestAccount (playeraccount) then local ax = getElementData (p, "droga.ax") local coca = getElementData (p, "droga.coca") local bagulho = getElementData (p, "droga.maconha") local IngAx1 = getElementData (p, "droga.ingax1") local IngAx2 = getElementData (p, "droga.ingax2") local IngCoca1 = getElementData (p, "droga.ingcoca1") local IngCoca2 = getElementData (p, "droga.ingcoca2") local IngCoca3 = getElementData (p, "droga.ingcoca3") local sementes = getElementData (p, "droga.sementes") if (ax) then setElementData (p, "droga.ax", ax) end if (coca) then setElementData (p, "droga.coca", coca) end if (bagulho) then setElementData (p, "droga.maconha", bagulho) end if (IngAx1) then setElementData (p, "droga.ingax1", IngAx1) end if (IngAx2) then setElementData (p, "droga.ingax2", IngAx2) end if (IngCoca1) then setElementData (p, "droga.ingcoca1", IngCoca1) end if (IngCoca2) then setElementData (p, "droga.ingcoca2", IngCoca2) end if (IngCoca3) then setElementData (p, "droga.ingcoca3", IngCoca3) end if (sementes) then setElementData (p, "droga.sementes", sementes) end end end
-
Infelizmente, ainda não salva ao relogar.
-
Olá gente o meu salvamento está a funcionar ao reniciar, ligar ou desligar o resource. Mas infelizmente não está salvando quando o player sai e entra no servidor. O que poderá ser? Obrigado por toda a ajuda ---------------------------- SALVAR function onPlayerQuitOrResStop ( ) if eventName == "onResourceStop" then for _, player in ipairs(getElementsByType("player")) do savePlayerData( player ) end return end savePlayerData( source ) end function onPlayerLogin (_, playeraccount ) if eventName == "onResourceStart" then for _, player in ipairs(getElementsByType("player")) do loadPlayerData( player ) end return end loadPlayerData( source ) end function savePlayerData( p ) local playeraccount = getPlayerAccount ( p ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then --local trabalhotr = playerTraficante[p] or "n/a" local ax = playerAx[p] or false local coca = playerCoca[p] or false local bagulho = playerBagulho[p] or false local IngAx1 = playerIngAx1[p] or false local IngAx2 = playerIngAx2 [p] or false local IngCoca1 = playerIngCoca1 [p] or false local IngCoca2 = playerIngCoca2 [p] or false local IngCoca3 = playerIngCoca3 [p] or false local sementes = playerSementes [p] or false setAccountData ( playeraccount, "droga.ax", ax ) setAccountData ( playeraccount, "droga.coca", coca ) setAccountData ( playeraccount, "droga.maconha", bagulho ) setAccountData ( playeraccount, "droga.ingax1", IngAx1 ) setAccountData ( playeraccount, "droga.ingax2", IngAx2 ) setAccountData ( playeraccount, "droga.ingcoca1", IngCoca1 ) setAccountData ( playeraccount, "droga.ingcoca2", IngCoca2 ) setAccountData ( playeraccount, "droga.ingcoca3", IngCoca3 ) setAccountData ( playeraccount, "droga.sementes", sementes ) end end function loadPlayerData( p ) local playeraccount = getPlayerAccount ( p ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local ax = getAccountData ( playeraccount, "droga.ax" ) or false local coca = getAccountData ( playeraccount, "droga.coca" ) or false local bagulho = getAccountData ( playeraccount, "droga.maconha" ) or false local IngAx1 = getAccountData ( playeraccount, "droga.ingax1" ) or false local IngAx2 = getAccountData ( playeraccount, "droga.ingax2" ) or false local IngCoca1 = getAccountData ( playeraccount, "droga.ingcoca1" ) or false local IngCoca2 = getAccountData ( playeraccount, "droga.ingcoca2" ) or false local IngCoca3 = getAccountData ( playeraccount, "droga.ingcoca3" ) or false local sementes = getAccountData ( playeraccount, "droga.sementes" ) or false if ( ax ) then setElementData ( p, "droga.ax", ax ) end if ( coca ) then setElementData ( p, "droga.coca", coca ) end if ( bagulho ) then setElementData ( p, "droga.maconha", bagulho ) end if ( IngAx1 ) then setElementData ( p, "droga.ingax1", IngAx1 ) end if ( IngAx2 ) then setElementData ( p, "droga.ingax2", IngAx2 ) end if ( IngCoca1 ) then setElementData ( p, "droga.ingcoca1", IngCoca1 ) end if ( IngCoca2 ) then setElementData ( p, "droga.ingcoca2", IngCoca2 ) end if ( IngCoca3 ) then setElementData ( p, "droga.ingcoca3", IngCoca3 ) end if ( sementes ) then setElementData ( p, "droga.sementes", sementes ) end end end addEventHandler ( "onResourceStop", resourceRoot, onPlayerQuitOrResStop ) addEventHandler ( "onResourceStart", resourceRoot, onPlayerLogin ) addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuitOrResStop ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin )
-
Perfeito, obrigado. Fiz o mesmo procedimento em vários
-
Olá gente, estou tendo um problema com vários comandos quero que eles detetem o jogador pelo id. Aqui é um comando deles o que está errado? Obrigado desde já! function getPlayerID( string ) if( string and type( string ) == 'string' ) then local matches = { } for k,v in ipairs( getElementsByType'player' ) do if( string.find( getElementData(v, "ID"), tostring( string ), 0 ) ) then table.insert ( matches, v ); end end if( #matches == 1 ) then return matches[1]; end end return false; end function algemar_jogador ( thePlayer, _, id ) if id then if getPlayerID ( id ) then local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "PM") ) then local player_a_ser_algemado = getPlayerID ( id ) local nick_do_jogador = getPlayerName ( player_a_ser_algemado ) local nick_do_policial = getPlayerName ( thePlayer ) local policiax, policiay, policiaz = getElementPosition ( thePlayer ) local revistadox, revistadoy, revistadoz = getElementPosition ( player_a_ser_algemado ) local dist = getDistanceBetweenPoints3D ( policiax, policiay, policiaz, revistadox, revistadoy, revistadoz ) if ( dist > 5 ) then outputChatBox("#000000[#4286f4PSP#000000]#ffffff Chega #ff0000mais perto#ffffff do jogador para usar o comando!", thePlayer, 255, 255, 255, true) elseif ( dist < 4 )then setElementData(player_a_ser_algemado,"algemado", nick_do_jogador) setPedAnimation( player_a_ser_algemado, "GRAVEYARD", "mrnm_loop", -1, true, false, false, false) setElementFrozen( player_a_ser_algemado, true ) toggleControl(player_a_ser_algemado, "fire", false) outputChatBox("#000000[#4286f4PSP#000000]#ffffff #ff0000"..nick_do_jogador.."#ffffff foi algemado pelo #4286f4Agente "..nick_do_policial.."", root, 255, 255, 255, true) outputChatBox("#000000[#4286f4PSP#000000]#ffffff Tu foste #ff0000algemado#ffffff! ", player_a_ser_algemado, 255, 255, 255, true) end end else outputChatBox("#000000[#4286f4PSP#000000]#ffffff Tu #ff0000não tens permissão#ffffff para usar este comando!", thePlayer, 255, 255, 255, true) end end end addCommandHandler("algemar", algemar_jogador)
-
Eu entendi claramente, tento sempre aprender com cada erro que me deparo, nunca posto problemas com o mesmo erro que já resolvi antes, aprendo a resolve-los, e não, não estou copiando e colando porque não é só esse erro, eu apenas coloco uma base pois tinha mais 30 erros iguais. Todos resolvidos. Obrigado @MainSCR Obrigado @Lord Henry
-
Erro sumiu agora estou recebendo um outro nessa linha if (getElementData(source,"pecas.mecanico") == 7) then attempt to compare number with boolean
-
O meu script está a dar um erro na seguinte linha, como posso resolver? local distance = getDistanceBetweenPoints3D ( ePos[1], ePos[2], ePos[3], pPos[1], pPos[2], pPos[3] ); attempt to index local 'ePos' (a number value) Obrigado desde já addEvent ( "onClientRequestRepair", true ); addEventHandler ( "onClientRequestRepair", root, function ( element ) local ePos = getElementPosition ( element ); local pPos = getElementPosition ( source ); local distance = getDistanceBetweenPoints3D ( ePos[1], ePos[2], ePos[3], pPos[1], pPos[2], pPos[3] ); if not isObjectInACLGroup ("user."..accName,aclGetGroup("Mecanico")) then return addNotification(source, "Não percebes nada disso, deixa com os especialistas!", "error") end if ( distance > 3 ) then if not (playerReparando[source]) then if (getElementData(source,"pecas.mecanico") == 7) then if (getElementModel(source, 50)) then setPedAnimation(source, "BOMBER", "bom_plant", -1, true, false); triggerClientEvent(source, "mecanico:reparando", source, config.timeToWait); playerReparando[source] = true; playerReparandoTimer[source] = setTimer( function(source) playerReparando[source] = nil; setPedAnimation(source, nil); fixVehicle ( element ); end, config.timeToWait * 60000, 1, source) else addNotification(source, "Não podes reparar um carro assim com essa roupinha nova, vais-te sujar todo!", "warning") end else addNotification(source, "Não tens peças suficientes para reparar o veículo!", "error") end else addNotification(source, "Já estás a reparar um veículo!", "warning") end else addNotification(source, "Não tem nenhum veículo nas proximidades!", "warning") end end )
-
Está na linha dos locals, de qualquer forma já resolvi. Muito obrigado