Jump to content

حفظ التيمات


Mando

Recommended Posts

السلام عليكم ورحمة الله وبركاتة

بسم الله الرحمن الرحيم

انا عايز احفظ التيمات لو خرجت من سيرفر ودخلت وسجلت دخولي يحفظ التيم !

وش استخدم ؟؟ :)

Link to comment
السلام عليكم ورحمة الله وبركاتة

بسم الله الرحمن الرحيم

انا عايز احفظ التيمات لو خرجت من سيرفر ودخلت وسجلت دخولي يحفظ التيم !

وش استخدم ؟؟ :)

setAccountData 
getAccountData 
getPlayerAccount 
getPlayerTeam 
getTeamFromName 
setPlayerTeam 
addEventHandler 
'onPlayerQuit' -- Event 
'onPlayerLogin' -- Event 
'onPlayerLogout' -- Event 
  

Link to comment
السلام عليكم ورحمة الله وبركاتة

بسم الله الرحمن الرحيم

انا عايز احفظ التيمات لو خرجت من سيرفر ودخلت وسجلت دخولي يحفظ التيم !

وش استخدم ؟؟ :)

setAccountData 
getAccountData 
getPlayerAccount 
getPlayerTeam 
getTeamFromName 
setPlayerTeam 
addEventHandler 
'onPlayerQuit' -- Event 
'onPlayerLogin' -- Event 
'onPlayerLogout' -- Event 
  

كل دة ؟؟؟؟؟؟؟؟

بس كتير :oops:

بحاول !

Link to comment

جـرب *

addEventHandler("onPlayerQuit",root, 
function() 
    local CooL = getPlayerAccount(source) 
        if isGuestAccount(CooL) then return end 
            setAccountData(CooL,"Team",getPlayerTeam(source)) 
    end 
) 
  
addEventHandler("onPlayerLogin",root, 
function(_,col) 
    local CoOoL = getAccountData(col,"Team") 
        if ( CoOoL ) then 
        setPlayerTeam(source,CoOoL) 
        end 
    end 
) 

Link to comment
جـرب *
addEventHandler("onPlayerQuit",root, 
function() 
    local CooL = getPlayerAccount(source) 
        if isGuestAccount(CooL) then return end 
            setAccountData(CooL,"Team",getPlayerTeam(source)) 
    end 
) 
  
addEventHandler("onPlayerLogin",root, 
function(_,col) 
    local CoOoL = getAccountData(col,"Team") 
        if ( CoOoL ) then 
        setPlayerTeam(source,CoOoL) 
        end 
    end 
) 

فية اخطاء بسيطة .. تحفظ التيم نفسة ماراح تقدر تسترجعه وكيف بتتتعرف عليه ^ احفظ اسم التيم واسترجعه وجيب التيم من اسمة ..

مثال بسيط :

addCommandHandler ( 'gSave', 
    function ( gPlayer ) 
        local gAcc = getPlayerAccount ( gPlayer ) 
            if gAcc and not isGuestAccount ( gAcc ) and getPlayerTeam ( gPlayer ) then 
                setAccountData ( gAcc,'gTeam',getTeamName ( getPlayerTeam ( gPlayer ) ) ) 
                    outputChatBox ( '* Your Team Was Saved',gPlayer,255,255,0 ) 
            end 
        end ) 
         
addCommandHandler  ( 'gRestore', 
    function ( gPlayer )  
        local gAcc = getPlayerAccount ( gPlayer ) 
            if gAcc and not isGuestAccount ( gAcc ) then 
                local gTeamName = getAccountData ( gAcc,'gTeam' ) 
                    if gTeamName then 
                        setPlayerTeam ( gPlayer,getTeamFromName ( tostring ( gTeamName ) ) ) 
                        outputChatBox ( '* Your Team Was Restored',gPlayer,0,255,0 ) 
            end 
        end 
    end ) 

Link to comment

addEventHandler( "onPlayerQuit", root, function(  ) 
   local PlayerAcc = getPlayerAccount ( source ) 
     if ( PlayerAcc and not isGuestAccount ( PlayerAcc ) and getPlayerTeam ( source ) ) then 
         setAccountData ( PlayerAcc, "PlayerTeam", getTeamName ( getPlayerTeam ( source ) ) 
      end 
end ) 
  
addEventHandler( "onPlayerLogin", root, function( ) 
    local PlayerAcc = getPlayerAccount ( source ) 
    local Team = getAccountData( PlayerAcc, "PlayerTeam" ) 
     if ( Team ) then 
         setPlayerTeam ( source, getTeamFromName ( tostring ( Team ) ) ) 
         outputChatBox ( "** You Join Team:"..Team, source, 0, 255, 0, true ) 
      end 
end ) 
Link to comment
addEventHandler( "onPlayerQuit", root, function(  ) 
   local PlayerAcc = getPlayerAccount ( source ) 
     if ( PlayerAcc and not isGuestAccount ( PlayerAcc ) and getPlayerTeam ( source ) ) then 
         setAccountData ( PlayerAcc, "PlayerTeam", getTeamName ( getPlayerTeam ( source ) ) 
      end 
end ) 
  
addEventHandler( "onPlayerLogin", root, function( ) 
    local PlayerAcc = getPlayerAccount ( source ) 
    local Team = getAccountData( PlayerAcc, "PlayerTeam" ) 
     if ( Team ) then 
         setPlayerTeam ( source, getTeamFromName ( tostring ( Team ) ) ) 
         outputChatBox ( "** You Join Team:"..Team, source, 0, 255, 0, true ) 
      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...