Jump to content

save skills // ak47


Markn1

Recommended Posts

Does not save!

Debug: no errors. Help pls o.O
 

--server

function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin)
  if  not (isGuestAccount (getPlayerAccount (source))) then
      local wpn1 = getAccountData (theCurrentAccount, "ak47")
      setPedStat (source, wpn1, 77)  
  end
end
addEventHandler ("onPlayerLogin", getRootElement(), playerLogin)

function onQuit (quitType, reason, responsibleElement)
  if not (isGuestAccount (getPlayerAccount (source))) then
    account = getPlayerAccount (source)
    if (account) then
      setAccountData (account, "ak47", getPedStat (source, 77))
    end
  end
end
addEventHandler ("onPlayerQuit", getRootElement(), onQuit)

 

Link to comment
4 minutes ago, Markn1 said:

Does not save!

Debug: no errors. Help pls o.O
 


--server

function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin)
  if  not (isGuestAccount (getPlayerAccount (source))) then
      local wpn1 = getAccountData (theCurrentAccount, "ak47")
      setPedStat (source, wpn1, 77)  
  end
end
addEventHandler ("onPlayerLogin", getRootElement(), playerLogin)

function onQuit (quitType, reason, responsibleElement)
  if not (isGuestAccount (getPlayerAccount (source))) then
    account = getPlayerAccount (source)
    if (account) then
      setAccountData (account, "ak47", getPedStat (source, 77))
    end
  end
end
addEventHandler ("onPlayerQuit", getRootElement(), onQuit)

 

If your not arabic please post your topic on this section :
https://forum.multitheftauto.com/forum/71-scripting/
+
Did you add mod on admin group ?
Try it :
 


function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin)
  if ( isGuestAccount ( getPlayerAccount ( source ) ) ) then return end
      local wpn1 = getAccountData (theCurrentAccount, "ak47")
      setPedStat (source, wpn1, 77)  
  end
end
addEventHandler ("onPlayerLogin", getRootElement(), playerLogin)

function onQuit (quitType, reason, responsibleElement)
  if ( isGuestAccount ( getPlayerAccount ( source ) ) ) then return end
    account = getPlayerAccount (source)
    if (account) then
      setAccountData (account, "ak47", getPedStat (source, 77))
    end
  end
end
addEventHandler ("onPlayerQuit", getRootElement(), onQuit)

 

Link to comment

try this :

function playerLogin ( thePreviousAccount, theCurrentAccount, autoLogin )
    if ( getAccountData ( theCurrentAccount, 'ak74-DATA' ) ) then
        setPedStat ( source, getAccountData ( theCurrentAccount, 'ak74-DATA' ), 77 )
    end
end

addEventHandler ( 'onPlayerLogin', root, playerLogin )

function playerLogOut ( prev, cur )
    setAccountData ( prev, 'ak74-DATA', getPedStat ( source, 77 ) )
end

addEventHandler ( 'onPlayerLogout', root, playerLogOut )

function onQuit ( quitType, reason, responsibleElement )
local acc = getPlayerAccount ( source )
    if not ( isGuestAccount ( acc ) ) then
        setAccountData ( acc, 'ak74-DATA', getPedStat ( source, 77 ) )
    end
end

addEventHandler ( 'onPlayerQuit', root, onQuit )

 

Edited by #,+( _xiRoc[K]; >
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...