iMr5YaLeY Posted August 13, 2013 Share Posted August 13, 2013 لو ممكن يا شباب يعيني مثلاا المشرف 5 ساعات اي واحد ياصل 5 ساعات على طول ياخد ادمن مشرف مثال لفل 1=1ساعه لفل2=2ساعه لفل3=3ساعه لفل4=4ساعه لفل5=5ساعه مشرف =15 مراقب =25 لو ممكن يعني اول ما يصير تواجده من الاوقات هذي ياخذ ادمن كود مود الوقت حقي --[[ ------------------------------------------------- original script credits to Yakuza.Real and solidsnake and kenix viewtopic.php?f=91&t=40132 ------------------------------------------------- booo just fix it ]] exports.scoreboard:addScoreboardColumn('PlayTime') local t = { } function checkValues( source,arg1,arg2) if (arg2 >= 60) then t[ source ][ 'min' ] = tonumber( t[ source ][ 'min' ] or 0 ) + 1 t[ source ][ 'sec' ] = 0 end if (arg1 >= 60) then t[ source ][ 'min' ] = 0 t[ source ][ 'hour' ] = tonumber( t[ source ][ 'hour' ] or 0 ) + 1 end return arg1, arg2 end setTimer( function( ) for _, v in pairs( getElementsByType( "player" ) ) do if (not t[ v ]) then t[ v ] = { ["hour"] = 0, ["min"] = 0, ["sec"] = 0 } end t[ v ][ 'sec' ] = tonumber( t[ v ][ 'sec' ] or 0 ) + 1 local min,sec = checkValues ( v, t[ v ][ 'min' ] or 0, t[ v ][ 'sec' ] or 0 ) local hour = tonumber( t[ v ][ 'hour' ] or 0 ) setElementData( v, "PlayTime", tostring( hour )..':'..tostring( min )..':'..tostring( sec ) ) end end, 1000, 0 ) function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local sValue = getElementData( source,'PlayTime' ) local hour = tonumber( t[ source ][ 'hour' ] or 0 ) local min = tonumber( t[ source ][ 'min' ] or 0 ) local sec = tonumber( t[ source ][ 'sec' ] or 0 ) setAccountData ( playeraccount, "PlayTime-hour", tostring(hour) ) setAccountData ( playeraccount, "PlayTime-min", tostring(min) ) setAccountData ( playeraccount, "PlayTime-sec", tostring(sec) ) setAccountData ( playeraccount, "PlayTime", tostring(sValue) ) end t[ source ] = nil end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local time = getAccountData ( playeraccount, "PlayTime" ) local hou = getAccountData ( playeraccount, "PlayTime-hour") local min = getAccountData ( playeraccount, "PlayTime-min") local sec = getAccountData ( playeraccount, "PlayTime-sec") if ( time ) then setElementData ( source, "PlayTime", time ) t[ source ]["hour"] = tonumber(hou) t[ source ]["min"] = tonumber(min) t[ source ]["sec"] = tonumber(sec) else setElementData ( source, "PlayTime",0 ) setAccountData ( playeraccount, "PlayTime",0 ) end end end addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) addEventHandler ( "onPlayerLogin", root, onPlayerLogin ) addCommandHandler("givetime", function (player,cmd,PlayerName,Time) if PlayerName and Time then local thePlayer = getPlayerFromName(PlayerName) if isElement(thePlayer) then if tonumber(Time) then t[thePlayer]["hour"] = tonumber(Time) outputChatBox("* DONE",player,0,255,0) else outputChatBox("* Error In TIME",player,255,0,0) end else outputChatBox("* Player Not Found",player,255,0,0) end else outputChatBox("* givetime <player name> <time>",player,255,0,0) end end ) Link to comment
3NAD Posted August 13, 2013 Share Posted August 13, 2013 لم يتم التجربة ذذ -- ضيفه بنفس الملف Groups = { ["50"] = "Moderator"; ["100"] = "SuperModerator"; ["500"] = "Admin"; }; setTimer ( function ( ) for _, v in ipairs ( getElementsByType ( "player" ) ) do local plrAccount = getPlayerAccount ( v ) if not isGuestAccount ( plrAccount ) then if Groups[tostring(t[v]["hour"])] then if not isObjectInACLGroup ( "user."..getAccountName(plrAccount), aclGetGroup ( Groups[tostring(t[v]["hour"])] ) ) then aclGroupAddObject ( aclGetGroup ( Groups[tostring(t[v]["hour"])] ), "user."..getAccountName(plrAccount) ) end end end end end , 10000, 0 ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now