SphereCommunity
Problem with diconnect timer - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Problem with diconnect timer (/Thread-Problem-with-diconnect-timer)



Problem with diconnect timer - dabritmusic - 02-12-2014 08:24 AM

hi i have a vet/afk system. basically sends out a message to all clients every 15 minutes. they have to type .continue xxxx in order to keep playing. otherwise they are disconnected. they are rewarded with a vet point if they comply. i use this because i have a time reward system and i don't want players going afk to reap the benefits... how do i make it a random number on the .continue. i don't want them to be able to macro it. also the disconnect isn't working correctly. any suggestions? thanks... im slowly getting the hang of things! sorry for all the questions. i haven't dabbled with sphere for over 6 years, appreciate all the feedback my posts get!

[ITEMDEF i_verification_obj]
ID=i_crystal_ball
NAME=Verification Object [DO NOT REMOVE]
WEIGHT=5000 // Just to make sure...
TYPE=t_script

ON=@Create
ATTR=attr_decay

ON=@DClick
IF (<SRC.ISGM>)
SRC.SYSMESSAGE Initialized.
TIMER=60*15 // Fifteen minutes
ENDIF
RETURN 1

ON=@Timer
SERV.ALLCLIENTS f_verification
TIMER=60*15 // Activate timer once again.
RETURN 1


[ITEMDEF i_disconnect_obj]
ID=i_memory
NAME=Disconnect Object
WEIGHT=0
TYPE=t_eq_script

ON=@Create
ATTR=attr_invis|attr_decay

ON=@Timer
CONT.DISCONNECT
REMOVE
RETURN 1

[FUNCTION f_verification]
LOCAL.CODE += <EVAL (<UID> / <FINDLAYER(21).COUNT>) 3>
SERV.NEWITEM=i_disconnect_obj
NEW.CONT=<UID>
NEW.MORE1=<LOCAL.CODE>
NEW.TIMER=60*3 // Three minutes.
MESSAGE @077a Please type .Continue <dLOCAL.CODE> to continue playing.

[PLEVEL 1]
Continue

[FUNCTION Continue]
IF (<FINDID(i_disconnect_obj).UID>)
IF !STRCMPI(<ARGS>,Code)
SYSMESSAGE @077a Current verification code is: <dFINDID(i_disconnect_obj).MORE1>.
RETURN 1
ENDIF
IF (<ARGS>==<FINDID(i_disconnect_obj).MORE1>)
SYSMESSAGE @077a You may continue playing.
FINDID(i_disconnect_obj).REMOVE
SYSMESSAGE @077a Incorrect. You will be disconnected in <dFINDID(i_disconnect_obj).TIMER> seconds.
ENDIF
tag0.vp= (<tag0.vp> +1 )
sysmessage @0481 You have earned a veteran reward point, you now have : <eval <tag0.vp>>!
ENDIF
ELSE
SYSMESSAGE @077a No verification code currently active.
ENDIF

[EOF]


RE: Problem with diconnect timer - Alaric - 02-12-2014 09:02 AM

I would use server timerf, set "var.timevalue" and fill it with random number. Now show dialog/or spread message.
Then again, timerf for countdown on players (i think you can clear a specific timer(this would do the .continue <number> function) and if it expires -> disconnect).

Better would be creating a dialog with some random things than this message. Taking the message with external apps and comparing is easier than comparing pixels and pictures in dialog. From time to time you'll have to change the system or create database big enough that it won't worth creating automatic external script.

E: Imho, this is not a good way to keep players playing for fun. But to piss them off.


RE: Problem with diconnect timer - amonvangrell - 02-12-2014 11:59 AM

(02-12-2014 09:02 AM)Alaric Wrote:  E: Imho, this is not a good way to keep players playing for fun. But to piss them off.

agreed.


RE: Problem with diconnect timer - dabritmusic - 02-12-2014 04:29 PM

lol yea for sure. is there a way to add this to a idled client? like if a client idles for longer than say 15 mins it pops up dialog d_continue with a button to continue etc... and if they dont click the button within 60 seconds it disconnects them...

[dialog d_continue]
200,200
resizepic -1 0 9250 493 207
resizepic 16 16 9300 462 174
dtext 120 40 800 Reborn Legends Anti AFK System
dtext 40 70 100 Click the button to continue playing!
dtext 200 120 800 CONTINUE:
button 300 125 2103 2104 1 0 1

[dialog d_continue button]
ON=1
sysmessage @0481 You may continue playing!
ENDIF


RE: Problem with diconnect timer - Shidhun - 02-12-2014 07:58 PM

I'd suggest a passive Check, if they are only idling.

Set a Timestamp on every trigger that you like :

Code:
//Speechfile
on=*
IF (<ACCOUNT.PLEVEL>==1)&&((<ARGN1>==0)||(<ARGN1>==2)||(<ARGN1>==8))
TAG.LastAction=<SERV.TIME>

// Triggers
on=@whatever
TAG.LastAction=<SERV.TIME>

Then, simply check, if the Tag was set within a defined amount of time :

IF (<EVAL <TAG0.LastAction>+6000> > <SERV.TIME>)//Char has done anything in the last 10 Minutes
    //Add your function for gaining a "vet"-point
ENDIF



RE: Problem with diconnect timer - dabritmusic - 02-13-2014 08:32 AM

ill scratch the whole vet thing with that system. ill just use that for time reward. i just hate idled clients. unnecessary lagg.