SphereCommunity
critical problem - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: critical problem (/Thread-critical-problem)

Pages: 1 2


critical problem - Runcuks - 12-05-2014 04:08 AM

i get these lines, like every 10h of server upline..

anyone know whats the problem for it.??

19:08:CRITICAL:Exception, in CServer::Tick() #7 "generic"
19:08:FATAL:Server Unstable: Aborted
19:08:FATAL:Server Unstable: Aborted
19:08:FATAL:Server Unstable: Aborted
19:11:CRITICAL:(wos_functions.scp,736)Exception, in CScriptObj::Verb() #0 ""
19:11:FATAL:(wos_functions.scp,736)Server Unstable: Aborted
19:11:FATAL:(wos_functions.scp,736)Server Unstable: Aborted
19:11:CRITICAL:(wos_functions.scp,736)'Main' thread hang, restarting...
19:11:ERROR:(wos_functions.scp,736)33:Tx Error 0
19:11:FATAL:(wos_functions.scp,736)Server Unstable: Aborted
19:11:FATAL:(wos_functions.scp,736)Server Unstable: Aborted


and the 736 line is
Code:
db.query "SELECT unix_timestamp(now())"

whole function
Code:
[function unix_time]
// vozra6aet unix time stamp
db.query "SELECT unix_timestamp(now())"
if (<db.row.numrows>)
   return <ddb.row.0>
else
   serv.log CRITICAL: Cant get unix time !
   return 0
endif



RE: critical problem - Extreme - 12-05-2014 04:35 AM

db.query "SELECT unix_timestamp(now())"
I don't know if this command should work... Your syntax is wrong..


RE: critical problem - Runcuks - 12-05-2014 07:29 AM

its working kinda.. in my db it shows like unix_time = 1417404298


RE: critical problem - Extreme - 12-05-2014 08:12 AM

Interesting... I though it only works selecting something from tables Big Grin


RE: critical problem - Runcuks - 12-06-2014 03:46 AM

this function returns the correct time.. but sadly it crashes ://


RE: critical problem - Extreme - 12-06-2014 04:28 AM

Hmmm, do you really need this function?
Whats the objective of its usage?


RE: critical problem - Runcuks - 12-06-2014 05:25 AM

emm yes, i need this because i use it for events..
i will give you a sample of it...
Code:
[function check_ip_event]
//function chechks if players ip has been used in last 15 minutes
//because only 1 ip per char can be on event
db.query "SELECT * FROM `events_ips` WHERE `event`='<argv[0]>' AND `ip`='<account.lastip>';"
if (!<db.row.numrows>)
   // if didn't find, then add ip
   db.execute "INSERT INTO `events_ips` (`event`, `ip`, `time`) VALUES('<argv[0]>', '<account.lastip>', '<unix_time>');"
   return 0
else
   //if found ip, then check if 10 minutes have passed
   local.db_fix = <db.row.0.time>
   local.total = <eval <unix_time> - <local.db_fix>>
   if (<local.total> > 600)
      // if 10 mintes has passed
      db.execute "UPDATE `events_ips` SET `time`=<unix_time> WHERE `event`='<argv[0]>' AND `ip`='<account.lastip>';"
      return 0
   else
      // this ip has been used for last 10 mintes, can't add repeatedly
      return 1
   endif
endif



RE: critical problem - Extreme - 12-06-2014 05:47 AM

You can not change <unix_time> to unix_timestamp(now()) ?

Like this?

db.execute "UPDATE `events_ips` SET `time`=unix_timestamp(now()) WHERE `event`='<argv[0]>' AND `ip`='<account.lastip>';"


RE: critical problem - Runcuks - 12-06-2014 05:50 AM

ofcourse i can, but you think this will solve a problem? if this is the same?


RE: critical problem - Extreme - 12-06-2014 06:00 AM

Maybe?