i,xAhmed Posted September 24, 2013 Share Posted September 24, 2013 آلسلآمم عليكمم عندي مود الوقت اذا سويت ريستارت ترجع الساعات وش الحل واذا تعرفون كيف احفظ عن طريق SQL الطريقةة لآهنتم Link to comment
jafar Posted September 24, 2013 Share Posted September 24, 2013 الطريقة باختصار انك تسوي لوق أوت ثم تسوي لوق ان وترجع الساعات Link to comment
iMr.Dawix~# Posted September 24, 2013 Share Posted September 24, 2013 اعتقد بوو معدل على مود الوقت ويحفظ الوقت اكاونت داتا على القاعده Link to comment
i,xAhmed Posted September 24, 2013 Author Share Posted September 24, 2013 اعتقد بوو معدل على مود الوقت ويحفظ الوقت اكاونت داتا على القاعده طيب وليه مآتعطينا رابط آلمود ؟ Link to comment
iMr.Dawix~# Posted September 24, 2013 Share Posted September 24, 2013 (edited) طيب وليه مآتعطينا رابط آلمود ؟ مشوار ادور عليه مادري شوف ذا حق اجنبي جربه exports.scoreboard:addScoreboardColumn('PlayTime') addEventHandler("onResourceStart",resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS Prestege_Save_Time ( PlayerSerial,Hours,Minuts,Seconds,PlayAllTime )" ) outputDebugString ("Execute SQL Loadded !") end ) 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 SaveDataOnQuit ( ) 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 ) local serial = getPlayerSerial ( source ) local Results = executeSQLQuery("SELECT * FROM Prestege_Save_Time WHERE PlayerSerial=?",serial) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then executeSQLQuery ( "INSERT INTO Prestege_Save_Time ( PlayerSerial,Hours,Minuts,Seconds,PlayAllTime ) VALUES(?,?,?,?,?)",serial,hour,min,sec,sValue ) else executeSQLQuery('UPDATE Prestege_Save_Time SET Hours =?, Minuts =?, Seconds =?, PlayAllTime =? WHERE PlayerSerial =?', hour, min, sec, sValue, serial) end t[ source ] = nil end addEventHandler("onPlayerQuit",root,SaveDataOnQuit) function SaveDataOnStop ( ) for k,v in ipairs ( getElementsByType("player") ) do local playeraccount = getPlayerAccount ( v ) local sValue = getElementData( v,'PlayTime' ) if not ( t [ v ] ) then t [ v ] = { } end local hour = tonumber( t[ v ][ 'hour' ] or 0 ) local min = tonumber( t[ v ][ 'min' ] or 0 ) local sec = tonumber( t[ v ][ 'sec' ] or 0 ) local serial = getPlayerSerial ( v ) local Results = executeSQLQuery("SELECT * FROM Prestege_Save_Time WHERE PlayerSerial=?",getPlayerSerial ( v ) ) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then executeSQLQuery ( "INSERT INTO Prestege_Save_Time ( PlayerSerial,Hours,Minuts,Seconds,PlayAllTime ) VALUES(?,?,?,?,?)",serial,hour,min,sec,sValue ) else executeSQLQuery('UPDATE Prestege_Save_Time SET Hours =?, Minuts =?, Seconds =?, PlayAllTime =? WHERE PlayerSerial =?', hour, min, sec, sValue, serial) end end end addEventHandler("onResourceStop",resourceRoot,SaveDataOnStop) function GetDataOnStart ( ) for _,v in ipairs ( getElementsByType ( "player" ) ) do local Results = executeSQLQuery("SELECT * FROM Prestege_Save_Time WHERE PlayerSerial=?",getPlayerSerial ( v ) ) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then return end if not t[ v ] then t[ v ] = {} end t[ v ]["hour"] = tonumber(Results[1]["Hours"]) t[ v ]["min"] = tonumber(Results[1]["Minuts"]) t[ v ]["sec"] = tonumber(Results[1]["Seconds"]) end end addEventHandler("onResourceStart",resourceRoot,GetDataOnStart) function GetDataOnJoin ( ) local Results = executeSQLQuery("SELECT * FROM Prestege_Save_Time WHERE PlayerSerial=?",getPlayerSerial ( source ) ) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then return end setElementData ( source, "PlayTime", Results[1]["PlayAllTime"] ) if not t[ source ] then t[ source ] = {} end t[ source ]["hour"] = tonumber(Results[1]["Hours"]) t[ source ]["min"] = tonumber(Results[1]["Minuts"]) t[ source ]["sec"] = tonumber(Results[1]["Seconds"]) end addEventHandler("onPlayerJoin",root,GetDataOnJoin) استبدله باللي في مودك Edit #1: وهذا موضوع لو دورت قبل ماتطرح موضوعك افضل viewtopic.php?f=160&t=59691 Edited September 24, 2013 by Guest Link to comment
#DRAGON!FIRE Posted September 24, 2013 Share Posted September 24, 2013 طيب وليه مآتعطينا رابط آلمود ؟ مشوار ادور عليه مادري شوف ذا حق اجنبي جربه exports.scoreboard:addScoreboardColumn('PlayTime') addEventHandler("onResourceStart",resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS Prestege_Save_Time ( PlayerSerial,Hours,Minuts,Seconds,PlayAllTime )" ) outputDebugString ("Execute SQL Loadded !") end ) 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 SaveDataOnQuit ( ) 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 ) local serial = getPlayerSerial ( source ) local Results = executeSQLQuery("SELECT * FROM Prestege_Save_Time WHERE PlayerSerial=?",serial) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then executeSQLQuery ( "INSERT INTO Prestege_Save_Time ( PlayerSerial,Hours,Minuts,Seconds,PlayAllTime ) VALUES(?,?,?,?,?)",serial,hour,min,sec,sValue ) else executeSQLQuery('UPDATE Prestege_Save_Time SET Hours =?, Minuts =?, Seconds =?, PlayAllTime =? WHERE PlayerSerial =?', hour, min, sec, sValue, serial) end t[ source ] = nil end addEventHandler("onPlayerQuit",root,SaveDataOnQuit) function SaveDataOnStop ( ) for k,v in ipairs ( getElementsByType("player") ) do local playeraccount = getPlayerAccount ( v ) local sValue = getElementData( v,'PlayTime' ) if not ( t [ v ] ) then t [ v ] = { } end local hour = tonumber( t[ v ][ 'hour' ] or 0 ) local min = tonumber( t[ v ][ 'min' ] or 0 ) local sec = tonumber( t[ v ][ 'sec' ] or 0 ) local serial = getPlayerSerial ( v ) local Results = executeSQLQuery("SELECT * FROM Prestege_Save_Time WHERE PlayerSerial=?",getPlayerSerial ( v ) ) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then executeSQLQuery ( "INSERT INTO Prestege_Save_Time ( PlayerSerial,Hours,Minuts,Seconds,PlayAllTime ) VALUES(?,?,?,?,?)",serial,hour,min,sec,sValue ) else executeSQLQuery('UPDATE Prestege_Save_Time SET Hours =?, Minuts =?, Seconds =?, PlayAllTime =? WHERE PlayerSerial =?', hour, min, sec, sValue, serial) end end end addEventHandler("onResourceStop",resourceRoot,SaveDataOnStop) function GetDataOnStart ( ) for _,v in ipairs ( getElementsByType ( "player" ) ) do local Results = executeSQLQuery("SELECT * FROM Prestege_Save_Time WHERE PlayerSerial=?",getPlayerSerial ( v ) ) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then return end if not t[ v ] then t[ v ] = {} end t[ v ]["hour"] = tonumber(Results[1]["Hours"]) t[ v ]["min"] = tonumber(Results[1]["Minuts"]) t[ v ]["sec"] = tonumber(Results[1]["Seconds"]) end end addEventHandler("onResourceStart",resourceRoot,GetDataOnStart) function GetDataOnJoin ( ) local Results = executeSQLQuery("SELECT * FROM Prestege_Save_Time WHERE PlayerSerial=?",getPlayerSerial ( source ) ) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then return end setElementData ( source, "PlayTime", Results[1]["PlayAllTime"] ) if not t[ source ] then t[ source ] = {} end t[ source ]["hour"] = tonumber(Results[1]["Hours"]) t[ source ]["min"] = tonumber(Results[1]["Minuts"]) t[ source ]["sec"] = tonumber(Results[1]["Seconds"]) end addEventHandler("onPlayerJoin",root,GetDataOnJoin) استبدله باللي في مودك # حق برسستيج Link to comment
iMr.Dawix~# Posted September 24, 2013 Share Posted September 24, 2013 # حق برسستيج مادري حق الأجنبي ولا برستيج اهم شيء انه من واحد منهم شوف ردي عدلته لقيت رد لبرستيج فيه Link to comment
i,xAhmed Posted September 24, 2013 Author Share Posted September 24, 2013 آلمشكلةة آبيه يحفظ عن طريق الحساب طيب لو ساعاتي كانت 50 ورحت جهآز ثاني مو بتطير Link to comment
#DRAGON!FIRE Posted September 24, 2013 Share Posted September 24, 2013 آلمشكلةة آبيه يحفظ عن طريق الحسابطيب لو ساعاتي كانت 50 ورحت جهآز ثاني مو بتطير # يب بتطير # الأحسن تسوي setAccountData Link to comment
i,xAhmed Posted September 24, 2013 Author Share Posted September 24, 2013 طيب اسمعع انا عدلت ع مود برستيجج ابي تشوف الكود خطآ ولآ صح exports.scoreboard:addScoreboardColumn('PlayTime') addEventHandler("onResourceStart",resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS Prestege_Save_Time ( PlayerAccount,Hours,Minuts,Seconds,PlayAllTime )" ) outputDebugString ("Execute SQL Loadded !") end ) 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 SaveDataOnQuit ( ) 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 ) local Account = getPlayerAccount ( source ) local Results = executeSQLQuery("SELECT * FROM Prestege_Save_Time WHERE PlayerAccount=?",Account) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then executeSQLQuery ( "INSERT INTO Prestege_Save_Time ( PlayerAccount,Hours,Minuts,Seconds,PlayAllTime ) VALUES(?,?,?,?,?)",Account,hour,min,sec,sValue ) else executeSQLQuery('UPDATE Prestege_Save_Time SET Hours =?, Minuts =?, Seconds =?, PlayAllTime =? WHERE PlayerAccount =?', hour, min, sec, sValue, Account) end t[ source ] = nil end addEventHandler("onPlayerQuit",root,SaveDataOnQuit) function SaveDataOnStop ( ) for k,v in ipairs ( getElementsByType("player") ) do local playeraccount = getPlayerAccount ( v ) local sValue = getElementData( v,'PlayTime' ) if not ( t [ v ] ) then t [ v ] = { } end local hour = tonumber( t[ v ][ 'hour' ] or 0 ) local min = tonumber( t[ v ][ 'min' ] or 0 ) local sec = tonumber( t[ v ][ 'sec' ] or 0 ) local Account = getPlayerAccount ( v ) local Results = executeSQLQuery("SELECT * FROM Prestege_Save_Time WHERE PlayerAccount=?",getPlayerAccount ( v ) ) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then executeSQLQuery ( "INSERT INTO Prestege_Save_Time ( PlayerAccount,Hours,Minuts,Seconds,PlayAllTime ) VALUES(?,?,?,?,?)",Account,hour,min,sec,sValue ) else executeSQLQuery('UPDATE Prestege_Save_Time SET Hours =?, Minuts =?, Seconds =?, PlayAllTime =? WHERE PlayerAccount =?', hour, min, sec, sValue, Account) end end end addEventHandler("onResourceStop",resourceRoot,SaveDataOnStop) function GetDataOnStart ( ) for _,v in ipairs ( getElementsByType ( "player" ) ) do local Results = executeSQLQuery("SELECT * FROM Prestege_Save_Time WHERE PlayerAccount=?",getPlayerAccount ( v ) ) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then return end if not t[ v ] then t[ v ] = {} end t[ v ]["hour"] = tonumber(Results[1]["Hours"]) t[ v ]["min"] = tonumber(Results[1]["Minuts"]) t[ v ]["sec"] = tonumber(Results[1]["Seconds"]) end end addEventHandler("onResourceStart",resourceRoot,GetDataOnStart) function GetDataOnJoin ( ) local Results = executeSQLQuery("SELECT * FROM Prestege_Save_Time WHERE PlayerAccount=?",getPlayerAccount ( source ) ) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then return end setElementData ( source, "PlayTime", Results[1]["PlayAllTime"] ) if not t[ source ] then t[ source ] = {} end t[ source ]["hour"] = tonumber(Results[1]["Hours"]) t[ source ]["min"] = tonumber(Results[1]["Minuts"]) t[ source ]["sec"] = tonumber(Results[1]["Seconds"]) end addEventHandler("onPlayerJoin",root,GetDataOnJoin) Link to comment
#DRAGON!FIRE Posted September 24, 2013 Share Posted September 24, 2013 طيب اسمعع انا عدلت ع مود برستيجج ابي تشوف الكود خطآ ولآ صح exports.scoreboard:addScoreboardColumn('PlayTime') addEventHandler("onResourceStart",resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS Prestege_Save_Time ( PlayerAccount,Hours,Minuts,Seconds,PlayAllTime )" ) outputDebugString ("Execute SQL Loadded !") end ) 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 SaveDataOnQuit ( ) 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 ) local Account = getPlayerAccount ( source ) local Results = executeSQLQuery("SELECT * FROM Prestege_Save_Time WHERE PlayerAccount=?",Account) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then executeSQLQuery ( "INSERT INTO Prestege_Save_Time ( PlayerAccount,Hours,Minuts,Seconds,PlayAllTime ) VALUES(?,?,?,?,?)",Account,hour,min,sec,sValue ) else executeSQLQuery('UPDATE Prestege_Save_Time SET Hours =?, Minuts =?, Seconds =?, PlayAllTime =? WHERE PlayerAccount =?', hour, min, sec, sValue, Account) end t[ source ] = nil end addEventHandler("onPlayerQuit",root,SaveDataOnQuit) function SaveDataOnStop ( ) for k,v in ipairs ( getElementsByType("player") ) do local playeraccount = getPlayerAccount ( v ) local sValue = getElementData( v,'PlayTime' ) if not ( t [ v ] ) then t [ v ] = { } end local hour = tonumber( t[ v ][ 'hour' ] or 0 ) local min = tonumber( t[ v ][ 'min' ] or 0 ) local sec = tonumber( t[ v ][ 'sec' ] or 0 ) local Account = getPlayerAccount ( v ) local Results = executeSQLQuery("SELECT * FROM Prestege_Save_Time WHERE PlayerAccount=?",getPlayerAccount ( v ) ) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then executeSQLQuery ( "INSERT INTO Prestege_Save_Time ( PlayerAccount,Hours,Minuts,Seconds,PlayAllTime ) VALUES(?,?,?,?,?)",Account,hour,min,sec,sValue ) else executeSQLQuery('UPDATE Prestege_Save_Time SET Hours =?, Minuts =?, Seconds =?, PlayAllTime =? WHERE PlayerAccount =?', hour, min, sec, sValue, Account) end end end addEventHandler("onResourceStop",resourceRoot,SaveDataOnStop) function GetDataOnStart ( ) for _,v in ipairs ( getElementsByType ( "player" ) ) do local Results = executeSQLQuery("SELECT * FROM Prestege_Save_Time WHERE PlayerAccount=?",getPlayerAccount ( v ) ) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then return end if not t[ v ] then t[ v ] = {} end t[ v ]["hour"] = tonumber(Results[1]["Hours"]) t[ v ]["min"] = tonumber(Results[1]["Minuts"]) t[ v ]["sec"] = tonumber(Results[1]["Seconds"]) end end addEventHandler("onResourceStart",resourceRoot,GetDataOnStart) function GetDataOnJoin ( ) local Results = executeSQLQuery("SELECT * FROM Prestege_Save_Time WHERE PlayerAccount=?",getPlayerAccount ( source ) ) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then return end setElementData ( source, "PlayTime", Results[1]["PlayAllTime"] ) if not t[ source ] then t[ source ] = {} end t[ source ]["hour"] = tonumber(Results[1]["Hours"]) t[ source ]["min"] = tonumber(Results[1]["Minuts"]) t[ source ]["sec"] = tonumber(Results[1]["Seconds"]) end addEventHandler("onPlayerJoin",root,GetDataOnJoin) # الكود عفسةة , وطويل مدري كيف سواه خخ # بس انا شفته تقريبا صح # بس مدام بتسوي على حساب اللاعب ليه سكل , اكأونت داتا وخلأص مو كل ذا Link to comment
فاّرس Posted September 24, 2013 Share Posted September 24, 2013 ع الحساب افضل, وحاول تسويه ولا اطرحه اذا ما عرفت, Link to comment
jafar Posted September 24, 2013 Share Posted September 24, 2013 --[[ ------------------------------------------------- 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 ) 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