Jump to content

مشكلة في AccountData


Recommended Posts

السلام عليكم

عندي مشكلة في كود

function Quit() 
      local x,y,z = getElementPosition (source) 
      local playeraccount = getPlayerAccount ( source ) 
   function() 
        if ( playeraccount ) and not isGuestAccount ( playeraccount ) then 
            setAccountData ( playeraccount, "enad.money", getPlayerMoney ( source ) ) 
            setAccountData ( playeraccount, "enad.skin", getElementModel ( source ) ) 
            setAccountData ( playeraccount, "enad.health", getElementHealth ( source ) )            
            setAccountData ( playeraccount, "enad.armor", getPedArmor ( source ) )  
            setAccountData ( playeraccount, "enad.posX", x )                        
            setAccountData ( playeraccount, "enad.posY", y )    
            setAccountData ( playeraccount, "enad.posZ", z )    
            setAccountData ( playeraccount, "enad.interior", getElementInterior ( source ) )    
            setAccountData ( playeraccount, "enad.dimension", getElementDimension ( source ) ) 
            setAccountData ( playeraccount, "enad.weapon", getPedWeapon ( source ) )    
            setAccountData ( playeraccount, "enad.team", getPlayerTeam ( source ) )                         
        end 
     end 
end 
addEventHandler("onPlayerQuit",root,Quit) 
  
---------- 
  
function join() 
        local playeraccount = getPlayerAccount ( source )           
        local playerMoney = getAccountData(playerAccount, "enad.money") 
        local playerSkin = getAccountData(playerAccount, "enad.skin") 
        local playerHealth = getAccountData(playerAccount, "enad.health") 
        local playerArmor = getAccountData(playerAccount, "enad.armor")  
        local playerX = getAccountData(playerAccount, "enad.posX") 
        local playerY = getAccountData(playerAccount, "enad.posY") 
        local playerZ = getAccountData(playerAccount, "enad.posZ") 
        local playerInterior = getAccountData(playerAccount, "enad.interior") 
        local playerDimension = getAccountData(playerAccount, "enad.dimension") 
        local playerWeapon = getAccountData(playerAccount, "enad.weapon") 
        local playerTeam = getAccountData(playerAccount, "enad.team")       
            spawnPlayer ( source, playerX+1, playerY+1, playerZ, 0, playerSkin, 0, 0, playerTeam)       
            fadeCamera (source, true) 
            setCameraTarget (source, source)            
            setPlayerMoney ( player , playerMoney ) 
            setElementHealth ( source , playerHealth ) 
            setPedArmor ( source , playerArmor ) 
            setElementInterior ( source , playerInterior ) 
            setElementDimension ( source , playerDimension ) 
            giveWeapon ( source , playerWeapon ) 
end 
addEventHandler( "onPlayerJoin", getRootElement(), join) 

الخطا

'getAccountData' [Expected account at argument 1, got nil]attempt to perform arithmetic on local 'playerX' (a boolean value)

Link to comment

الأكاونت داتا تشتغل على الحساب, وأنت الحدث حقك مسويه إذا اللاعب دخل السيرفر

طبعاً إذا اللاعب دخل السيرفر ما راح يكون مسجل فهمتني ؟, عشان كذا لازم تعدل الحدث

onPlayerJoin

إلى

onPlayerLogin

Link to comment
الأكاونت داتا تشتغل على الحساب, وأنت الحدث حقك مسويه إذا اللاعب دخل السيرفر

طبعاً إذا اللاعب دخل السيرفر ما راح يكون مسجل فهمتني ؟, عشان كذا لازم تعدل الحدث

onPlayerJoin

إلى

onPlayerLogin

Geust راح يكون مسجل بس ام تي اي اول ما تدخل يحطونك ب حساب زائر

عملياً راح تنحفظ الداتا على هالحساب اللي هو زائر.

Link to comment

جرب :

function Quit() 
      local x,y,z = getElementPosition (source) 
      local acc1 = getPlayerAccount ( source ) 
        if ( acc1 ) and not isGuestAccount ( acc1 ) then 
            setAccountData ( acc1, "enad.money", getPlayerMoney ( source ) ) 
            setAccountData ( acc1, "enad.skin", getElementModel ( source ) ) 
            setAccountData ( acc1, "enad.health", getElementHealth ( source ) )           
            setAccountData ( acc1, "enad.armor", getPedArmor ( source ) ) 
            setAccountData ( acc1, "enad.posX", x )                       
            setAccountData ( acc1, "enad.posY", y )   
            setAccountData ( acc1, "enad.posZ", z )   
            setAccountData ( acc1, "enad.interior", getElementInterior ( source ) )   
            setAccountData ( acc1, "enad.dimension", getElementDimension ( source ) ) 
            setAccountData ( acc1, "enad.weapon", getPedWeapon ( source ) )   
            setAccountData ( acc1, "enad.team", getPlayerTeam ( source ) ) 
            setAccountData ( acc1, "enad.save", getPlayerTeam ( source ) ) 
        end 
     end 
      
addEventHandler("onPlayerQuit",root,Quit) 
  
---------- 
  
function join (_,acc) 
        if ( getAccountData ( acc, "enad.save" ) ) then 
        local playerMoney = getAccountData(acc, "enad.money") 
        local playerSkin = getAccountData(acc, "enad.skin") 
        local playerHealth = getAccountData(acc, "enad.health") 
        local playerArmor = getAccountData(acc, "enad.armor") 
        local playerX = getAccountData(acc, "enad.posX") 
        local playerY = getAccountData(acc, "enad.posY") 
        local playerZ = getAccountData(acc, "enad.posZ") 
        local playerInterior = getAccountData(acc, "enad.interior") 
        local playerDimension = getAccountData(acc, "enad.dimension") 
        local playerWeapon = getAccountData(acc, "enad.weapon") 
        local playerTeam = getAccountData(acc, "enad.team")       
            spawnPlayer ( source, playerX+1, playerY+1, playerZ, 0, playerSkin, 0, 0, playerTeam)       
            fadeCamera (source, true) 
            setCameraTarget (source, source)           
            setPlayerMoney ( source , playerMoney ) 
            setElementHealth ( source , playerHealth ) 
            setPedArmor ( source , playerArmor ) 
            setElementInterior ( source , playerInterior ) 
            setElementDimension ( source , playerDimension ) 
            giveWeapon ( source , playerWeapon ) 
    end 
end 
addEventHandler( "onPlayerLogin", getRootElement(), join) 
Edited by Guest
Link to comment

جرب :

function Quit()
      local x,y,z = getElementPosition (source)
      local acc1 = getacc ( source )
        if ( acc1 ) and not isGuestAccount ( acc1 ) then
            setAccountData ( acc1, "enad.money", getPlayerMoney ( source ) )
            setAccountData ( acc1, "enad.skin", getElementModel ( source ) )
            setAccountData ( acc1, "enad.health", getElementHealth ( source ) )          
            setAccountData ( acc1, "enad.armor", getPedArmor ( source ) )
            setAccountData ( acc1, "enad.posX", x )                      
            setAccountData ( acc1, "enad.posY", y )  
            setAccountData ( acc1, "enad.posZ", z )  
            setAccountData ( acc1, "enad.interior", getElementInterior ( source ) )  
            setAccountData ( acc1, "enad.dimension", getElementDimension ( source ) )
            setAccountData ( acc1, "enad.weapon", getPedWeapon ( source ) )  
            setAccountData ( acc1, "enad.team", getPlayerTeam ( source ) )
            setAccountData ( acc1, "enad.save", getPlayerTeam ( source ) )
        end
     end
     
addEventHandler("onPlayerQuit",root,Quit)
 
----------
 
function join (_,acc)
        if ( getAccountData ( acc, "enad.save" ) ) then
        local playerMoney = getAccountData(acc, "enad.money")
        local playerSkin = getAccountData(acc, "enad.skin")
        local playerHealth = getAccountData(acc, "enad.health")
        local playerArmor = getAccountData(acc, "enad.armor")
        local playerX = getAccountData(acc, "enad.posX")
        local playerY = getAccountData(acc, "enad.posY")
        local playerZ = getAccountData(acc, "enad.posZ")
        local playerInterior = getAccountData(acc, "enad.interior")
        local playerDimension = getAccountData(acc, "enad.dimension")
        local playerWeapon = getAccountData(acc, "enad.weapon")
        local playerTeam = getAccountData(acc, "enad.team")      
            spawnPlayer ( source, playerX+1, playerY+1, playerZ, 0, playerSkin, 0, 0, playerTeam)      
            fadeCamera (source, true)
            setCameraTarget (source, source)          
            setPlayerMoney ( source , playerMoney )
            setElementHealth ( source , playerHealth )
            setPedArmor ( source , playerArmor )
            setElementInterior ( source , playerInterior )
            setElementDimension ( source , playerDimension )
            giveWeapon ( source , playerWeapon )
    end
end
addEventHandler( "onPlayerLogin", getRootElement(), join)

سطر 3 يحتوي علي كود غريب

Link to comment
جرب :

function Quit()
      local x,y,z = getElementPosition (source)
      local acc1 = getacc ( source )
        if ( acc1 ) and not isGuestAccount ( acc1 ) then
            setAccountData ( acc1, "enad.money", getPlayerMoney ( source ) )
            setAccountData ( acc1, "enad.skin", getElementModel ( source ) )
            setAccountData ( acc1, "enad.health", getElementHealth ( source ) )          
            setAccountData ( acc1, "enad.armor", getPedArmor ( source ) )
            setAccountData ( acc1, "enad.posX", x )                      
            setAccountData ( acc1, "enad.posY", y )  
            setAccountData ( acc1, "enad.posZ", z )  
            setAccountData ( acc1, "enad.interior", getElementInterior ( source ) )  
            setAccountData ( acc1, "enad.dimension", getElementDimension ( source ) )
            setAccountData ( acc1, "enad.weapon", getPedWeapon ( source ) )  
            setAccountData ( acc1, "enad.team", getPlayerTeam ( source ) )
            setAccountData ( acc1, "enad.save", getPlayerTeam ( source ) )
        end
     end
     
addEventHandler("onPlayerQuit",root,Quit)
 
----------
 
function join (_,acc)
        if ( getAccountData ( acc, "enad.save" ) ) then
        local playerMoney = getAccountData(acc, "enad.money")
        local playerSkin = getAccountData(acc, "enad.skin")
        local playerHealth = getAccountData(acc, "enad.health")
        local playerArmor = getAccountData(acc, "enad.armor")
        local playerX = getAccountData(acc, "enad.posX")
        local playerY = getAccountData(acc, "enad.posY")
        local playerZ = getAccountData(acc, "enad.posZ")
        local playerInterior = getAccountData(acc, "enad.interior")
        local playerDimension = getAccountData(acc, "enad.dimension")
        local playerWeapon = getAccountData(acc, "enad.weapon")
        local playerTeam = getAccountData(acc, "enad.team")      
            spawnPlayer ( source, playerX+1, playerY+1, playerZ, 0, playerSkin, 0, 0, playerTeam)      
            fadeCamera (source, true)
            setCameraTarget (source, source)          
            setPlayerMoney ( source , playerMoney )
            setElementHealth ( source , playerHealth )
            setPedArmor ( source , playerArmor )
            setElementInterior ( source , playerInterior )
            setElementDimension ( source , playerDimension )
            giveWeapon ( source , playerWeapon )
    end
end
addEventHandler( "onPlayerLogin", getRootElement(), join)

سطر 3 يحتوي علي كود غريب

هذا خطأ لاني سويت replace لبعض الكلمات ومالاحظت تم التعديل :mrgreen:

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