Jump to content

Need help dayz backup


adi8908456

Recommended Posts

Hi!

I need help, got 2 warnings in debugscript

dayz/login.lua line 488 Bad argument @ 'setaccountdata' [expected account at argument 1,got boolean]

dayz/login.lua line 487 Bad argument @ 'setaccountdata' [expected account at argument 1,got boolean]

When i use command to make backup this information came up "backup will come in 1 min before small lag" then come much warnings (@up) and nothing

script: line 17 and 18 are line 488 and 487 in script

        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 ("#ff0000WARNING! #8391D6 - SERVER BACKUP, SAVING TENTS AND VEHICLES, BEWARE OF SMALL LAG!",getRootElement(),27, 89, 224,true) 
        saveallvehicles() 
        outputChatBox ("#526F35DONE! #8391D6 - BACKUP HAS BEEN COMPLETED",getRootElement(),27, 89, 224,true) 
end 
function checkDoBackup () 
    if gameplayVariables["backupenabled"] then 
        setTimer(doBackup,3600000,0) 
    end 
end 

Link to comment
  • MTA Team
setAccountData(vehicleManager,"vehicleamount",counter) 
        setAccountData(vehicleManager,"tentamount",counterTent) 

vehicleManager is (probably) not an account-pointer. You can't use it with setAccountData.

Link to comment
setAccountData(vehicleManager,"vehicleamount",counter) 
        setAccountData(vehicleManager,"tentamount",counterTent) 

vehicleManager is (probably) not an account-pointer. You can't use it with setAccountData.

in my old gamemode it works. Maybe becouse i hange name of items like engine, tire...

my login.lua

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"},
{"Drewno"},
{"Bandaż"},
{"Butelka z wodą"},
{"Puszka makaronu"},
{"Puszka fasoli"},
{"Burger"},
{"Pudełko zapałek"},
{"M1911 Mag"},
{"M9 SD Mag"},
{"Desert Eagle Mag"},
{"M1911"},
{"M9 SD"},
{"Winchester 1866"},
{"PDW"},
{"Nóż"},
{"Lekka siekiera"},
{"Pizza"},
{"Morfina"},
{"Puszka oranżady"},
{"Pusty kanister"},
{"Pełny kanister"},
{"Flara"},
{"Karton mleka"},
{"PDW Mag"},
{"P90 Mag"},
{"Butla CO2"},
{"Collor Mag"},
{"AK-74 Mag"},
{"FN SCAR Mag"},
{"Tear Gas"},
{"Granat"},
{"Gaśnica"},
{"Spraycan"},
{"Molotov Cocktails"},
{"Desert Eagle"},
{"Sawn-Off Shotgun"},
{"SPAZ-12 Combat Shotgun"},
{"P90"},
{"Zegarek"},
{"Pieniądze"},
{"Apteczka"},
{"Tabletki rozgrzewające"},
{"M1 Grand"},
{"PDW"},
{"TEC-9"},
{"AK-74"},
--{"M136 Rocket Launcher"},
{"Torebka z krwią"},
{"GPS"},
{"Mapa San Andreas"},
{"Skrzynka z narzędziami"},
{"Ogrodzenie z drutu"},
{"Opona"},
{"Silnik"},
{"Częsci paliwowe"},
--{"M136 Rocket"},
{"CZ 550 Mag"},
{"M1 Grand Mag"},
{"FN SCAR"},
{"CZ 550"},
--{"Heat-Seeking RPG"},
{"Satchel"},
{"Gogle na podczerwień"},
{"Noktowizor"},
{"Namiot"},
{"Surowe mięso"},
{"Upieczone mięso"},
{"wojskowe ubrania"},
{"Ubranie snajpera"},
{"Ubranie cywilne"},
{"Stare ubrania"},
{"Kobiecy mundur policyjny"},
{"Mundur policyjny"},
{"Ubranie strażaka"},
{"Ubranie podróżnika"},
{"Kobiece ubranie podróżnika"},
{"Kobiece stare ubrania"},
{"Kobiece cywilne ubrania"},
{"Kobiece wojskowe ubrania"},
{"tabletki przeciwbólowe"},
{"Lornetka"},
{"Pusta butelka"},
{"Pusta puszka"},
{"Resztki jedzenia"},
{"1866 Slug"},
{"2Rnd. Slug"},
{"SPAZ-12 Pellet"},
{"Krótkofalówka"},
{"Baseball Bat"},
{"Topór strażacki"},
{"Molotov Cocktails"},
{"Satchel Charges"},
{"Chainsaw"},
{"Nightstick"},
{"Golf Club"},
{"Vibrator"},
{"Short tan Dildo"},
{"Pool Cue"},
{"Flowers"},
{"Long Purple Dildo"},
{"Krótkofalówka"},
{"Spadochron"},
}
 
 
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] =="Bandaż" then
            setElementData(player,data[1],2)
        elseif data[1] =="tabletki przeciwbólowe" 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
           
Link to comment

I fixed this two warnings but now have one error

ERROR: line 465 attempt to index a boolean value

Line 465

setAccountData(account,"spawn_x",getElementData(col,"spawn")[2]) 

some lines of login.lua

        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 

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