Jump to content

[ مشكله ]xبكود


Recommended Posts

On ٢١‏/٤‏/٢٠١٧ at 00:21, #_iMr.[E]coo said:

addEventHandler ( "onPlayerLogout" , root ,
  function ( )
    setAccountData ( getPlayerAccount ( source ) , "aSaveMoney" , tonumber ( getPlayerMoney ( source ) ) )
  end
)

addEventHandler ( "onPlayerQuit" , root ,
  function ( )
    setAccountData ( getPlayerAccount ( source ) , "aSaveMoney" , tonumber ( getPlayerMoney ( source ) ) ) 
  end
)

addEventHandler ( "onPlayerLogin" , root ,
  function ( )
    givePlayerMoney ( source , tonumber ( getAccountData ( getPlayerAccount ( source ) , "aSaveMoney" ) ) )
  end
)

 

إحتمال كبير كودك خطأ ، احيانا راح يشتغل واحيانا لا

راجع الويكي، حدث تسجيل الخروج

Link to comment
function Save()
    local Acc = getPlayerAccount(source)
    if ( Acc  ) then
        local bMoney = getPlayerMoney(source)
        setAccountData(Acc, "MoneySave", playerCash)
        setPlayerMoney(source, 0)
    end
end
addEventHandler("onPlayerQuit", getRootElement(), Save)
addEventHandler("onPlayerLogout", getRootElement(), Save)
 
function Recover()
    local Acc = getPlayerAccount(source)
    if (Acc) then
        local SaveData = getAccountData(Acc, "MoneySave")
        if (SaveData) then
            setPlayerMoney(source, tonumber(SaveData))
		end	
    end
end
addEventHandler("onPlayerLogin", getRootElement(), Recover)              

 

Link to comment
21 minutes ago, 3laa33 said:

@#BrosS
راجع سطر رقم 5

:D

function Save()
    local Acc = getPlayerAccount(source)
    if ( Acc  ) then
        local bMoney = getPlayerMoney(source)
        setAccountData(Acc, "MoneySave", bMoney)
        setPlayerMoney(source, 0)
    end
end
addEventHandler("onPlayerQuit", getRootElement(), Save)
addEventHandler("onPlayerLogout", getRootElement(), Save)
 
function Recover()
    local Acc = getPlayerAccount(source)
    if (Acc) then
        local SaveData = getAccountData(Acc, "MoneySave")
        if (SaveData) then
            setPlayerMoney(source, tonumber(SaveData))
		end	
    end
end
addEventHandler("onPlayerLogin", getRootElement(), Recover) 

 

  • Like 2
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...