Jump to content

saveMoney to XML ?


papam77

Recommended Posts

addEventHandler( "onPlayerWasted", getRootElement( ), 
 function (  ) 
 -- Place for spawn 
 setTimer ( spawnPlayer, 3000, 1, source, 2034, -1414, 16.3 ) 
 -- Saving Part 
     local playeraccount = getPlayerAccount ( source ) 
    if ( playeraccount ) and not isGuestAccount ( playeraccount ) then 
        local playermoney = getPlayerMoney ( source ) 
        local skin = getElementModel ( source ) 
        local pos = getElementPosition ( source ) 
        setAccountData ( playeraccount, "acc", playermoney ) 
        setAccountData ( playeraccount, "skin", skin ) 
    end 
    -- Loading part 
     local player = getRootElement() 
 if ( playeraccount ) then 
        local playermoney = getAccountData ( playeraccount, "acc" ) 
        local skin = getAccountData ( playeraccount, "skin" ) 
        -- Money 
        if ( playermoney ) then 
            setPlayerMoney ( source, playermoney ) 
        end 
        -- Skin 
        if ( skin ) then 
            setElementModel ( source, skin ) 
        else 
            outputChatBox ( "NO SKIN SAVED!", source ) 
        end  
    end 
 end 
) 

I edited something, but it doesn't load my skin.

the data wil be when player wasted ??

Link to comment
Yes, it must load skin which player had before death.

i think wil be error why ?

because you wil saved data in player account and if player is guest ?? what wil be

he didn't wil saved skin .

======================================================================

also i think you don't need when player wasted money and his position .

and when player spawn will get data skin from wasted i think you need to use

"onPlayerSpawn" 

so wil be like this :

addEventHandler( "onPlayerWasted", getRootElement( ), 
  
 function (  ) 
  
 setTimer ( spawnPlayer, 3000, 1, source, 2034, -1414, 16.3 ) 
  
     local playeraccount = getPlayerAccount ( source ) 
  
    if ( playeraccount ) and not isGuestAccount ( playeraccount ) then 
  
        local skin = getElementModel ( source ) 
  
        setAccountData ( playeraccount, "skin", skin ) 
         
        if (playeraccount) and isGuestAccount ( playeraccount ) then return outputChatBox("Sorry . but you are guest you missing save skin . !",source,255,0,0,true) end 
  
 end 
) 
  
addEventHandler("onPlayerSpawn",getRootElement( ), 
  
function() 
  
 if ( playeraccount ) then 
  
        local skin = getAccountData ( playeraccount, "skin" ) 
  
        if ( skin ) then 
  
            setElementModel ( source, skin ) 
  
        else 
  
            outputChatBox ( "NO SKIN SAVED!", source ) 
  
      end  
  end 
) 

Link to comment
addEventHandler( "onPlayerWasted", getRootElement( ), 
    function (  ) 
        setTimer ( spawnPlayer, 3000, 1, source, 2034, -1414, 16.3 ) 
        local playeraccount = getPlayerAccount ( source ) 
        if ( playeraccount ) and not isGuestAccount ( playeraccount ) then 
            local skin = getElementModel( source ) 
            setAccountData( playeraccount, "skin", skin ) 
        end 
    end 
) 
  
addEventHandler("onPlayerSpawn",getRootElement( ), 
    function( ) 
        local playeraccount = getPlayerAccount( source ) 
        if playeraccount and not isGuestAccount( playeraccount ) then 
            local skin = getAccountData( playeraccount, "skin" ) 
            if skin then 
                setElementModel( source, skin ) 
            else  
                outputChatBox( "NO SKIN SAVED!", source ) 
            end 
        end 
    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...