0 Üye ve 1 Ziyaretçi konuyu incelemekte.
--[[-------------------------------------------------original scriptcredits to Yakuza.Real and solidsnake and kenixhttp://forum.mtasa.com/viewtopic.php?f=91&t=40132-------------------------------------------------booo just fix it ]]exports.scoreboard:addScoreboardColumn('Zaman')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, arg2end 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, "Zaman", 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,'Zaman' ) 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, "Zaman-hour", tostring(hour) ) setAccountData ( playeraccount, "Zaman-min", tostring(min) ) setAccountData ( playeraccount, "Zaman-sec", tostring(sec) ) setAccountData ( playeraccount, "Zaman", tostring(sValue) ) end t[ source ] = nilend function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local time = getAccountData ( playeraccount, "Zaman" ) local hou = getAccountData ( playeraccount, "Zaman-hour") local min = getAccountData ( playeraccount, "Zaman-min") local sec = getAccountData ( playeraccount, "Zaman-sec") if ( time ) then setElementData ( source, "Zaman", time ) t[ source ]["hour"] = tonumber(hou) t[ source ]["min"] = tonumber(min) t[ source ]["sec"] = tonumber(sec) else setElementData ( source, "Zaman",0 ) setAccountData ( playeraccount, "Zaman",0 ) end endendaddEventHandler ( "onPlayerQuit", root, onPlayerQuit )addEventHandler ( "onPlayerLogin", root, onPlayerLogin )
--[[-------------------------------------------------original scriptcredits to Yakuza.Real and solidsnake and kenixhttp://forum.mtasa.com/viewtopic.php?f=91&t=40132-------------------------------------------------booo just fix it ]]exports.scoreboard:addScoreboardColumn('Zaman')local t = { } function checkValues( source,arg1,arg2) if (arg2 >= 60) then t[ source ][ 'min' ] = tonumber( t[ source ][ 'min' ] or 0 ) + 1 end if (arg1 >= 60) then t[ source ][ 'min' ] = 0 t[ source ][ 'hour' ] = tonumber( t[ source ][ 'hour' ] or 0 ) + 1 end return arg1, arg2end setTimer( function( ) for _, v in pairs( getElementsByType( "player" ) ) do if (not t[ v ]) then t[ v ] = { ["hour"] = 0, ["min"] = 0, } end local min,sec = checkValues ( v, t[ v ][ 'min' ] or 0, ) local hour = tonumber( t[ v ][ 'hour' ] or 0 ) setElementData( v, "Zaman", tostring( hour )..':'..tostring( min )..':' ) end end, 1000, 0) function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local sValue = getElementData( source,'Zaman' ) local hour = tonumber( t[ source ][ 'hour' ] or 0 ) local min = tonumber( t[ source ][ 'min' ] or 0 ) setAccountData ( playeraccount, "Zaman-hour", tostring(hour) ) setAccountData ( playeraccount, "Zaman-min", tostring(min) ) setAccountData ( playeraccount, "Zaman", tostring(sValue) ) end t[ source ] = nilend function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local time = getAccountData ( playeraccount, "Zaman" ) local hou = getAccountData ( playeraccount, "Zaman-hour") local min = getAccountData ( playeraccount, "Zaman-min") if ( time ) then setElementData ( source, "Zaman", time ) t[ source ]["hour"] = tonumber(hou) t[ source ]["min"] = tonumber(min) else setElementData ( source, "Zaman",0 ) setAccountData ( playeraccount, "Zaman",0 ) end endendaddEventHandler ( "onPlayerQuit", root, onPlayerQuit )addEventHandler ( "onPlayerLogin", root, onPlayerLogin )