Jump to content

Question

15 answers to this question

Recommended Posts

  • 0
Posted (edited)
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
  • 0
Posted
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?

  • 0
Posted

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
  • 0
Posted

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
  • 0
Posted
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?

  • 0
Posted

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
  • 0
Posted
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? 
  • 0
Posted
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;
}

 

  • 0
Posted
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?

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...