Jump to content

Nonsense Problem?!?


Entity

Recommended Posts

Server:

ResourceRootS = getResourceRootElement() 
Password = "RFT" 
  
function eventSpawnPlayer(Player,Skin) 
    local Serial = getPlayerSerial(Player) 
    local Account = getAccount(Serial) 
    if (Account) then 
        local Money = getAccountData(Account,"Money") 
        setElementData(Player,"Money",Money) 
        spawnPlayer(Player,935.82421875,2143.9340820313,1011.0234375,270,Skin,1,0) 
        fadeCamera(Player,true) 
        setCameraTarget(Player,Player) 
        outputServerLog("START: " .. tostring(Money) .. ", " .. Serial .. ", " .. Password) 
    else 
        local Account = addAccount(Serial,Password) 
        outputChatBox("Type /masterkey to set up your MasterKey.",Player) 
        setAccountData(Account,"Money",0.12) 
        setElementData(Player,"Money",0.12) 
        spawnPlayer(Player,935.82421875,2143.9340820313,1011.0234375,270,Skin,1,0) 
        fadeCamera(Player,true) 
        setCameraTarget(Player,Player) 
    end 
end 
addEvent("eventSpawnPlayer",true) 
addEventHandler("eventSpawnPlayer",ResourceRootS,eventSpawnPlayer) 
  
function eventPlayerQuit() 
    local Serial = getPlayerSerial(source) 
    local Account = getAccount(Serial) 
    if (Account) then 
        local Money = getElementData(source,"Money") 
        setAccountData(Account,"Money",Money) 
        outputServerLog("STOP: " .. tostring(Money) .. ", " .. Serial .. ", " .. Password) 
    end 
end 
addEventHandler("onPlayerQuit",getRootElement(),eventPlayerQuit) 

Link to comment

And so what is the problem in the script?

Server-side

local Password = "RFT" 
  
addEvent("eventSpawnPlayer", true) 
addEventHandler("eventSpawnPlayer", resourceRoot, 
    function(Player, Skin) 
        local Serial = getPlayerSerial(Player) 
        local Account = getAccount(Serial) 
        if (Account) then 
            local Money = getAccountData(Account, "Money") 
            setElementData(Player, "Money", Money) 
            spawnPlayer(Player, 935.82421875, 2143.9340820313, 1011.0234375, 270, Skin, 1, 0) 
            fadeCamera(Player, true) 
            setCameraTarget(Player, Player) 
            outputServerLog("START: " .. Money .. ", " .. Serial .. ", " .. Password) 
        else 
            local Account = addAccount(Serial, Password) 
            outputChatBox("Type /masterkey to set up your MasterKey.", Player) 
            setAccountData(Account, "Money", 0.12) 
            setElementData(Player, "Money", 0.12) 
            spawnPlayer(Player, 935.82421875, 2143.9340820313, 1011.0234375, 270, Skin, 1, 0) 
            fadeCamera(Player, true) 
            setCameraTarget(Player, Player) 
        end 
    end 
) 
  
addEventHandler("onPlayerQuit", root, 
    function() 
        local Serial = getPlayerSerial(source) 
        local Account = getAccount(Serial) 
        if (Account) then 
            local Money = getElementData(source, "Money") 
            setAccountData(Account, "Money", Money) 
            outputServerLog("STOP: " .. Money .. ", " .. Serial .. ", " .. Password) 
        end 
    end 
) 

Link to comment

When I join, it loads money and outputServerLog outputs:

START: 0.12, ????????????????????????, RFT

and when i quit it also saves money perfectly cause it outputs:

STOP: 0.12, ????????????????????????, RFT

but then when I start again it doesn't load the money and outputs:

START: 0, ????????????????????????, RFT

and when i quit

STOP: 0, ????????????????????????, RFT

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