Jump to content

Recommended Posts

  • Other Languages Moderators

This error always happens when someone login.
WARNING: savesystem\server.lua:56: Expected number, got non-convertible string. This warning may be an error in future versions. [DUP x3]

----------------------------------------------------------------------------------------------------
---                                            TABLES                                            ---
----------------------------------------------------------------------------------------------------
local antiSpamSave = { }
local setting = { }

----------------------------------------------------------------------------------------------------
---                                           SETTINGS                                           ---
----------------------------------------------------------------------------------------------------
-- Save Data Setting
setting.position = not get("position") == "false" and toJSON(split(get("position"), ", ")) or false
setting.rotation = tonumber(get("rotation")) or false
setting.interior = tonumber(get("interior")) or false
setting.dimension = tonumber(get("dimension")) or false
setting.team = tostring(get("team")) or false
setting.skin = tonumber(get("skin")) or false
--setting.data = not get("elementData") == "false" and split(get("elementData"), ", ") or false

-- Other Setting
setting.loadOnStartResource = not get("loadOnStartResource") == "false" and true or false
setting.saveCommand = not get("saveCommand") == "false" and true or false
setting.saveTime = tonumber(get("rotation")) or false
----------------------------------------------------------------------------------------------------
---                                        CUSTOM EVENTS                                         ---
----------------------------------------------------------------------------------------------------
addEvent("onAccountLoadData", true)
addEventHandler("onAccountLoadData", root,
function (account)
    local position = getAccountData(account, "position") or setting.position
    local rot = getAccountData(account, "rotation") or setting.rotation
    local int = getAccountData(account, "interior") or setting.interior
    local dim = getAccountData(account, "dimension") or setting.dimension
    local teamName = getAccountData(account, "team") or setting.team
    local skin = getAccountData(account, "skin") or setting.skin
    local health = getAccountData(account, "health")
    local armor = getAccountData(account, "armor")
    local money = getAccountData(account, "money")
    local wanted = getAccountData(account, "wantedlevel")
    local clothes = getAccountData(account, "clothes")
    local stats = getAccountData(account, "stats")
    local weapons = getAccountData(account, "weapons")
	--local datas = getAccountData(account, "datas")
    
    local x, y, z = unpack(fromJSON(position) or {nil})
    local team = teamName and getTeamFromName(teamName) or nil
    
    if position then spawnPlayer(source, x, y, z, rot, skin, int, dim, team) end
    if health then setElementHealth(source, health) end
    if armor then setPedArmor(source, armor) end
    if money then setPlayerMoney(source, money) end
    if wanted then setPlayerWantedLevel(source, wanted) end
    if (clothes) then
        removeAllPedClothes(source)
        for _, clothes in pairs(fromJSON(clothes)) do
            local type, texture, model = unpack(clothes)
            addPedClothes(source, type, texture, model)
        end
    end
    if (stats) then
        for stat, value in pairs(fromJSON(stats)) do
            setPedStat(source, stat, value)
        end
    end
    if (weapons) and not (isPedDead(source)) then
        takeAllWeapons(source)
        for weapon, ammo in pairs(fromJSON(weapons)) do
            giveWeapon(source, weapon, ammo, true)
        end
    end
...
...
...


 

Link to post
----------------------------------------------------------------------------------------------------
---                                            TABLES                                            ---
----------------------------------------------------------------------------------------------------
local antiSpamSave = { }
local setting = { }

----------------------------------------------------------------------------------------------------
---                                           SETTINGS                                           ---
----------------------------------------------------------------------------------------------------
-- Save Data Setting
setting.position = not get("position") == "false" and toJSON(split(get("position"), ", ")) or false
setting.rotation = tonumber(get("rotation")) or false
setting.interior = tonumber(get("interior")) or false
setting.dimension = tonumber(get("dimension")) or false
setting.team = tostring(get("team")) or false
setting.skin = tonumber(get("skin")) or false
--setting.data = not get("elementData") == "false" and split(get("elementData"), ", ") or false

-- Other Setting
setting.loadOnStartResource = not get("loadOnStartResource") == "false" and true or false
setting.saveCommand = not get("saveCommand") == "false" and true or false
setting.saveTime = tonumber(get("rotation")) or false
----------------------------------------------------------------------------------------------------
---                                        CUSTOM EVENTS                                         ---
----------------------------------------------------------------------------------------------------
addEvent("onAccountLoadData", true)
addEventHandler("onAccountLoadData", root,
function (account)
    local position = getAccountData(account, "position") or setting.position
    local rot = getAccountData(account, "rotation") or setting.rotation
    local int = getAccountData(account, "interior") or setting.interior
    local dim = getAccountData(account, "dimension") or setting.dimension
    local teamName = getAccountData(account, "team") or setting.team
    local skin = getAccountData(account, "skin") or setting.skin
    local health = getAccountData(account, "health")
    local armor = getAccountData(account, "armor")
    local money = getAccountData(account, "money")
    local wanted = getAccountData(account, "wantedlevel")
    local clothes = getAccountData(account, "clothes")
    local stats = getAccountData(account, "stats")
    local weapons = getAccountData(account, "weapons")
	--local datas = getAccountData(account, "datas")
    
    local x, y, z = unpack(fromJSON(position) or {nil})
    local team = teamName and getTeamFromName(teamName) or nil
    
    if position then spawnPlayer(source, x, y, z, rot, skin, int, dim, team) end
    if health then setElementHealth(source, health) end
    if armor then setPedArmor(source, armor) end
    if money then setPlayerMoney(source, money) end
    if wanted then setPlayerWantedLevel(source, wanted) end
    if (clothes) then
        removeAllPedClothes(source)
        for _, clothes in pairs(fromJSON(clothes)) do
            local typo, texture, model = unpack(clothes)
            addPedClothes(source, typo, texture, model)
        end
    end
    if (stats) then
        for stat, value in pairs(fromJSON(stats)) do
            setPedStat(source, stat, value)
        end
    end
    if (weapons) and not (isPedDead(source)) then
        takeAllWeapons(source)
        for weapon, ammo in pairs(fromJSON(weapons)) do
            giveWeapon(source, weapon, ammo, true)
        end
    end
...
...
...

try this

Link to post

This might work

 

 

----------------------------------------------------------------------------------------------------
---                                            TABLES                                            ---
----------------------------------------------------------------------------------------------------
local antiSpamSave = { }
local setting = { }

----------------------------------------------------------------------------------------------------
---                                           SETTINGS                                           ---
----------------------------------------------------------------------------------------------------
-- Save Data Setting
setting.position = not get("position") == "false" and toJSON(split(get("position"), ", ")) or false
setting.rotation = tonumber(get("rotation")) or false
setting.interior = tonumber(get("interior")) or false
setting.dimension = tonumber(get("dimension")) or false
setting.team = tostring(get("team")) or false
setting.skin = tonumber(get("skin")) or false
--setting.data = not get("elementData") == "false" and split(get("elementData"), ", ") or false

-- Other Setting
setting.loadOnStartResource = not get("loadOnStartResource") == "false" and true or false
setting.saveCommand = not get("saveCommand") == "false" and true or false
setting.saveTime = tonumber(get("rotation")) or false
----------------------------------------------------------------------------------------------------
---                                        CUSTOM EVENTS                                         ---
----------------------------------------------------------------------------------------------------
addEvent("onAccountLoadData", true)
addEventHandler("onAccountLoadData", root,
function (account)
    local position = getAccountData(account, "position") or setting.position
    local rot = getAccountData(account, "rotation") or setting.rotation
    local int = getAccountData(account, "interior") or setting.interior
    local dim = getAccountData(account, "dimension") or setting.dimension
    local teamName = getAccountData(account, "team") or setting.team
    local skin = getAccountData(account, "skin") or setting.skin
    local health = getAccountData(account, "health")
    local armor = getAccountData(account, "armor")
    local money = getAccountData(account, "money")
    local wanted = getAccountData(account, "wantedlevel")
    local clothes = getAccountData(account, "clothes")
    local stats = getAccountData(account, "stats")
    local weapons = getAccountData(account, "weapons")
	--local datas = getAccountData(account, "datas")
    
    local x, y, z = unpack(fromJSON(position) or {nil})
    local team = teamName and getTeamFromName(teamName) or nil
    
    if position then spawnPlayer(source, x, y, z, rot, skin, int, dim, team) end
    if health then setElementHealth(source, health) end
    if armor then setPedArmor(source, armor) end
    if money then setPlayerMoney(source, money) end
    if wanted then setPlayerWantedLevel(source, wanted) end
    if (clothes) then
        removeAllPedClothes(source)
        for _, cloth in pairs(fromJSON(clothes)) do
            local typo, texture, model = unpack(cloth)
            addPedClothes(source, typo, texture, model)
        end
    end
    if (stats) then
        for stat, value in pairs(fromJSON(stats)) do
            setPedStat(source, stat, value)
        end
    end
    if (weapons) and not (isPedDead(source)) then
        takeAllWeapons(source)
        for weapon, ammo in pairs(fromJSON(weapons)) do
            giveWeapon(source, weapon, ammo, true)
        end
    end
...
...
...

 

Link to post
  • Other Languages Moderators
1 hour ago, TheMOG said:

Long time ago i edited this script, i toke off the "settings.stuff-s", if you want, i can give you.

 

Working without any problem.

I am trying to understand the problem so I can fix it when it happens later in other scripts.

Link to post
  • Scripting Moderators

Try this:

addPedClothes(source, texture, model, type)

You are actually writing those args in the wrong sequence.

  • Like 1
Link to post
  • Other Languages Moderators

I did not know that this parameter need a sequence.

4 hours ago, Patrik91 said:

Try this:


addPedClothes(source, texture, model, type)

You are actually writing those args in the wrong sequence.

No errors...I think this solved the issue!

Edited by lordhenry
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...