Jump to content

Ajuda com login.lua


Recommended Posts

Sou novo aqui no fórum, espero estar na área correta de pedidos, se não estiver, me perdoem, e se algum moderador puder mover para uma área que me facilite a ajuda alheia eu agradeço.

Estive arrumando certos problemas que apareciam no meu console do meu servidor de MTA DayZ, mas esse, infelizmente eu não consigo arrumar:

[21:36:07] WARNING: [DayZ-MTA]\DayZ\login.lua:699: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean]
[21:36:08] WARNING: [DayZ-MTA]\DayZ\login.lua:752: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean]

meu login.lua

local spawnPositions = {
  {256.1965,-1827.8783,801.69226},
  {981.36963,-1849.083,795.26715},
  {1713.2578,-2573.8804,805.17169},
  {2412.8772,-1702.0966,808.1944},
  {1745.781,-566.63171,763.92981},
  {2328.0168,59.867683,810.82458},
  {2554.6196,1040.4197,807.63513},
  {2497.3623,1783.6094,801.97906},
  {647.2453,1916.2031,748.92346},
  {230.42903,1944.5013,749.13446},
  {311.00607,2503.1228,662.80219},
  {-867.75281,2387.615,806.88098},
  {-867.75281,2387.615,806.88098},
  {-1483.677,1452.0614,796.61414},
  {-1978.0972,1015.7823,789.87384},
  {-2330.895,-1618.2581,803.35144},
  {-1831.8159,-2103.875,677.6825},
  {-1166.6228,-2823.0159,634.86292}
}
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"
  },
  {
    "Survivor [F] Clothing"
  },
  {
    "Civilian [F] Clothing"
  },
  {
    "Camouflage [F] Clothing"
  },
  {
    "Ghillie [F] Suit"
  },
  {
    "Exercito [M] Clothing"
  },
  {
    "Civil [M] Clothing"
  },
  {
    "Civil [F] Clothing"
  },
  {
    "Sniper [M] Clothing"
  },
  {
    "Policial [M] Clothing"
  },
  {
    "Detetive [F] Clothing"
  },
  {
    "Zombie Clothing"
  },
  {
    "Zombie2 Clothing"
  },
  {
    "Zombie3 Clothing"
  },
  {
    "Anonymous Clothing"
  },
  {
    "Terrorista Clothing"
  },
  {
    "Daryl Dixon Clothing"
  },
  {
    "Anti-Radiation [M] Clothing"
  },
  {
    "Anti-Radiation [F] 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
        elementData = 0
      end
    end
    setElementData(player, data[1], elementData)
  end
  setElementData(player, "logedin", true)
  local weapon = getElementData(player, "currentweapon_1")
  if weapon then
    local ammoData, weapID = getWeaponAmmoType(weapon)
    giveWeapon(player, weapID, getElementData(player, ammoData), true)
  end
  local weapon = getElementData(player, "currentweapon_2")
  if weapon then
    local ammoData, weapID = getWeaponAmmoType(weapon)
    giveWeapon(player, weapID, getElementData(player, ammoData), false)
  end
  local weapon = getElementData(player, "currentweapon_3")
  if weapon then
    local ammoData, weapID = getWeaponAmmoType(weapon)
    giveWeapon(player, weapID, getElementData(player, ammoData), false)
  end
  setElementModel(player, getElementData(player, "skin"))
  setElementData(player, "admin", getAccountData(account, "admin") or false)
  setElementData(player, "supporter", getAccountData(account, "supporter") or false)
  triggerClientEvent(player, "onClientPlayerDayZLogin", player)
end
addEvent("onPlayerDayZLogin", true)
addEventHandler("onPlayerDayZLogin", getRootElement(), playerLogin)
Skins = {}
function playerRegister(username, pass, player)
  local number = math.random(table.size(spawnPositions))
  local x, y, z = spawnPositions[number][1], spawnPositions[number][2], spawnPositions[number][3]
  spawnPlayer(player, x, y, z, math.random(0, 360), 73, 0, 0)
  fadeCamera(player, true)
  setCameraTarget(player, player)
  playerCol = createColSphere(x, y, z, 1.5)
  attachElements(playerCol, player, 0, 0, 0)
  setElementData(playerCol, "parent", player)
  setElementData(playerCol, "player", true)
  for i, data in ipairs(playerDataTable) do
    if data[1] == "Bandage" then
      setElementData(player, data[1], 2)
    elseif data[1] == "Painkiller" then
      setElementData(player, data[1], 1)
    elseif data[1] == "Map" then
      setElementData(player, data[1], 1)
    elseif data[1] == "GPS" then
      setElementData(player, data[1], 1)
    elseif data[1] == "Parachute" then
      setElementData(player, data[1], 1)
    elseif data[1] == "MAX_Slots" then
      setElementData(player, data[1], 15)
    elseif data[1] == "skin" then
      setElementData(player, data[1], 73)
    elseif data[1] == "blood" then
      setElementData(player, data[1], 12000)
    elseif data[1] == "temperature" then
      setElementData(player, data[1], 37)
    elseif data[1] == "brokenbone" then
      setElementData(player, data[1], false)
    elseif data[1] == "pain" then
      setElementData(player, data[1], false)
    elseif data[1] == "cold" then
      setElementData(player, data[1], false)
    elseif data[1] == "infection" then
      setElementData(player, data[1], false)
    elseif data[1] == "food" then
      setElementData(player, data[1], 100)
    elseif data[1] == "thirst" then
      setElementData(player, data[1], 100)
    elseif data[1] == "currentweapon_1" then
      setElementData(player, data[1], false)
    elseif data[1] == "currentweapon_2" then
      setElementData(player, data[1], false)
    elseif data[1] == "currentweapon_3" then
      setElementData(player, data[1], false)
    elseif data[1] == "bandit" then
      setElementData(player, data[1], false)
    elseif data[1] == "humanity" then
      setElementData(player, data[1], 2500)
    else
      setElementData(player, data[1], 0)
    end
  end
  account = getAccount(username)
  local value = getAccounts()
  local value = #value
  setElementData(player, "playerID", value + 1)
  setAccountData(account, "playerID", value + 1)
  setElementData(player, "logedin", true)
  createZombieTable(player)
end
addEvent("onPlayerDayZRegister", true)
addEventHandler("onPlayerDayZRegister", getRootElement(), playerRegister)
function saveAccounts()
  local account = getPlayerAccount(source)
  if account then
    for i, data in ipairs(playerDataTable) do
      setAccountData(account, data[1], getElementData(source, data[1]))
    end
    local x, y, z = getElementPosition(source)
    setAccountData(account, "last_x", x)
    setAccountData(account, "last_y", y)
    setAccountData(account, "last_z", z)
    destroyElement(getElementData(source, "playerCol"))
  end
  setElementData(source, "logedin", false)
end
addEventHandler("onPlayerQuit", getRootElement(), saveAccounts)
function saveAccounts2()
  for i, player in ipairs(getElementsByType("player")) do
    local account = getPlayerAccount(player)
    if account then
      for i, data in ipairs(playerDataTable) do
        setAccountData(account, data[1], getElementData(player, data[1]))
      end
      local x, y, z = getElementPosition(player)
      setAccountData(account, "last_x", x)
      setAccountData(account, "last_y", y)
      setAccountData(account, "last_z", z)
    end
  end
end
addEventHandler("onResourceStop", getRootElement(), saveAccounts2)
local vehicleDataTable = {
  {"MAX_Slots"},
  {
    "Tire_inVehicle"
  },
  {
    "Engine_inVehicle"
  },
  {
    "Parts_inVehicle"
  },
  {"fuel"},
  {"Wood Pile"},
  {"Bandage"},
  {
    "Bouteille"
  },
  {"Pasta Can"},
  {"Beans Can"},
  {"Burger"},
  {
    "Box of Matches"
  },
  {"M1911 Mag"},
  {"M1911"},
  {"M9 SD"},
  {
    "Desert Eagle Mag"
  },
  {
    "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"},
  {
    "M136 Rocket"
  },
  {"CZ 550 Mag"},
  {
    "Lee Enfield Mag"
  },
  {"M4"},
  {"CZ 550"},
  {"Satchel"},
  {
    "Infrared Goggles"
  },
  {
    "Night Vision Goggles"
  },
  {"Tent"},
  {"Raw Meat"},
  {
    "Cooked Meat"
  },
  {
    "Camouflage Clothing"
  },
  {
    "Survivor [F] Clothing"
  },
  {
    "Civilian [F] Clothing"
  },
  {
    "Camouflage [F] Clothing"
  },
  {
    "Ghillie [F] Suit"
  },
  {
    "Exercito [M] Clothing"
  },
  {
    "Civil [M] Clothing"
  },
  {
    "Civil [F] Clothing"
  },
  {
    "Sniper [M] Clothing"
  },
  {
    "Policial [M] Clothing"
  },
  {
    "Detetive [F] Clothing"
  },
  {
    "Zombie Clothing"
  },
  {
    "Zombie2 Clothing"
  },
  {
    "Zombie3 Clothing"
  },
  {
    "Anonymous Clothing"
  },
  {
    "Terrorista Clothing"
  },
  {
    "Daryl Dixon Clothing"
  },
  {
    "Anti-Radiation [M] Clothing"
  },
  {
    "Anti-Radiation [F] 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)"
  },
  {"Alice Pack"},
  {
    "Czech Backpack"
  },
  {
    "Coyote Backpack"
  },
  {
    "Radio Device"
  },
  {
    "Baseball Bat"
  },
  {"Shovel"},
  {"Golf Club"},
  {"Parachute"}
}
function saveallvehicles(ps, command)
  counter = 0
  counterTent = 0
  local vehicleManager = getAccount("vehicleManager", "ds4f9$")
  for i, col in ipairs(getElementsByType("colshape")) do
    local veh = getElementData(col, "vehicle")
    local helicrash = getElementData(col, "helicrash")
    local hospitalbox = getElementData(col, "hospitalbox")
    local tent = getElementData(col, "tent")
    if veh and not helicrash or veh and not hospitalbox then
      if tent then
        counterTent = counterTent + 1
        account = getAccount("tent_number_" .. counterTent, "ds4f9$") or false
        if not account then
          account = addAccount("tent_number_" .. counterTent, "ds4f9$")
        end
        do
          local tent = getElementData(col, "parent")
          local x, y, z = getElementPosition(tent)
          local rx, ry, rz = getElementRotation(tent)
          setAccountData(account, "last_x", x)
          setAccountData(account, "last_y", y)
          setAccountData(account, "last_z", z)
          setAccountData(account, "last_rx", rx)
          setAccountData(account, "last_ry", ry)
          setAccountData(account, "last_rz", rz)
          for i, data in ipairs(vehicleDataTable) do
            setAccountData(account, data[1], getElementData(col, data[1]))
          end
        end
      else
        counter = counter + 1
        account = getAccount("vehicle_number_" .. counter, "ds4f9$") or false
        if not account then
          account = addAccount("vehicle_number_" .. counter, "ds4f9$")
        end
        setAccountData(account, "spawn_x", getElementData(col, "spawn")[2])
        setAccountData(account, "spawn_y", getElementData(col, "spawn")[3])
        setAccountData(account, "spawn_z", getElementData(col, "spawn")[4])
        for i, data in ipairs(vehicleDataTable) do
          setAccountData(account, data[1], getElementData(col, data[1]))
        end
        local vehicle = getElementData(col, "parent")
        local model = getElementModel(vehicle)
        local x, y, z = getElementPosition(vehicle)
        local rx, ry, rz = getElementRotation(vehicle)
        local health = getElementHealth(vehicle)
        setAccountData(account, "last_x", x)
        setAccountData(account, "last_y", y)
        setAccountData(account, "last_z", z)
        setAccountData(account, "last_rx", rx)
        setAccountData(account, "last_ry", ry)
        setAccountData(account, "last_rz", rz)
        setAccountData(account, "health", health)
        setAccountData(account, "model", model)
        setAccountData(account, "isExploded", getElementData(vehicle, "isExploded") or false)
      end
    end
    setAccountData(vehicleManager, "vehicleamount", counter)
    setAccountData(vehicleManager, "tentamount", counterTent)
  end
end
addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), saveallvehicles)
function doBackup()
  outputChatBox ("Server Backup... (Default)",getRootElement(),27, 89, 224,true)
  saveallvehicles()
  outputChatBox("Done!", getRootElement(), 27, 89, 224, true)
end
function checkDoBackup()
  if gameplayVariables.backupenabled then
    setTimer(doBackup, gameplayVariables.backupinterval, 0)
  end
end
checkDoBackup()

-------------------------------------------------------------------------------------
function autobackup (thePlayer)
-------------------------------------------------------------------------------------
accountname = getAccountName(getPlayerAccount(thePlayer))
if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then
-------------------------------------------------------------------------------------
local password = bgz2021
local reason = "Server Backup, voltaremos ja!"
-------------------------------------------------------------------------------------
for i, player in ipairs(getElementsByType("player")) do
-------------------------------------------------------------------------------------
   outputChatBox ("Server Backup... (Salvando o Servidor!)",getRootElement(),27, 89, 224,true)
   --kickPlayer(player,reason) (Desativado pois bugava)
   setServerPassword(password)
   saveallvehicles()
   outputChatBox ("Done!",getRootElement(),27, 89, 224,true)
   setServerPassword(nil)
-------------------------------------------------------------------------------------
end
else
-------------------------------------------------------------------------------------
   outputChatBox("Voce nao e admin!", thePlayer)
-------------------------------------------------------------------------------------
end
end
-------------------------------------------------------------------------------------
addCommandHandler("autobackup", autobackup)
-------------------------------------------------------------------------------------

function createVehicleOnServerStart()
    local vehicleManager = getAccount("vehicleManager","ds4f9$")
    for i = 1, (getAccountData(vehicleManager,"vehicleamount") or 0) do
        wastedVehicle = false
        vehicle = getAccount("vehicle_number_"..i,"ds4f9$")
        if not vehicle then break end
        if getAccountData(vehicle,"isExploded") == true then
            setAccountData(vehicle,"health",1000)
            wastedVehicle = true
        end
            local veh = createVehicle(getAccountData(vehicle,"model"),getAccountData(vehicle,"last_x"),getAccountData(vehicle,"last_y"),getAccountData(vehicle,"last_z"),getAccountData(vehicle,"last_rx"),getAccountData(vehicle,"last_ry"),getAccountData(vehicle,"last_rz"))
            vehCol = createColSphere(getAccountData(vehicle,"last_x"),getAccountData(vehicle,"last_y"),getAccountData(vehicle,"last_z"),4)
            attachElements ( vehCol, veh, 0, 0, 0 )
            setElementData(vehCol,"parent",veh)
            setElementData(veh,"parent",vehCol)
            setElementData(vehCol,"vehicle",true)
            setElementData(vehCol,"MAX_Slots",getAccountData(vehicle,"MAX_Slots"))
            setElementHealth(veh,getAccountData(vehicle,"health"))
        --vehicle_indentifikation
            xxx,yyy,zzz = getAccountData(vehicle,"spawn_x"),getAccountData(vehicle,"spawn_y"),getAccountData(vehicle,"spawn_z")
            setElementData(vehCol,"spawn",{getAccountData(vehicle,"model"),xxx,yyy,zzz})
            if wastedVehicle then
                if getAccountData(vehicle,"model") == 497 then
                    item_id = math.random(table.size(hunterSpawns))
                    xxx,yyy,zzz = hunterSpawns[item_id][1],hunterSpawns[item_id][2],hunterSpawns[item_id][3]
                end
                if getAccountData(vehicle,"model") == 487 then
                    local item_id = math.random(table.size(maverikSpawns))
                    x,y,z = maverikSpawns[item_id][1],maverikSpawns[item_id][2],maverikSpawns[item_id][3]
                end
                setElementPosition(veh,xxx,yyy,zzz+1)
                setElementRotation(veh,0,0,0)
                --Engine + Tires
                local tires,engine = getVehicleAddonInfos (getElementModel(veh))
                setElementData(vehCol,"Tire_inVehicle",math.random(0,tires))
                setElementData(vehCol,"Engine_inVehicle",math.random(0,engine))
            end
        --others
            setElementData(vehCol,"fuel",getAccountData(vehicle,"fuel"))
    if not wastedVehicle then
        for i, data in ipairs(vehicleDataTable) do 
            setElementData(vehCol,data[1],getAccountData(vehicle,data[1]))
        end
    else
        if getElementModel(veh) == 433 or getElementModel(veh) == 470 then
            for i,items in ipairs(lootItems["helicrashsides"]) do
                local randomNumber = math.random(1,10)
                if randomNumber == 5 then
                    setElementData(vehCol,items[1],math.random(1,2))
                end
            end
        end 
        setElementData(vehCol,"fuel",10)
    end
    end
    for i = 1, (getAccountData(vehicleManager,"tentamount") or 0) do
        tentData = getAccount("tent_number_"..i,"ds4f9$")
        if not tentData then break end
        tent = createObject(3243,getAccountData(tentData,"last_x"),getAccountData(tentData,"last_y"),getAccountData(tentData,"last_z"),0,0,(getAccountData(tentData,"last_rz") or 0))
        setObjectScale(tent,1.3)
        tentCol = createColSphere(getAccountData(tentData,"last_x"),getAccountData(tentData,"last_y"),getAccountData(tentData,"last_z"),4)
        attachElements ( tentCol, tent, 0, 0, 0 )
        setElementData(tentCol,"parent",tent)
        setElementData(tent,"parent",tentCol)
        setElementData(tentCol,"tent",true)
        setElementData(tentCol,"vehicle",true)
        setElementData(tentCol,"MAX_Slots",100)
        for i, data in ipairs(vehicleDataTable) do 
            setElementData(tentCol,data[1],getAccountData(tentData,data[1]))
        end
    end
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), createVehicleOnServerStart)

 

Link to post

Olá. Seja bem-vindo ao fórum. :) - sim, o tópico está na seção correta.

Sobre o seu erro, você precisa verificar se a conta é válida. A função getPlayerAccount retorna false caso o jogador não tenha feito o login, esse é o motivo de aparecer aquele erro, dizendo que esperava uma conta, mas obteve um valor boleano (true/false). Use isGuestAccount para checar.

Aqui um exemplo do seu erro (não olhei o restante do código):
Nytgzar.png

Você deve fazer assim:

local account = getPlayerAccount(player)
if isGuestAccount(account) then
    return false
end

Caso seja uma conta inválida, o código abaixo não seria executado. Apenas os jogadores que tenham feito o login iriam passar pela condição.

  • Thanks 1
Link to post
22 hours ago, andr0xy said:

Olá. Seja bem-vindo ao fórum. :) - sim, o tópico está na seção correta.

Sobre o seu erro, você precisa verificar se a conta é válida. A função getPlayerAccount retorna false caso o jogador não tenha feito o login, esse é o motivo de aparecer aquele erro, dizendo que esperava uma conta, mas obteve um valor boleano (true/false). Use isGuestAccount para checar.

Aqui um exemplo do seu erro (não olhei o restante do código):
Nytgzar.png

Você deve fazer assim:


local account = getPlayerAccount(player)
if isGuestAccount(account) then
    return false
end

Caso seja uma conta inválida, o código abaixo não seria executado. Apenas os jogadores que tenham feito o login iriam passar pela condição.

fiz exatamente o que me pediu, inclusive acrescentei na minha script do login..

mas eu poderia ter deixado melhor o código certo aonde o erro ocorre..

linha "699" tá com uma obs na frente pra especificar melhor.

function createVehicleOnServerStart()
    local vehicleManager = getAccount("vehicleManager","ds4f9$")
    for i = 1, (getAccountData(vehicleManager,"vehicleamount") or 0) do  <------ (o erro ocorre nessa linha, exatamente.)
        wastedVehicle = false
        vehicle = getAccount("vehicle_number_"..i,"ds4f9$")
        if not vehicle then break end
        if getAccountData(vehicle,"isExploded") == true then
            setAccountData(vehicle,"health",1000)
            wastedVehicle = true
        end

linha "752" tá com uma obs na frente pra especificar melhor.

    for i = 1, (getAccountData(vehicleManager,"tentamount") or 0) do   <------ (o erro ocorre nessa linha)
        tentData = getAccount("tent_number_"..i,"ds4f9$")
        if not tentData then break end

o que pode ser? já tentei mudar, colocar outro código no lugar de GetAccountData, mas mesmo assim, acusa "Bad Argument" 

Link to post

Mas o que é isso que eu tô vendo na tela do meu computador?

Caraca, salvando aquilo tudo de dados numa conta. Imagino que tenha bastante tendas e veículos, não é a melhor forma. 😁Mas enfim, tente remover a senha, deixe só o nome da pseudo-conta.

  • Haha 1
Link to post

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...