Jump to content

مشكله حفظ الفريق تم الحل


rabe3

Recommended Posts

السلام عليكم

الي يحفض التيم اذا ضفت واحد بفريق يضله حافظه واذا طردته من الفريق ينطرد بس لما يسوي اعاده تسجيل دخول saveteam عندي انا سيرفر فري روم وعندي سكربت

يرجع بلفريق

وهاذ الكود

addEventHandler("onPlayerLogin",root,function() 
    local team = getAccountData (getPlayerAccount(source), "team") -- gets players team 
    if (team==getTeamName(getTeamFromName(team))) then 
      setPlayerTeam(source, getTeamFromName(team)) -- sets players team 
    end 
end) -- sets players team on login 
  
function save() 
    local team = getPlayerTeam(source) -- Gets the players team 
    local account = getPlayerAccount(source) 
    if not isGuestAccount(account) then -- Checks to see if the player is a guest or not 
        if(team)then 
            setAccountData(account, "team", getTeamName(team)) --saves team 
        end 
    end 
end 
addEventHandler("onPlayerLogout", root, save) -- saves team on logout 
addEventHandler("onPlayerQuit", root, save) -- saves team on quit 

Edited by Guest
Link to comment

جرب كذا ,

-- Server Side #

addEventHandler('onPlayerQuit',root, 
function() 
    local acc = getPlayerAccount(source) 
        if not acc or isGuestAccount(acc) then return end 
            setAccountData(acc,'Team',getPlayerTeam(source)) 
    end 
) 
  
addEventHandler('onPlayerLogin',root, 
function(_,acc) 
    local Data = getAccountData(acc,'Team') 
        if ( Data ) then 
            setPlayerTeam(source,getTeamFromName(Data)) 
        end 
    end 
) 

^ الكود لو خرج اللاعب يحفظ التيم حقه , ولو سجل الدخول يرجع للتيم حقه ,

+ onPlayerLogout = اصلا لو سجل الخروج ما بينسحب التيم حقه, فـ ماله داعي ذذ

واذا مو قصدك كذا اشرح لي اكثر -_-

Link to comment
جرب كذا ,

-- Server Side #

addEventHandler('onPlayerQuit',root, 
function() 
    local acc = getPlayerAccount(source) 
        if not acc or isGuestAccount(acc) then return end 
            setAccountData(acc,'Team',getPlayerTeam(source)) 
    end 
) 
  
addEventHandler('onPlayerLogin',root, 
function(_,acc) 
    local Data = getAccountData(acc,'Team') 
        if ( Data ) then 
            setPlayerTeam(source,getTeamFromName(Data)) 
        end 
    end 
) 

^ الكود لو خرج اللاعب يحفظ التيم حقه , ولو سجل الدخول يرجع للتيم حقه ,

+ onPlayerLogout = اصلا لو سجل الخروج ما بينسحب التيم حقه, فـ ماله داعي ذذ

واذا مو قصدك كذا اشرح لي اكثر -_-

قصدي يعني لو انا طلعت الاعب من التيم يحفظ انه طلع من التيم

Link to comment

:?..هذا والله أعلم

addEventHandler("onPlayerLogin",root,function() 
    local team = getAccountData (getPlayerAccount(source), "team") -- gets players team 
    if not team or team == false then return end 
      setPlayerTeam(source, getTeamFromName(team)) -- sets players team 
end) -- sets players team on login 
  
function save() 
    local team = getPlayerTeam(source) -- Gets the players team 
    local account = getPlayerAccount(source) 
    if not isGuestAccount(account) then -- Checks to see if the player is a guest or not 
        if(team)then 
            setAccountData(account, "team", getTeamName(team)) --saves team 
        else 
            setAccountData(account, "team", false) --saves team 
        end 
    end 
end 
addEventHandler("onPlayerLogout", root, save) -- saves team on logout 
addEventHandler("onPlayerQuit", root, save) -- saves team on quit 

Link to comment
:?..هذا والله أعلم
addEventHandler("onPlayerLogin",root,function() 
    local team = getAccountData (getPlayerAccount(source), "team") -- gets players team 
    if not team or team == false then return end 
      setPlayerTeam(source, getTeamFromName(team)) -- sets players team 
end) -- sets players team on login 
  
function save() 
    local team = getPlayerTeam(source) -- Gets the players team 
    local account = getPlayerAccount(source) 
    if not isGuestAccount(account) then -- Checks to see if the player is a guest or not 
        if(team)then 
            setAccountData(account, "team", getTeamName(team)) --saves team 
        else 
            setAccountData(account, "team", false) --saves team 
        end 
    end 
end 
addEventHandler("onPlayerLogout", root, save) -- saves team on logout 
addEventHandler("onPlayerQuit", root, save) -- saves team on quit 

بارك الله فيكم والله ماتقصرون ابدا :D:D تم الحل

Link to comment
:?..هذا والله أعلم
addEventHandler("onPlayerLogin",root,function() 
    local team = getAccountData (getPlayerAccount(source), "team") -- gets players team 
    if not team or team == false then return end 
      setPlayerTeam(source, getTeamFromName(team)) -- sets players team 
end) -- sets players team on login 
  
function save() 
    local team = getPlayerTeam(source) -- Gets the players team 
    local account = getPlayerAccount(source) 
    if not isGuestAccount(account) then -- Checks to see if the player is a guest or not 
        if(team)then 
            setAccountData(account, "team", getTeamName(team)) --saves team 
        else 
            setAccountData(account, "team", false) --saves team 
        end 
    end 
end 
addEventHandler("onPlayerLogout", root, save) -- saves team on logout 
addEventHandler("onPlayerQuit", root, save) -- saves team on quit 

بارك الله فيكم والله ماتقصرون ابدا :D:D تم الحل

العفو, حياك الله في اي وقت يالطيب ض1

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