Jump to content

[HELP] Save player wanted level


xXGhostXx

Recommended Posts

try
 

wanted = getElementData("wantedlevel")
addEventHandler("onPlayerLogin", root, function()
setElementData(wanted)
end)

 

forget that try this
 

function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin)
  if  not (isGuestAccount (getPlayerAccount (source))) then
    local accountData = getAccountData (theCurrentAccount, "funmodev2-money")
    if (accountData) then

      local playerWanted = getAccountData (theCurrentAccount, "funmodev2-wantedlevel")
      spawnPlayer (source, playerX, playerY, playerZ +1, 0, playerSkin, playerInt, playerDim)
      setTimer (setPlayerWantedLevel, 500, 1, source, playerWanted)
      setCameraTarget (source, source)
      fadeCamera(source, true, 2.0)
    else
      spawnPlayer (source, 1481.0855712891, -1771.2996826172, 18.795753479004, 0,78, 0, 0)
      setPlayerMoney (source, 200)
      setCameraTarget (source, source)
      fadeCamera(source, true, 2.0)  
    end   
  end
end
addEventHandler ("onPlayerLogin", getRootElement(), playerLogin)

function onLogout ()
	kickPlayer (source, nil, "Logging out is disallowed.")
end
addEventHandler ("onPlayerLogout", getRootElement(), onLogout)

function onQuit (quitType, reason, responsibleElement)
  if not (isGuestAccount (getPlayerAccount (source))) then
    account = getPlayerAccount (source)
    if (account) then
      local x,y,z = getElementPosition (source)
      setAccountData (account, "funmodev2-wantedlevel", getPlayerWantedLevel (source))
    end
  end
end
addEventHandler ("onPlayerQuit", getRootElement(), onQuit)

 

Link to comment
11 hours ago, KnucklesSAEG said:

try
 


wanted = getElementData("wantedlevel")
addEventHandler("onPlayerLogin", root, function()
setElementData(wanted)
end)

 

forget that try this
 


function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin)
  if  not (isGuestAccount (getPlayerAccount (source))) then
    local accountData = getAccountData (theCurrentAccount, "funmodev2-money")
    if (accountData) then

      local playerWanted = getAccountData (theCurrentAccount, "funmodev2-wantedlevel")
      spawnPlayer (source, playerX, playerY, playerZ +1, 0, playerSkin, playerInt, playerDim)
      setTimer (setPlayerWantedLevel, 500, 1, source, playerWanted)
      setCameraTarget (source, source)
      fadeCamera(source, true, 2.0)
    else
      spawnPlayer (source, 1481.0855712891, -1771.2996826172, 18.795753479004, 0,78, 0, 0)
      setPlayerMoney (source, 200)
      setCameraTarget (source, source)
      fadeCamera(source, true, 2.0)  
    end   
  end
end
addEventHandler ("onPlayerLogin", getRootElement(), playerLogin)

function onLogout ()
	kickPlayer (source, nil, "Logging out is disallowed.")
end
addEventHandler ("onPlayerLogout", getRootElement(), onLogout)

function onQuit (quitType, reason, responsibleElement)
  if not (isGuestAccount (getPlayerAccount (source))) then
    account = getPlayerAccount (source)
    if (account) then
      local x,y,z = getElementPosition (source)
      setAccountData (account, "funmodev2-wantedlevel", getPlayerWantedLevel (source))
    end
  end
end
addEventHandler ("onPlayerQuit", getRootElement(), onQuit)

 

Thanks !

Please check post for make Jobs system !

thanks for your help .

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