Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 18/04/19 in all areas

  1. As @Zorgman said. A way you can bring serverside and clientside elements closer to each other. server local weapon = createElement("weaponS") client local weapons_s = getElementsByType("weaponS", resourceRoot) for i = 1, #weapons_s do local weapon_s = weapons_s[i] local weapon_c = createWeapon(...) setElementParent(weapon_c, weapon_s) end ElementData can be used to transfer the properties and weapon states. Etc. Ect. Ect. This is a method you have to master, can't be learned with one tutorial.
    1 point
  2. Check out this. Might it helps you setElementSyncer
    1 point
  3. The weapon doesn't exist for the other clients, so it won't fire for them.
    1 point
  4. tonumber você vai ter que continuar usando porque guiGetText retorna uma string, mesmo que nela tenha só números, retorna como string. Na verificação, foi qual delas exatamente, na getPedWeapon? E a mensagem no chat qual foi que mostrou, e verifique também se no debug mostra erros.
    1 point
  5. ---------------------------- 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 -- Neste caso, só é possível salvar na conta que o jogador estava logado por meio do parâmetro de função. Se usar getPlayerAccount agora, vai retornar conta Guest. savePlayerData (source, prevAcc) end end addEventHandler ("onResourceStop", resourceRoot, onPlayerQuitOrResStop) addEventHandler ("onPlayerQuit", getRootElement(), onPlayerQuitOrResStop) addEventHandler ("onPlayerLogout", getRootElement(), onPlayerQuitOrResStop) function loadMyData (_, currAcc) if eventName == "onResourceStart" then -- Foi esperto usar isso para aproveitar a mesma função para eventos diferentes. for i, player in ipairs(getElementsByType("player")) do loadPlayerData (player) end elseif eventName == "onPlayerLogin" then loadPlayerData (source, currAcc) end end addEventHandler ("onResourceStart", resourceRoot, loadMyData) -- Não se usa nome de função igual nome de evento, por isso troquei. addEventHandler ("onPlayerLogin", getRootElement(), loadMyData) -- Recomenda-se colocar os eventos logo após as funções que eles vão ativar, para facilitar a leitura. function savePlayerData (p, acc) local playeraccount = false -- Cria a variável local. if acc then playeraccount = acc -- playerAccount = conta que o jogador ESTAVA logado. Esta variável ainda é local, aqui apenas foi atribuido valor a ela. 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 = getAccountData (playeraccount, "droga.ax") -- Não precisa do 'or false' pois a função getAccountData já retornará false caso a data não exista. local coca = getAccountData (playeraccount, "droga.coca") local bagulho = getAccountData (playeraccount, "droga.maconha") local IngAx1 = getAccountData (playeraccount, "droga.ingax1") local IngAx2 = getAccountData (playeraccount, "droga.ingax2") local IngCoca1 = getAccountData (playeraccount, "droga.ingcoca1") local IngCoca2 = getAccountData (playeraccount, "droga.ingcoca2") local IngCoca3 = getAccountData (playeraccount, "droga.ingcoca3") local sementes = getAccountData (playeraccount, "droga.sementes") if (ax) then setElementData (p, "droga.ax", ax) end -- Passa todas as accountDatas para elementData (isso pesa bastante no servidor, tenha certeza do que está fazendo.) if (coca) then setElementData (p, "droga.coca", coca) end -- Está correto em manter datas parecidas com um índice separado pelo ponto. 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 Não testado. Se tiver erros, mostre o /debugscript 3
    1 point
  6. i have downloaded the map and seen that the collision file contains 2 models, however MTA can only load 1 of them. not sure if you've done it already, but here you have both of the collision models. if this doesn't solve the problem, please hit me up on Discord Corder RS #3423 and i'll try to help fixing the issue @KeksKing https://cdn.discordapp.com/attachments/308955200876707840/568230050311438375/collisions.rar
    1 point
  7. Typically it's either that the model does not have a proper LOD, or collisions are wrong. Try assigning a lod (Create a duplicate of the model with LOD set to true and assign it)
    1 point
  8. Faça assim: addEventHandler("onPlayerQuit", root, function () savePlayerData (source) end ) addEventHandler( "onPlayerLogin", root, function () loadPlayerData (source) end ) E retire a linha 77 e 78 do seu código.
    1 point
  9. Then try to inscare the load distance. engineSetModelLODDistance(YOUR_MODEL_ID, 300) (I think your model is too big, and if you go far from the center, the object is unloading.)
    1 point
  10. https://wiki.multitheftauto.com/wiki/SetOcclusionsEnabled
    1 point
  11. A variável Carga_Diesel está com erro. Mas sim, é possível checar a vida de uma carga anexada ao caminhão. Mande a parte do código onde vc declara a variável Carga_Diesel.
    1 point
  12. Together with a few others, you meticulously set up a plan to routinely get the IP addresses of a lot of MTA players, for the purpose of DDoS'ing them. Your motive (the scheme these actions were part of) are known to me and make your situation even worse. Everyone playing MTA has the right to play wherever they want without a risk to fall victim to cybercriminals like you. Unfortunately, for you there is no future on MTA. At this point, we really don't care about your plans for mapping on a local server.
    1 point
×
×
  • Create New...