IsabelaFernandez Posted December 13, 2018 Posted December 13, 2018 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 Quote
0 Royr Posted December 13, 2018 Posted December 13, 2018 (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 December 13, 2018 by Royr Quote
0 IsabelaFernandez Posted December 13, 2018 Author Posted December 13, 2018 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? Quote
0 Normynator Posted December 13, 2018 Posted December 13, 2018 Just a guess: move the delay_buffer assignment above .@size assignment. So the delay is calculated before having to select a buff not after. Quote
0 n0tttt Posted December 13, 2018 Posted December 13, 2018 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; } 1 Quote
0 Normynator Posted December 13, 2018 Posted December 13, 2018 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. 1 Quote
0 IsabelaFernandez Posted December 13, 2018 Author Posted December 13, 2018 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? Quote
0 Hijirikawa Posted December 13, 2018 Posted December 13, 2018 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; } 1 Quote
0 IsabelaFernandez Posted December 13, 2018 Author Posted December 13, 2018 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? Quote
0 Hijirikawa Posted December 13, 2018 Posted December 13, 2018 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; } Quote
0 IsabelaFernandez Posted December 13, 2018 Author Posted December 13, 2018 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? Quote
0 Zell Posted December 14, 2018 Posted December 14, 2018 Simple way if(@usingBuff) end; @usingBuff = 1; your Buffs logic Here; sleep2 2000; @usingBuff = 0; end; Quote
0 IsabelaFernandez Posted December 15, 2018 Author Posted December 15, 2018 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. Quote
0 Zell Posted September 22, 2019 Posted September 22, 2019 zzzz https://pastebin.com/raw/bWADQwh0 Quote
0 IsabelaFernandez Posted September 22, 2019 Author Posted September 22, 2019 2 hours ago, Zell said: zzzz https://pastebin.com/raw/bWADQwh0 Thanks but the script stopped working with the one you sent Quote
0 Zell Posted September 22, 2019 Posted September 22, 2019 Read in console what is wrong. What I put wound't make the script stops to work. Quote
Question
IsabelaFernandez
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
15 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.