Jump to content
  • 0

delay script


IsabelaFernandez

Question


  • Group:  Members
  • Topic Count:  145
  • Topics Per Day:  0.07
  • Content Count:  354
  • Reputation:   8
  • Joined:  04/16/18
  • Last Seen:  

 

Hello, as the title already informs, I would if possible to add 2 seconds of delay to be able to use this script again. Thank you so much to who you can help me.

https://pastebin.com/S6hEFRmf

Link to comment
Share on other sites

15 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  90
  • Reputation:   34
  • Joined:  10/01/18
  • Last Seen:  

18 minutes ago, IsabelaFernandez said:

 

Hello, as the title already informs, I would if possible to add 2 seconds of delay to be able to use this script again. Thank you so much to who you can help me.

https://pastebin.com/S6hEFRmf

Here you go check OnInit part:

 

-	script	paytowinbuffs	-1,{
	end;

OnBuffs:
	if(!isequipped(4263)) {
		message strcharinfo(0),"Does not work equipped with Incarnated Samurai Card.";
		end;
	}
	if(getgroupid() <= 4) {
		message strcharinfo(0),"You don't have any Authorization for this command.";
		end;
	}
	.@timer = delay_buffer - gettimetick(2);	
	if (.@timer > 0) {
		dispbottom( "You have to wait "+ .@timer +" second"+ ( .@timer > 1 ? "s" : "" ) +" to use the command again.", 0xFF0000 );
		end;
	}	
	.@size = getarraysize(.buffs$);
	for( .@i = 0; .@i < .@size; .@i++ ) {
		.@menu$ = .@menu$ + ""+.buffs$[.@i]+"" + ":";
	}
	.@i = select(.@menu$) -1;
	sc_start .elements[.@i],180000,5;
	delay_buffer = gettimetick(2) + .delay;
	end;

OnInit:
	.delay  = 3 * 2; // 5 = 5 seconds *60 = 360 seconds
	setarray .buffs$, "^800080Envenenar Arma^000000", "^40E0D0Aspersio^000000", "^000000Sombrio^000000", "^FFD700Encantar com Ventania^000000", "^0000FFEncantar com Geada^000000", "^FF0000Encantar com Chama^000000", "^B8860BEncantar com Terremoto^000000";
	setarray .elements, 26, 37, "144", "98", "97", "96", "99";
	bindatcmd "encantar","paytowinbuffs::OnBuffs",0,99;
	end;
}

 

 

 

Edited by Royr
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  145
  • Topics Per Day:  0.07
  • Content Count:  354
  • Reputation:   8
  • Joined:  04/16/18
  • Last Seen:  

3 minutes ago, Royr said:

Here you go check OnInit part:

 


-	script	paytowinbuffs	-1,{
	end;

OnBuffs:
	if(getgroupid() <= 4) {
		message strcharinfo(0),"Falha, você não possui VIP.";
		end;
	}
	if(isequipped(4263)) {
		message strcharinfo(0),"Não funciona equipado com Samurai Encarnado.";
		end;
	}
	
	.@timer = delay_buffer - gettimetick(2);	
	if (.@timer > 0) {
		dispbottom( "You have to wait "+ .@timer +" second"+ ( .@timer > 1 ? "s" : "" ) +" to use the command again.", 0xFF0000 );
		end;
	}	
	
	.@size = getarraysize(.buffs$);
	for( .@i = 0; .@i < .@size; .@i++){
		.@menu$ = .@menu$ + ""+.buffs$[.@i]+"" + ":";
	}
	.@i = select(.@menu$) -1;
	sc_start .elements[.@i],180000,5;
	//atcommand "@refresh "+strcharinfo(0);
	delay_buffer = gettimetick(2) + .delay;
	end;

OnInit:
	.delay  = 3 * 2; // 5 = 5 seconds *60 = 360 seconds
	setarray .buffs$, "^800080Envenenar Arma^000000", "^40E0D0Aspersio^000000", "^000000Sombrio^000000", "^FFD700Encantar com Ventania^000000", "^0000FFEncantar com Geada^000000", "^FF0000Encantar com Chama^000000", "^B8860BEncantar com Terremoto^000000";
	setarray .elements, 26, 37, "144", "98", "97", "96", "99";
	bindatcmd "encantar","paytowinbuffs::OnBuffs",0,99;
	end;
}

  

 

 

 

thanks but I have a problem that players are able to circumvent the restriction of the item using the command fast 2 times in a row .... any idea how to solve this?

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  292
  • Reputation:   199
  • Joined:  05/03/13
  • Last Seen:  

Just a guess: move the delay_buffer assignment above .@size assignment.

So the delay is calculated before having to select a buff not after.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  303
  • Reputation:   117
  • Joined:  12/10/16
  • Last Seen:  

You could add a variable when the player is using it.

-	script	paytowinbuffs	-1,{
	end;

OnBuffs:
	if(getgroupid() <= 4) {
		message strcharinfo(0),"Falha, você não possui VIP.";
		end;
	}
	if(isequipped(4263)) {
		message strcharinfo(0),"Não funciona equipado com Samurai Encarnado.";
		end;
	}
	if(@buffs_inuse) {
		end;
	}

	if (gettimetick(2) < delay_buffer) {
		dispbottom( "You have to wait "+Time2Str(delay_bufer)+" to use the command again.", 0xFF0000 );
		end;
	}

	@buffs_inuse = true;

	.@menu$ = implode(.buffs$,":");
	.@i = prompt(.@menu$) -1;
	if(.@i < 255) {
		sc_start .elements[.@i],180000,5;
		//atcommand "@refresh "+strcharinfo(0);
		delay_buffer = gettimetick(2) + .delay;
	}

	@buffs_inuse = false;
	end;

OnInit:
	.delay  = 3 * 2; // 5 = 5 seconds *60 = 360 seconds
	setarray .buffs$, "^800080Envenenar Arma^000000", "^40E0D0Aspersio^000000", "^000000Sombrio^000000", "^FFD700Encantar com Ventania^000000", "^0000FFEncantar com Geada^000000", "^FF0000Encantar com Chama^000000", "^B8860BEncantar com Terremoto^000000";
	setarray .elements, 26, 37, 144, 98, 97, 96, 99;
	bindatcmd "encantar","paytowinbuffs::OnBuffs",0,99;
	end;
}

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  292
  • Reputation:   199
  • Joined:  05/03/13
  • Last Seen:  

If you compute the delay before the buffing then the „lock“ is not needed, since the delay is handling that. The problem is that current implementation is calculating the delay after buffing, which I think results in running the script twice before the delay does what it should do. 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  145
  • Topics Per Day:  0.07
  • Content Count:  354
  • Reputation:   8
  • Joined:  04/16/18
  • Last Seen:  

47 minutes ago, n0tttt said:

You could add a variable when the player is using it.


-	script	paytowinbuffs	-1,{
	end;

OnBuffs:
	if(getgroupid() <= 4) {
		message strcharinfo(0),"Falha, você não possui VIP.";
		end;
	}
	if(isequipped(4263)) {
		message strcharinfo(0),"Não funciona equipado com Samurai Encarnado.";
		end;
	}
	if(@buffs_inuse) {
		end;
	}

	if (gettimetick(2) < delay_buffer) {
		dispbottom( "You have to wait "+Time2Str(delay_bufer)+" to use the command again.", 0xFF0000 );
		end;
	}

	@buffs_inuse = true;

	.@menu$ = implode(.buffs$,":");
	.@i = prompt(.@menu$) -1;
	if(.@i < 255) {
		sc_start .elements[.@i],180000,5;
		//atcommand "@refresh "+strcharinfo(0);
		delay_buffer = gettimetick(2) + .delay;
	}

	@buffs_inuse = false;
	end;

OnInit:
	.delay  = 3 * 2; // 5 = 5 seconds *60 = 360 seconds
	setarray .buffs$, "^800080Envenenar Arma^000000", "^40E0D0Aspersio^000000", "^000000Sombrio^000000", "^FFD700Encantar com Ventania^000000", "^0000FFEncantar com Geada^000000", "^FF0000Encantar com Chama^000000", "^B8860BEncantar com Terremoto^000000";
	setarray .elements, 26, 37, 144, 98, 97, 96, 99;
	bindatcmd "encantar","paytowinbuffs::OnBuffs",0,99;
	end;
}

 

 

thanks, but unfortunately it is still possible to cheat spamming the command =(

36 minutes ago, Normynator said:

If you compute the delay before the buffing then the „lock“ is not needed, since the delay is handling that. The problem is that current implementation is calculating the delay after buffing, which I think results in running the script twice before the delay does what it should do. 

 

could you give an example of how it would look?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  193
  • Reputation:   41
  • Joined:  07/21/16
  • Last Seen:  

Try

-	script	paytowinbuffs	-1,{
	end;

OnBuffs:
	if(getgroupid() <= 4) {
		message strcharinfo(0),"Falha, você não possui VIP.";
		end;
	}
	if(isequipped(4263)) {
		message strcharinfo(0),"Não funciona equipado com Samurai Encarnado.";
		end;
	}
	if(@buffs_inuse == 1) {
		end;
	}

	if (gettimetick(2) < delay_buffer) {
		dispbottom( "You have to wait "+Time2Str(delay_bufer)+" to use the command again.", 0xFF0000 );
		end;
	}

	@buffs_inuse = 1;

	.@menu$ = implode(.buffs$,":");
	.@i = prompt(.@menu$) -1;
	if(.@i < 255) {
		sc_start .elements[.@i],180000,5;
		//atcommand "@refresh "+strcharinfo(0);
		delay_buffer = gettimetick(2) + .delay;
	}

	@buffs_inuse = 0;
	end;

OnInit:
	.delay  = 3 * 2; // 5 = 5 seconds *60 = 360 seconds
	setarray .buffs$, "^800080Envenenar Arma^000000", "^40E0D0Aspersio^000000", "^000000Sombrio^000000", "^FFD700Encantar com Ventania^000000", "^0000FFEncantar com Geada^000000", "^FF0000Encantar com Chama^000000", "^B8860BEncantar com Terremoto^000000";
	setarray .elements, 26, 37, 144, 98, 97, 96, 99;
	bindatcmd "encantar","paytowinbuffs::OnBuffs",0,99;
	end;
}

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  145
  • Topics Per Day:  0.07
  • Content Count:  354
  • Reputation:   8
  • Joined:  04/16/18
  • Last Seen:  

Just now, Hijirikawa said:

Try


-	script	paytowinbuffs	-1,{
	end;

OnBuffs:
	if(getgroupid() <= 4) {
		message strcharinfo(0),"Falha, você não possui VIP.";
		end;
	}
	if(isequipped(4263)) {
		message strcharinfo(0),"Não funciona equipado com Samurai Encarnado.";
		end;
	}
	if(@buffs_inuse == 1) {
		end;
	}

	if (gettimetick(2) < delay_buffer) {
		dispbottom( "You have to wait "+Time2Str(delay_bufer)+" to use the command again.", 0xFF0000 );
		end;
	}

	@buffs_inuse = 1;

	.@menu$ = implode(.buffs$,":");
	.@i = prompt(.@menu$) -1;
	if(.@i < 255) {
		sc_start .elements[.@i],180000,5;
		//atcommand "@refresh "+strcharinfo(0);
		delay_buffer = gettimetick(2) + .delay;
	}

	@buffs_inuse = 0;
	end;

OnInit:
	.delay  = 3 * 2; // 5 = 5 seconds *60 = 360 seconds
	setarray .buffs$, "^800080Envenenar Arma^000000", "^40E0D0Aspersio^000000", "^000000Sombrio^000000", "^FFD700Encantar com Ventania^000000", "^0000FFEncantar com Geada^000000", "^FF0000Encantar com Chama^000000", "^B8860BEncantar com Terremoto^000000";
	setarray .elements, 26, 37, 144, 98, 97, 96, 99;
	bindatcmd "encantar","paytowinbuffs::OnBuffs",0,99;
	end;
}

 


it is still possible to activate the command spamming the command. any idea how to block the command's spam usage? 
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  193
  • Reputation:   41
  • Joined:  07/21/16
  • Last Seen:  

6 minutes ago, IsabelaFernandez said:

it is still possible to activate the command spamming the command. any idea how to block the command's spam usage? 
-	script	paytowinbuffs	-1,{
	end;
OnBuffs:
	if(gettimetick(2) < use_delay){
		message strcharinfo(0),"Nope";
		end;
	}
	if(getgroupid() <= 4) {
		message strcharinfo(0),"Falha, você não possui VIP.";
		end;
	}
	if(isequipped(4263)) {
		message strcharinfo(0),"Não funciona equipado com Samurai Encarnado.";
		end;
	}
	if (gettimetick(2) < delay_buffer) {
		dispbottom( "You have to wait "+Time2Str(delay_bufer)+" to use the command again.", 0xFF0000 );
		end;
	}
	use_delay = gettimetick(2) + .use_delay;
	.@menu$ = implode(.buffs$,":");
	.@i = prompt(.@menu$) -1;
	if(.@i < 255) {
		sc_start .elements[.@i],180000,5;
		//atcommand "@refresh "+strcharinfo(0);
		delay_buffer = gettimetick(2) + .delay;
	}
	end;
OnInit:
	.use_delay = 5; // 5 second use delay
	.delay  = 3 * 2; // 5 = 5 seconds *60 = 360 seconds
	setarray .buffs$, "^800080Envenenar Arma^000000", "^40E0D0Aspersio^000000", "^000000Sombrio^000000", "^FFD700Encantar com Ventania^000000", "^0000FFEncantar com Geada^000000", "^FF0000Encantar com Chama^000000", "^B8860BEncantar com Terremoto^000000";
	setarray .elements, 26, 37, 144, 98, 97, 96, 99;
	bindatcmd "encantar","paytowinbuffs::OnBuffs",0,99;
	end;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  145
  • Topics Per Day:  0.07
  • Content Count:  354
  • Reputation:   8
  • Joined:  04/16/18
  • Last Seen:  

On 12/13/2018 at 5:13 PM, Hijirikawa said:

-	script	paytowinbuffs	-1,{
	end;
OnBuffs:
	if(gettimetick(2) < use_delay){
		message strcharinfo(0),"Nope";
		end;
	}
	if(getgroupid() <= 4) {
		message strcharinfo(0),"Falha, você não possui VIP.";
		end;
	}
	if(isequipped(4263)) {
		message strcharinfo(0),"Não funciona equipado com Samurai Encarnado.";
		end;
	}
	if (gettimetick(2) < delay_buffer) {
		dispbottom( "You have to wait "+Time2Str(delay_bufer)+" to use the command again.", 0xFF0000 );
		end;
	}
	use_delay = gettimetick(2) + .use_delay;
	.@menu$ = implode(.buffs$,":");
	.@i = prompt(.@menu$) -1;
	if(.@i < 255) {
		sc_start .elements[.@i],180000,5;
		//atcommand "@refresh "+strcharinfo(0);
		delay_buffer = gettimetick(2) + .delay;
	}
	end;
OnInit:
	.use_delay = 5; // 5 second use delay
	.delay  = 3 * 2; // 5 = 5 seconds *60 = 360 seconds
	setarray .buffs$, "^800080Envenenar Arma^000000", "^40E0D0Aspersio^000000", "^000000Sombrio^000000", "^FFD700Encantar com Ventania^000000", "^0000FFEncantar com Geada^000000", "^FF0000Encantar com Chama^000000", "^B8860BEncantar com Terremoto^000000";
	setarray .elements, 26, 37, 144, 98, 97, 96, 99;
	bindatcmd "encantar","paytowinbuffs::OnBuffs",0,99;
	end;
}

 

I still can use ... I realized that before when spamming and could charm, sometimes I was in Stone Curse mode ...
 is it possible to add so that they stay in Stone Curse if they can enchant with the restriction of item 4263?

anyone?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  53
  • Topics Per Day:  0.01
  • Content Count:  411
  • Reputation:   260
  • Joined:  04/25/12
  • Last Seen:  

Simple way

 

if(@usingBuff) end;

@usingBuff = 1;

your Buffs  logic Here;

sleep2 2000;

@usingBuff = 0;

end;

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  145
  • Topics Per Day:  0.07
  • Content Count:  354
  • Reputation:   8
  • Joined:  04/16/18
  • Last Seen:  

2 hours ago, Zell said:

Simple way

 

if(@usingBuff) end;

@usingBuff = 1;

your Buffs  logic Here;

sleep2 2000;

@usingBuff = 0;

end;

 

 

Do I add this to the script or create another one? Sorry, I do not have script knowledge. /sob

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  145
  • Topics Per Day:  0.07
  • Content Count:  354
  • Reputation:   8
  • Joined:  04/16/18
  • Last Seen:  

2 hours ago, Zell said:

 

Thanks but the script stopped working with the one you sent

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  53
  • Topics Per Day:  0.01
  • Content Count:  411
  • Reputation:   260
  • Joined:  04/25/12
  • Last Seen:  

Read in console what is wrong. What I put wound't make the script stops to work.

Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...