Jump to content

Ajuda Script Login.Lua


Recommended Posts

Se alguém puder ajudar, é de um server de DayZ, não sei se estou postando no lugar certo, peço desculpas, sou novo no forum e novo em fazer Script. Estou tendo o seguinte erro:

WARNING: [DayZ-MTA]\DayZ\login.lua:351: Bad argument @ 'destroyElement' [Expected element at argument 1, got boolean]

local spawnPositions = { 
  {
    -278.6669921875,
    -2882.1572265625,
    32.104232788086
  },
  {
    -958.5595703125,
    -2887.9912109375,
    64.82421875
  },
  {
    -1816.9375,
    -2748.18359375,
    1.7327127456665
  },
  {
    -2816.166015625,
    -2439.0546875,
    2.4004096984863
  },
  {
    -2941.5673828125,
    -1206.2373046875,
    2.7848854064941
  },
  {
    -2911.51171875,
    -895.22265625,
    2.4013109207153
  },
  {
    -2185.6669921875,
    2957.380859375,
    11.474840164185
  },
  {
    272.2265625,
    2928.505859375,
    1.3713493347168
  },
  {
    2803.943359375,
    595.9365234375,
    7.7612648010254
  },
  {
    2883.7509765625,
    -178.4658203125,
    3.2714653015137
  },
  {
    -233.46484375,
    -1735.8173828125,
    1.5520644187927
  },
  {
    -1056.8720703125,
    2939.068359375,
    42.311294555664
  }
}
local playerDataTable = {
  {"alivetime"},
  {"skin"},
  {"MAX_Slots"},
  {"bandit"},
  {"blood"},
  {"food"},
  {"thirst"},
  {
    "temperature"
  },
  {
    "currentweapon_1"
  },
  {
    "currentweapon_2"
  },
  {
    "currentweapon_3"
  },
  {"bleeding"},
  {"brokenbone"},
  {"pain"},
  {"cold"},
  {"infection"},
  {"humanity"},
  {
    "zombieskilled"
  },
  {"headshots"},
  {"murders"},
  {
    "banditskilled"
  },
  {"Wood Pile"},
  {"Bandage"},
  {
    "Bouteille"
  },
  {"Pasta Can"},
  {"Beans Can"},
  {"Burger"},
  {
    "Box of Matches"
  },
  {"M1911 Mag"},
  {"M9 SD Mag"},
  {
    "Desert Eagle Mag"
  },
  {"M1911"},
  {"M9 SD"},
  {
    "Winchester 1866"
  },
  {"PDW"},
  {
    "Hunting Knife"
  },
  {"Hatchet"},
  {"Pizza"},
  {"Morphine"},
  {
    "Soda Bottle"
  },
  {
    "Empty Gas Canister"
  },
  {
    "Full Gas Canister"
  },
  {"Roadflare"},
  {"Milk"},
  {"PDW Mag"},
  {"MP5A5 Mag"},
  {"AK Mag"},
  {"M4 Mag"},
  {"Tear Gas"},
  {"Grenade"},
  {
    "Desert Eagle"
  },
  {
    "Sawn-Off Shotgun"
  },
  {
    "SPAZ-12 Combat Shotgun"
  },
  {"MP5A5"},
  {"Watch"},
  {"Medic Kit"},
  {"Heat Pack"},
  {
    "Lee Enfield"
  },
  {"PDW"},
  {"AK-47"},
  {"Blood Bag"},
  {"GPS"},
  {"Map"},
  {"Toolbox"},
  {"Wire Fence"},
  {"Tire"},
  {"Engine"},
  {"Tank Parts"},
  {
    "M136 Rocket"
  },
  {"CZ 550 Mag"},
  {
    "Lee Enfield Mag"
  },
  {"M4"},
  {"CZ 550"},
  {"Satchel"},
  {
    "Infrared Goggles"
  },
  {
    "Night Vision Goggles"
  },
  {"Tent"},
  {"Raw Meat"},
  {
    "Cooked Meat"
  },
  {
    "Camouflage Clothing"
  },
  {
    "Ghillie Suit"
  },
  {
    "Civilian Clothing"
  },
  {
    "Survivor Clothing"
  },
  {"Painkiller"},
  {"Binoculars"},
  {
    "Empty Water Bottle"
  },
  {
    "Empty Soda Cans"
  },
  {
    "Scruffy Burgers"
  },
  {"1866 Slug"},
  {"2Rnd. Slug"},
  {
    "SPAZ-12 Pellet"
  },
  {
    "Radio Device"
  },
  {
    "Baseball Bat"
  },
  {"Shovel"},
  {"Golf Club"},
  {
    "Radio Device"
  },
  {"Parachute"}
}
function playerLogin(username, pass, player)
  local playerID = getAccountData(getPlayerAccount(player), "playerID")
  account = getPlayerAccount(player)
  local x, y, z = getAccountData(account, "last_x"), getAccountData(account, "last_y"), getAccountData(account, "last_z")
  local skin = getAccountData(account, "skin")
  createZombieTable(player)
  if getAccountData(account, "isDead") then
    spawnDayZPlayer(player)
    return
  end
  spawnPlayer(player, x, y, z, math.random(0, 360), skin, 0, 0)
  fadeCamera(player, true)
  setCameraTarget(player, player)
  playerCol = createColSphere(x, y, z, 1.5)
  setElementData(player, "playerCol", playerCol)
  attachElements(playerCol, player, 0, 0, 0)
  setElementData(playerCol, "parent", player)
  setElementData(playerCol, "player", true)
  for i, data in ipairs(playerDataTable) do
    local elementData = getAccountData(account, data[1])
    if not elementData and data[1] ~= "brokenbone" and data[1] ~= "pain" and data[1] ~= "cold" and data[1] ~= "infection" and data[1] ~= "currentweapon_1" and data[1] ~= "currentweapon_2" and data[1] ~= "currentweapon_3" then
      if data[1] == "bandit" then
      else
Link to comment
  • Moderators

Isso está sendo definido apenas na função playerLogin, talvez esteja dando esse erro apenas quando o jogador se registra?

Tente substituindo isto (na linha 351):

destroyElement(getElementData(source, "playerCol")) 

Por isto:

if getElementData(source, "playerCol") then destroyElement(getElementData(source, "playerCol")) end 

Link to comment

WARNING: [DayZ-MTA]\DayZ\survivorSystem.lua:428: Bad argument @ 'setElementID' [Expected element at argument 1, got nil]

WARNING: [DayZ-MTA]\DayZ\survivorSystem.lua:430: Bad argument @ 'destroyElement' [Expected element at argument 1, got nil]

local vehicleDataTableForTent = { 
  {"Wood Pile"},
  {"Bandage"},
  {
    "Bouteille"
  },
  {"Pasta Can"},
  {"Beans Can"},
  {"Burger"},
  {
    "Box of Matches"
  },
  {"M911 Mag"},
  {"M9 SD Mag"},
  {
    "Desert Eagle Mag"
  },
  {"M911"},
  {"M9 SD"},
  {
    "Winchester 1866"
  },
  {"PDW"},
  {
    "Hunting Knife"
  },
  {"Morphine"},
  {"Hatchet"},
  {"Pizza"},
  {
    "Soda Bottle"
  },
  {
    "Empty Gas Canister"
  },
  {
    "Full Gas Canister"
  },
  {"Roadflare"},
  {"Milk"},
  {"PDW Mag"},
  {"MP5A5 Mag"},
  {"AK Mag"},
  {"M4 Mag"},
  {"Tear Gas"},
  {"Grenade"},
  {
    "Desert Eagle"
  },
  {
    "Sawn-Off Shotgun"
  },
  {
    "SPAZ-12 Combat Shotgun"
  },
  {"MP5A5"},
  {"Watch"},
  {"Medic Kit"},
  {"Heat Pack"},
  {
    "Lee Enfield"
  },
  {"AK-47"},
  {"Blood Bag"},
  {"GPS"},
  {"Map"},
  {"Toolbox"},
  {"Wire Fence"},
  {"Tire"},
  {"Engine"},
  {"Tank Parts"},
  {"CZ 550 Mag"},
  {
    "Lee Enfield Mag"
  },
  {"M4"},
  {"CZ 550"},
  {"Satchel"},
  {
    "Infrared Goggles"
  },
  {
    "Night Vision Goggles"
  },
  {"Tent"},
  {"Raw Meat"},
  {
    "Cooked Meat"
  },
  {
    "Camouflage Clothing"
  },
  {
    "Ghillie Suit"
  },
  {
    "Civilian Clothing"
  },
  {
    "Survivor Clothing"
  },
  {"Painkiller"},
  {"Binoculars"},
  {
    "Empty Water Bottle"
  },
  {
    "Empty Soda Cans"
  },
  {
    "Scruffy Burgers"
  },
  {"1866 Slug"},
  {"2Rnd. Slug"},
  {
    "SPAZ-12 Pellet"
  },
  {
    "Assault Pack (ACU)"
  },
  {
    "Czech Vest Pouch"
  },
  {
    "Patrol Pack"
  },
  {
    "Survival (ACU)"
  },
  {
    "British Assault Pack"
  },
  {"Alice Pack"},
  {
    "Radio Device"
  },
  {
    "Coyote Backpack"
  },
  {
    "Czech Backpack"
  },
  {
    "Baseball Bat"
  },
  {"Shovel"},
  {"Golf Club"}
}
weaponAmmoTable = {
  ["M1911 Mag"] = {
    {"M1911", 22}
  },
  ["M9 SD Mag"] = {
    {"M9 SD", 23}
  },
  ["Desert Eagle Mag"] = {
    {
      "Desert Eagle",
      24
    }
  },
  ["PDW Mag"] = {
    {"PDW", 28}
  },
  ["MP5A5 Mag"] = {
    {"MP5A5", 29}
  },
  ["AK Mag"] = {
    {"AK-47", 30}
  },
  ["M4 Mag"] = {
    {"M4", 31}
  },
  ["1866 Slug"] = {
    {
      "Winchester 1866",
      25
    }
  },
  ["2Rnd. Slug"] = {
    {
      "Sawn-Off Shotgun",
      26
    }
  },
  ["SPAZ-12 Pellet"] = {
    {
      "SPAZ-12 Combat Shotgun",
      27
    }
  },
  ["CZ 550 Mag"] = {
    {"CZ 550", 34}
  },
  ["Lee Enfield Mag"] = {
    {
      "Lee Enfield",
      33
    }
  },
  ["M136 Rocket"] = {
    {
      "Heat-Seeking RPG",
      36
    },
    {
      "M136 Rocket Launcher",
      35
    }
  },
  ["others"] = {
    {"Parachute", 46},
    {"Satchel", 39},
    {"Tear Gas", 17},
    {"Grenade", 16},
    {"Hunting Knife", 4},
    {"Hatchet", 8},
    {"Binoculars", 43},
    {"Baseball Bat", 5},
    {"Shovel", 6},
    {"Golf Club", 2},
    {"Radio Device", 1}
  }
}
function getWeaponAmmoType(weaponName, notOthers)
  if not notOthers then
    for i, weaponData in ipairs(weaponAmmoTable.others) do
      if weaponName == weaponData[1] then
        return weaponData[1], weaponData[2]
      end
    end
  end
  for i, weaponData in ipairs(weaponAmmoTable["M1911 Mag"]) do
    if weaponName == weaponData[1] then
      return "M1911 Mag", weaponData[2]
    end
  end
  for i, weaponData in ipairs(weaponAmmoTable["M9 SD Mag"]) do
    if weaponName == weaponData[1] then
      return "M9 SD Mag", weaponData[2]
    end
  end
  for i, weaponData in ipairs(weaponAmmoTable["Desert Eagle Mag"]) do
    if weaponName == weaponData[1] then
      return "Desert Eagle Mag", weaponData[2]
    end
  end
  for i, weaponData in ipairs(weaponAmmoTable["PDW Mag"]) do
    if weaponName == weaponData[1] then
      return "PDW Mag", weaponData[2]
    end
  end
Link to comment
  • Moderators
Vlw, vc me ajudou, resoulveu os 3 problemas acima apenas mudando uma linha, enfim, se aparecer mais problemas eu posto aki, por enquanto ta tudo funcionando, agora estou fazendo testes com o server offline, Obg a todos do fórum que me ajudaram.

Na verdade não estamos aqui para desbugar códigos que vazaram do gamemode DayZ para você.

Tente corrigir você mesmo, ninguém aprendeu Lua sem tentar fazer algo por si mesmo.

Tenha em mente que se você quiser ter um servidor, terá que entender o básico de Lua para não precisar de ajuda com coisas simples. Espero que você tenha me entendido.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...