Jump to content

الحفظ عند الخروج


Recommended Posts

السلام عليكم ,,

addEventHandler("onPlayerQuit",root, 
function (thePlayer) 
 time = getRealTime () 
  day = time.monthday 
  month = time.month + 1 
  year = time.year + 1900 
  hour = time.hour - 1 
  minute = time.minute + 1 
  second = time.second 
 name = getPlayerName ( source ) 
if getAccountName(getPlayerAccount(source)) == "xx" then 
text = name.." #FFFFFF[ "..day.."/"..month.."/"..year.." ] [ "..hour..":"..minute..":"..second.." ]" 
setElementData ( resourceRoot, "xx", text ) 
  
elseif getAccountName(getPlayerAccount(source)) == "yy" then 
text = name.." #FFFFFF[ "..day.."/"..month.."/"..year.." ] [ "..hour..":"..minute..":"..second.." ]" 
setElementData ( resourceRoot, "yy", text ) 
end 
end 
) 
addEventHandler("onPlayerLogin",root, 
function (thePlayer) 
name = getPlayerName ( source ) 
if getAccountName(getPlayerAccount(source)) == "xx" then 
text = name.." #00FF00Online." 
setElementData ( resourceRoot, "xx", text ) 
  
elseif getAccountName(getPlayerAccount(source)) == "yy" then 
text = name.." #00FF00Online." 
setElementData ( resourceRoot, "yy", text ) 
end 
end 
) 
function command (player) 
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("DP")) then 
outputChatBox("Last player online time:",player,255,255,255,true) 
outputChatBox(getElementData ( resourceRoot, "xx") or "The player didn't join when server/script start",player,255,255,255,true) 
outputChatBox(getElementData ( resourceRoot, "yy") or "The player didn't join when server/script start",player,255,255,255,true) 
else 
outputChatBox("You aren't from DP clan",player,255,0,0,true) 
end 
end 
addCommandHandler("lastjoin",command) 
addCommandHandler("lj",command) 

الكود ذا سويته بحيث يجيب اسم كل لاعب من حسابه بعدين يطلع متى اخر مره دخل

السكربت ضابط , بس لما يصير للسكربت ولا السيرفر ريستارت

المعلومات \ القيم كلها تختفي

وانا ابيها تحفظ , لاهنتم آبي مساعدتكم

Link to comment

لم يتم التجربة

addEventHandler ( "onPlayerQuit",root, 
    function ( ) 
        local plrAcc = getPlayerAccount ( source ) 
        if not isGuestAccount ( plrAcc ) then 
            local time = getRealTime ( ) 
            local day = time.monthday 
            local month = time.month + 1 
            local year = time.year + 1900 
            local hour = time.hour - 1 
            local minute = time.minute + 1 
            local second = time.second 
            local name = getPlayerName ( source ) 
            local text = name.." #FFFFFF[ "..day.."/"..month.."/"..year.." ] [ "..hour..":"..minute..":"..second.." ]"           
            setAccountData ( plrAcc, "lastJoin", text ) 
        end 
    end 
) 
  
addEventHandler ( "onPlayerLogin", root, 
    function ( _, acc ) 
        local name = getPlayerName ( source ) 
        local text = name.." #00FF00Online." 
        setAccountData ( acc, "lastJoin", text ) 
    end 
) 
  
function command ( player, _, account ) 
    local plrAcc = getPlayerAccount ( player ) 
    if not isGuestAccount ( plrAcc ) then 
        if isObjectInACLGroup ( "user."..getAccountName ( plrAcc ), aclGetGroup ( "DP" ) ) then 
            if account then 
                local acc = getAccount ( account ) 
                if acc then 
                    outputChatBox ( "Last player online time:", player, 255, 255, 255, true ) 
                    outputChatBox ( getAccountData ( acc, "lastJoin" ).."." or "The player didn't join.", player, 255, 255, 255, true ) 
                end 
            else 
                outputChatBox ( "/lastjoin [accountName]", player, 255, 0, 0, true ) 
            end 
        else 
            outputChatBox("You aren't from DP clan", player, 255, 0, 0, true )           
        end 
    end 
end 
addCommandHandler ( "lastjoin", command ) 
addCommandHandler ( "lj", command ) 

Link to comment
لم يتم التجربة
addEventHandler ( "onPlayerQuit",root, 
    function ( ) 
        local plrAcc = getPlayerAccount ( source ) 
        if not isGuestAccount ( plrAcc ) then 
            local time = getRealTime ( ) 
            local day = time.monthday 
            local month = time.month + 1 
            local year = time.year + 1900 
            local hour = time.hour - 1 
            local minute = time.minute + 1 
            local second = time.second 
            local name = getPlayerName ( source ) 
            local text = name.." #FFFFFF[ "..day.."/"..month.."/"..year.." ] [ "..hour..":"..minute..":"..second.." ]"           
            setAccountData ( plrAcc, "lastJoin", text ) 
        end 
    end 
) 
  
addEventHandler ( "onPlayerLogin", root, 
    function ( _, acc ) 
        local name = getPlayerName ( source ) 
        local text = name.." #00FF00Online." 
        setAccountData ( acc, "lastJoin", text ) 
    end 
) 
  
function command ( player, _, account ) 
    local plrAcc = getPlayerAccount ( player ) 
    if not isGuestAccount ( plrAcc ) then 
        if isObjectInACLGroup ( "user."..getAccountName ( plrAcc ), aclGetGroup ( "DP" ) ) then 
            if account then 
                local acc = getAccount ( account ) 
                if acc then 
                    outputChatBox ( "Last player online time:", player, 255, 255, 255, true ) 
                    outputChatBox ( getAccountData ( acc, "lastJoin" ).."." or "The player didn't join.", player, 255, 255, 255, true ) 
                end 
            else 
                outputChatBox ( "/lastjoin [accountName]", player, 255, 0, 0, true ) 
            end 
        else 
            outputChatBox("You aren't from DP clan", player, 255, 0, 0, true )           
        end 
    end 
end 
addCommandHandler ( "lastjoin", command ) 
addCommandHandler ( "lj", command ) 

ضابط , بس انا ابي لسته

هذا لازم احط حساب اللاعب زي كذا

/lj king12

آنا آبيه يطلع حسابات انا محددها

edit#1 :

ياليت يكون يجيب الحسابات اللي بالقروب , ويحطها لسته بالشات

Link to comment
addCommandHandler("lgj", 
    function (player,_,group) 
        if group then 
            if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)),aclGetGroup("Admin")) then 
                if aclGetGroup(group) then 
                    outputChatBox("- Players In " .. group,player,0,255,0) 
                    for i,ply in ipairs(getElementsByType("player")) do 
                        if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(ply)),aclGetGroup(group)) then 
                            local ll = getAccountData(getPlayerAccount(ply),"lastJoin") 
                            local name = getPlayerName(ply) 
                            if ll then 
                                outputChatBox("- " .. name .. " | " .. ll,player,0,255,0) 
                            end 
                        end 
                    end 
                else 
                    outputChatBox("Error : " .. group .. " Not Found",player,255,0,0) 
                end 
            else 
                outputChatBox("* You Are Not Admin",player,255,0,0) 
            end 
        else 
            outputChatBox("* lgj ",player,255,0,0) 
        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...