Jump to content
  • 0
Sign in to follow this  
glemor123

About delay

Question

-	script	Sample	-1,{OnInit:	set .Delay,18000;	end;OnPCKillEvent:	if( @Delay < gettimetick(2) ){	getitem 7227,1;	announce strcharinfo(0) +"Killed Someone At The PVP Room",bc_blue|bc_all;	if( .Delay ) set @Delay,gettimetick(2) + .Delay;}end;}}

how many minutes/hours is 18000 that is set??

 

also about the announce i would like that the players killed name will pop up. like Killer 1 Killed Killer2

 

lastly. how to prevent them from bypassing the delay. because they will just reconnect and the delay will be removed already

Edited by glemor123

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

1st) It's in seconds. You can convert them to minutes or hours yourself. Please see gettimetick script command documentation for it, either in our wiki or the scripting documentation:


 

 

*gettimetick(<tick type>)

 

 

This function will return the system time in UNIX epoch time (if tick type is 2) or the time since the start of the current day in seconds if tick type is 1.
Passing 0 will make it return the server's tick, which is a measurement in milliseconds used by the server's timer system. The server's tick is an unsigned int which loops every ~50 days.

Just in case you don't know, UNIX epoch time is the number of seconds elapsed since 1st of January 1970, and is useful to see, for example, for how long the character has been online with OnPCLoginEvent and OnPCLogoutEvent, which could allow you to make an 'online time counted for conviction only' jail script.

 


 

2nd) You can use the killedrid var that is set as player value when running that OnPCKillEvent, and rid2name it .


Documentation:

 

OnPCKillEvent:

 
This special label triggers when a player kills another player. The variable 'killedrid' is set to the ID of the player killed.
 
* rid2name(<rid>)
 
Converts rid to name. Note: The player/monster/NPC must be online/enabled. Good for PCKillEvent where you can convert 'killedrid' to the name of the player.
 
Note: rid2name may not produce correct character names since rid means account id. It will return the current online character of the account only.
 
Answer:
	announce strcharinfo(0) +"Killed " + rid2name(killedrid) + " At The PVP Room",bc_blue|bc_all;

 


 

3rd: Variables with an @ prefix are temporary char variables (documentation) that get reset/deleted when logging out. You could make your variables permanent to the characters if you put them without any prefix (documentation).

 

Full documentation for this part:

 

Extent can be:
permanent - They still exist when the server resets.
temporary - They cease to exist when the server resets.
 
Prefix: scope and extent
nothing - A permanent variable attached to the character, the default
 variable type.
"@" - A temporary variable attached to the character.
 They disappear when the character logs out.

 

Answer:

Simply change all @Delay variable names to Delay without the @. This will force the var not to get deleted on log out.

 


 

Hope it helped you.

Share this post


Link to post
Share on other sites
  • 0

 

1st) It's in seconds. You can convert them to minutes or hours yourself. Please see gettimetick script command documentation for it, either in our wiki or the scripting documentation:

 

 

 

*gettimetick(<tick type>)

 

 

This function will return the system time in UNIX epoch time (if tick type is 2) or the time since the start of the current day in seconds if tick type is 1.

Passing 0 will make it return the server's tick, which is a measurement in milliseconds used by the server's timer system. The server's tick is an unsigned int which loops every ~50 days.

Just in case you don't know, UNIX epoch time is the number of seconds elapsed since 1st of January 1970, and is useful to see, for example, for how long the character has been online with OnPCLoginEvent and OnPCLogoutEvent, which could allow you to make an 'online time counted for conviction only' jail script.

 


 

2nd) You can use the killedrid var that is set as player value when running that OnPCKillEvent, and rid2name it .

 

Documentation:

OnPCKillEvent:

 
This special label triggers when a player kills another player. The variable 'killedrid' is set to the ID of the player killed.
 
* rid2name(<rid>)
 
Converts rid to name. Note: The player/monster/NPC must be online/enabled. Good for PCKillEvent where you can convert 'killedrid' to the name of the player.
 
Note: rid2name may not produce correct character names since rid means account id. It will return the current online character of the account only.
 
Answer:
	announce strcharinfo(0) +"Killed " + rid2name(killedrid) + " At The PVP Room",bc_blue|bc_all;

 


 

3rd: Variables with an @ prefix are temporary char variables (documentation) that get reset/deleted when logging out. You could make your variables permanent to the characters if you put them without any prefix (documentation).

 

Full documentation for this part:

 

Extent can be:
permanent - They still exist when the server resets.
temporary - They cease to exist when the server resets.
 
Prefix: scope and extent
nothing - A permanent variable attached to the character, the default
 variable type.
"@" - A temporary variable attached to the character.
 They disappear when the character logs out.

 

Answer:

Simply change all @Delay variable names to Delay without the @. This will force the var not to get deleted on log out.

 


 

Hope it helped you.

thank you sir

is this correct?

 

-	script	Sample	-1,{OnInit:	set .Delay,3600;	end;OnPCKillEvent:	if( .Delay < gettimetick(2) ){	getitem 7227,1;	announce strcharinfo(0) +"Killed " + rid2name(killedrid) + " At The PVP Room",bc_blue|bc_all;	if( .Delay ) set @Delay,gettimetick(2) + .Delay;}end;}}

Share this post


Link to post
Share on other sites
  • 0

You haven't changed your variables well. I told you to change all @Delay for Delay and you've changed one to .Delay and failed to change the other.

Share this post


Link to post
Share on other sites
  • 0

Sorry sir.

I didn't saw it 

 

-	script	Sample	-1,{OnInit:	set .Delay,3600;	end;OnPCKillEvent:	if( .Delay < gettimetick(2) ){	getitem 7227,1;	announce strcharinfo(0) +"Killed " + rid2name(killedrid) + " At The PVP Room",bc_blue|bc_all;	if( .Delay ) set .Delay,gettimetick(2) + .Delay;}end;}}

how about this sir?

Share this post


Link to post
Share on other sites
  • 0

Your version is supposed to be this one:

 

-	script	Sample	-1,{OnInit:	set .Delay,3600;	end;OnPCKillEvent:	if( Delay < gettimetick(2) ){	getitem 7227,1;	announce strcharinfo(0) +"Killed " + rid2name(killedrid) + " At The PVP Room",bc_blue|bc_all;	if( .Delay ) set Delay,gettimetick(2) + .Delay;}end;}}

 

Changing the @VAR to VAR (without prefixes) and leaving the previous .VARs without being touched, as I said.

 

Further advices, not for any purpose but for best scripting practices. This won't make your script better but at least easier to read and understand, think that you could en up making 500-line scripts:

-> Make all your variables lowercase.;

-> Name your variables differently. Even if .Delay (NPC var) is different from Delay (permanent character var) on script engine, it'd be better to have a different name for them.

 

Examples:

-> .Delay to .npc_delay

-> Delay to player_delay

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.