The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Timer
Author Message
mrkarlo
Journeyman
*

Posts: 160
Likes Given: 3
Likes Received: 6 in 5 posts
Joined: Mar 2012
Reputation: 1



Post: #1
Timer
hey!!
I want to make some timer on command "home home home". Only one time can use it in 24h.
It's possible? And how will it look.
05-06-2015 03:08 AM
Find all posts by this user Like Post Quote this message in a reply
Van Glan Bloom
Journeyman
*

Posts: 104
Likes Given: 2
Likes Received: 3 in 3 posts
Joined: Jun 2013
Reputation: 0



Post: #2
RE: Timer
You can make something like this :

Code:
[FUNCTION Home]
IF <src.restest 1 home_timer>
SRC.SYSMESSAGE  @09c1 You need wait a X minutes.
RETURN 1
elseif (<SRC.FLAGS> & statf_dead)
src.sysmessage  @09c1 You will be teleporter in 45 secounds ...
elseif !<src.restest 1 home_memory>
src.newitem home_memory
src.act.equip
elseif !<src.restest 1 home_timer>
src.newitem home_timer
src.act.equip
endif

[ITEMDEF home_memory]
ID=i_memory
TYPE=t_eq_script
NAME=home Memory

on=@create
attr=04

ON=@equip
timer=1

on=@timer
cont.go 6116,1234,1  // define your area
cont.flags=<cont.tag.flags>
cont.tag.flags=
remove
return 1

[ITEMDEF home_timer]
ID=i_memory
TYPE=t_eq_script
NAME=home Timer

on=@create
attr=04
TIMER=84600

ON=@equip
timer=1

on=@timer
IF (<MORE>>0)
more=<more>-1
TIMER=1
ELSE
REMOVE
ENDIF
RETURN 1
05-06-2015 07:10 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Van Glan Bloom's post
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #3
RE: Timer
And if you want to make it to work in the 'home home home', you'll have to add 'home' to speech:

Code:
[SPEECH spk_player]
// All players speech filtered through here.
ON=home home home   //   Ghosts can go home.
   IF (<FLAGS>&statf_dead)
      go <home> // <-- change this line to: home
   endif

EDIT: This is inside sphere_speech.scp
(This post was last modified: 05-06-2015 04:21 PM by XuN.)
05-06-2015 04:21 PM
Find all posts by this user Like Post Quote this message in a reply
mrkarlo
Journeyman
*

Posts: 160
Likes Given: 3
Likes Received: 6 in 5 posts
Joined: Mar 2012
Reputation: 1



Post: #4
RE: Timer
Van Glan Bloom, Xun thank you guys!!
05-07-2015 03:00 AM
Find all posts by this user Like Post Quote this message in a reply
mrkarlo
Journeyman
*

Posts: 160
Likes Given: 3
Likes Received: 6 in 5 posts
Joined: Mar 2012
Reputation: 1



Post: #5
RE: Timer
I need lil information! How to insert into the sysmessage the number of minutes remaining till next try?
05-08-2015 01:59 AM
Find all posts by this user Like Post Quote this message in a reply
Extreme
Grandmaster Poster
***

Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #6
RE: Timer
Quick help

PHP Code:
ON=home home home
IF (<TAG0.HOMEHOMEHOME> > <SERV.TIME>)
 
SYSMESSAGE @026,,1 You need wait for <EVAL <TAG0.HOMEHOMEHOME>/10seconds to use this again.
 RETURN 
1
ELIF 
(<SRC.FLAGS> & STATF_DEAD)
 
GO <HOME>
 
TAG0.HOMEHOMEHOME <EVAL <SERV.TIME>+864000>
ENDIF 

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
05-08-2015 09:16 AM
Find all posts by this user Like Post Quote this message in a reply
mrkarlo
Journeyman
*

Posts: 160
Likes Given: 3
Likes Received: 6 in 5 posts
Joined: Mar 2012
Reputation: 1



Post: #7
RE: Timer
thanx Extreme. Serv.time+3600 its one hour? or +60?
05-12-2015 01:19 AM
Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #8
RE: Timer
serv.time is based on tenths of second so <serv.time>/10 gives you the seconds. 60*60*10 (36000) is the correct number.
05-12-2015 02:37 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes XuN's post
Post Reply 


Forum Jump:


User(s) browsing this thread: 4 Guest(s)