Jump to content

Error: attempt to perform arithmetic on local 'z' (a boolean


Recommended Posts

Olá Pessoal to com esse erro:

attempt to perform arithmetic on local 'z' (a boolean value)

que ta atrapalhando a performance do server, ficarei agradecido pela ajuda de vocês.

Login.lua - linha:149

spawnPlayer (player, x,y,z+0.5, math.random(0,360), skin, 0, 0) 

--

Login.lua - Completo:

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"},
{"Дрова"},
{"Бинт"},
{"Фляга"},
{"Банка макарон"},
{"Банка бобов"},
{"Гамбургер"},
{"Спички"},
{"M1911 Mag"},
{"M9 SD Mag"},
{".45ACP"},
{"M1911"},
{"M9 SD"},
{"Винчестер 1866"},
{"PDW"},
{"Охотничий нож"},
{"Топор"},
{"Пицца"},
{"Морфий"},
{"Банка соды"},
{"Пустая канистра"},
{"Наполненная канистра"},
{"Фаер"},
{"Молоко"},
{"PDW Mag"},
{"MP5A5 Mag"},
{"AK"},
{"STANAG"},
{"Tear Gas"},
{"Оск. граната M67"},
{"Револьвер"},
{"Sawn-Off Shotgun"},
{"SPAZ-12 Combat Shotgun"},
{"MP5A5"},
{"Часы"},
{"Аптечка"},
{"Грелка"},
{"Lee Enfield"},
{"PDW"},
--{"TEC-9"},
{"AK-74"},
--{"M136 Rocket Launcher"},
{"Пакет крови"},
{"GPS"},
{"Assault Pack (ACU)"},
{"Alice Pack"},
{"Czech Backpack"},
{"Coyote Backpack"},
{"Vega Backpack"},
{"Turist Backpack"},
{"Hard Backpack"},
{"Карта"},
{"Инструменты"},
{"Колючая проволока"},
{"Tire"},
{"Engine"},
{"Бензобак"},
{"M136 Rocket"},
{"CZ550 Mag"},
{"Lee Enfield Mag"},
{"М4А1 CCO"},
{"CZ550"},
--{"Heat-Seeking RPG"},
{"Satchel"},
{"Инфокрасные очки"},
{"Очки ночного видения"},
{"Палатка"},
{"Жареное мясо"},
{"Сырое мясо"},
{"Армейский камуфляж"},
{"Одежда снайпера"},
{"Камуфляж снайпера"},
{"Digital одежда"},
{"Blask одежда"},
{"Pirate одежда"},
{"Jagged одежда"},
{"Novas одежда"},
{"Bush одежда"},
{"Resist одежда"},
{"Fin одежда"},
{"Desert одежда"},
{"Police одежда"},
{"Hunter одежда"},
{"Женский скин"},
{"Одежда выжившего"},
{"Болеутоляющие"},
{"Бинокль"},
{"Пустая фляга"},
{"Пустая банка соды"},
{"Объедки"},
{"1866 Slug"},
{"2Rnd. Slug"},
{"SPAZ-12 Pellet"},
{"Рация"},
{"Бейсбольная бита"},
{"Лопата"},
{"Клюшка для гольфа"},
{"Рация"},
{"Парашют"},
}
 
 
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+0.5, math.random(0,360), skin, 0, 0)
    setElementFrozen(player, true)
    fadeCamera (player, true)
    setCameraTarget (player, player)
    setTimer( function(player)
        if isElement(player) then
            setElementFrozen(player, false)
        end
    end,500,1,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 then
            if data[1] == "brokenbone" or data[1] == "pain" or data[1] == "cold" or data[1] == "infection" or data[1] == "currentweapon_1" or data[1] == "currentweapon_2" or data[1] == "currentweapon_3" or data[1] == "bandit" then
                elementData = elementData
            else
                elementData = 0
            end
        end
        setElementData(player,data[1],elementData)
    end
    setElementData(player,"logedin",true)
    --Weapons
    --Old Weapons
    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)
 
 
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)
    ----------------------------------
    --Player Items on Start
    for i,data in ipairs(playerDataTable) do
        if data[1] =="Бинт" then
            setElementData(player,data[1],2)
        elseif data[1] =="Болеутоляющие" then
            setElementData(player,data[1],1)
        elseif data[1] =="MAX_Slots" then
            setElementData(player,data[1],8)
        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
           
Link to comment

'z' deve estar retornando false.

Troque:

local x,y,z =  getAccountData(account,"last_x"),getAccountData(account,"last_y"),getAccountData(account,"last_z") 

Por:

local x,y,z =  getAccountData(account,"last_x") or 0,getAccountData(account,"last_y") or 0,getAccountData(account,"last_z") or 0 

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