-
Posts
303 -
Joined
-
Days Won
12
Content Type
Profiles
Forums
Downloads
Jobs Available
Server Database
Third-Party Services
Top Guides
Store
Crowdfunding
Everything posted by n0tttt
-
I fused your 4 scripts, since this is how the shop should be used. Tell me how it goes. https://pastebin.com/raw/nvfjMCTn
-
- script Duel_Death -1,{ OnCommand: if(.duel) { message strcharinfo(0),"There is a duel going on right now. Wait for it to finish."; } else if(.duel_delay > gettimetick(2)) { message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+"."; } else if(@wait_duelaid) { message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel."; } else { set .@player$,strcharinfo(0); set .@oid,getcharid(3); set .@enemy$,implode(.@atcmd_parameters$," "); set .@aid,getcharid(3,.@enemy$); set .@cid,getcharid(0,.@enemy$); if(!.@aid) { message strcharinfo(0),"That character is not online."; } else if(getvar(@duel,.@cid)) { message strcharinfo(0),"That character is already in a duel."; } else if(.@oid == .@aid) { message strcharinfo(0),"You can't duel yourself."; } else { set @duel_creator,1; set @wait_duelaid,.@aid; set @wait_duelaid,.@cid; message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject."; attachrid .@aid; set @wait_duelaid,.@oid; set @wait_duelcid,getcharid(0,.@player$); message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it."; } } end; OnAccept: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@duel_creator) { message strcharinfo(0),"You are the creater of the duel. Wait for the other player's answer."; } else if(@wait_duelaid) { set .@oid,getcharid(3); set .@cid,getcharid(0); if(isloggedin(@wait_duelaid,@wait_duelcid)) { // Player 2. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(prompt("No.","Yes.") == 2) { message strcharinfo(0),"You accepted the duel. Prepare yourself."; close2; attachrid @wait_duelaid; // Player 1. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(prompt("Não","Sim") == 2) { if(!.duel) { message strcharinfo(0),rid2name(.@oid)+" has accepted the duel."; announce strcharinfo(0)+" e "+rid2name(.@oid)+" gonna make a Death Duel where the loser get's his character deleted!",bc_all|bc_blue; announce "If you want to spectate use @spectatedd",bc_all|bc_blue; set .duel,true; set .cancel,false; removemapflag .duel_map$,mf_pvp; removemapflag .duel_map$,mf_pvp_nocalcrank; set .@first_id,getcharid(3); explode .@xy$,.duel_xy$,","; set .@r,rand(2); set @duel,.@oid; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; attachrid .@oid; set @duel,.@first_id; set .@r,!.@r; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; detachrid; set .@i,30; while(.@i > 0 && !.cancel) { if(!(.@i % 10) || .@i < 6) announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" vs "+rid2name(.@oid)+"!",bc_all|bc_blue; sleep 1000; set .@i,.@i - 1; } if(.@i || .cancel) { announce "The Death Duel has been cancelled!",bc_all|bc_blue; } else { setmapflag .duel_map$,mf_pvp; setmapflag .duel_map$,mf_pvp_nocalcrank; set .@i,0; while(.@i < .time && !.cancel && .duel) { sleep 5000; set .@i,.@i + 5; } if(.@i >= .time) announce "Death Duel time is over. There was no winner.",bc_all|bc_blue; } sleep 1000; if(.logout && .duel) { announce "One of the participants logged out.",bc_all|bc_blue; set .logout,false; } if(.cancel) set .cancel,false; set .duel,false; removemapflag .duel_map$,mf_pvp; removemapflag .duel_map$,mf_pvp_nocalcrank; addrid 5,0,.duel_map$; setoption 0x40,0; if(!@duel) { atcommand "@rmvperm disable_pvp"; } else { set @duel,0; set @duel_creator,0; set @wait_duelaid,0; set @wait_duelcid,0; } set .@i,5; while(.@i) { message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out."; sleep2 1000; set .@i,.@i - 1; } warp "prontera",156,161; pcblockskill getcharid(3),0; end; } else { message strcharinfo(0),"I'm sorry but a duel started a few moments ago."; message strcharinfo(0,.@cid),"I'm sorry but a duel started a few moments ago."; end; } } else { message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled."; } } set .duel,false; set .cancel,false; if(playerattached()) { message strcharinfo(0),"The duel has been cancelled."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),"The duel has been cancelled."; set @duel_creator,0,@wait_duelcid; set @wait_duelaid,0,@wait_duelcid; set @wait_duelcid,0,@wait_duelcid; set @duel,0,@wait_duelcid; } set @duel_creator,0; set @wait_duelaid,0; set @wait_duelcid,0; set @duel,0; close; } } else { message strcharinfo(0),"The character who challenged you is now offline."; set @wait_duelaid,0; set @wait_duelcid,0; } } else { message strcharinfo(0),"There is no death duel invite for you right now."; } close; OnReject: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@duel_creator) { message strcharinfo(0),"You have to wait for your opponent to choose."; } else if(@wait_duelaid) { message strcharinfo(0),"You rejected the duel."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } set .cancel,true; awake "Duel_Death"; } else { message strcharinfo(0),"You haven't been challenged to a duel."; } end; OnSpectate: if(@duel) { message strcharinfo(0),"You're part of the duel."; } else if(.duel) { if(strcharinfo(3) == .duel_map$) { message strcharinfo(0),"You're already in the map."; } else { setoption 0x40,1; atcommand "@addperm disable_pvp"; pcblockskill getcharid(3),1; warp .duel_map$,0,0; } } else { message strcharinfo(0),"There isn't a duel right now."; } end; OnPCKillEvent: if(@duel && killedrid == @duel) { set .duel_delay,gettimetick(2) + 5*60; set .duel,false; set .@oid,getcharid(3); announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue; announce rid2name(@duel)+" was deleted.",bc_all|bc_blue; attachrid @duel; setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown"; set .@deadplayer,getcharid(0); message strcharinfo(0),"Game Over"; atcommand "@kick "+strcharinfo(0); set .@j, getarraysize( .@char_delete$ ); for (.@i = 0; .@i < .@j; .@i++) { query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'"); } query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'"; } end; OnPCLogoutEvent: if(@duel) { set .cancel,true; set .logout,true; awake "Duel_Death"; } end; OnPCLoginEvent: if(checkoption(0x40) && getgmlevel() < 60) setoption 0x40,0; end; OnInit: // Map set .duel_map$,"pvp_n_8-5"; // Coordinates set .duel_xy$, "95,100,"+ // x,y first player "103,100"; // x,y second player bindatcmd "deathduel","Duel_Death::OnCommand"; bindatcmd "acceptdd","Duel_Death::OnAccept"; bindatcmd "rejectdd","Duel_Death::OnReject"; bindatcmd "spectatedd","Duel_Death::OnSpectate"; // Max duration of a duel (seconds). set .time,20; end; } pvp_n_8-5 mapflag pvp pvp_n_8-5 mapflag pvp_nocalcrank pvp_n_8-5 mapflag noreturn pvp_n_8-5 mapflag nowarp pvp_n_8-5 mapflag nocommand 99 pvp_n_8-5 mapflag nowarpto pvp_n_8-5 mapflag nosave SavePoint pvp_n_8-5 mapflag nomemo pvp_n_8-5 mapflag notrade pvp_n_8-5 mapflag nodrop pvp_n_8-5 mapflag nobranch pvp_n_8-5 mapflag nochat pvp_n_8-5 mapflag novending Done. The @reject thing I did intentionally if the one who made the duel changed his mind, but now that you point out, it really makes no sense, because there's already a confirmation when the other player accepts. So that part gets executed.
-
Last one.
-
I understood now. Try changing the MorphoUnequip function to: function script MorphoUnEquip { set .@equipslot,getarg(0); switch(.@equipslot) { case 1: // Top if(!getequipisequiped(EQI_HEAD_TOP)) changelook LOOK_HEAD_TOP,0; break; case 2: //Mid if(!getequipisequiped(EQI_HEAD_MID)) changelook LOOK_HEAD_MID,0; break; case 3: //Lower if(!getequipisequiped(EQI_HEAD_LOW)) changelook LOOK_HEAD_BOTTOM,0; break; } }
-
Do you have your item like this? 60683,Hat,Hat,4,1000,,200,,2,,0,0xFFFFFFFF,63,2,256,,0,1,16,{callfunc "MorphoEquip",1;},{},{callfunc "MorphoUnEquip",1;} This is an example.
-
dispbottom does support color. For example: dispbottom "Example",0xff0000;
-
Change for example this: prontera,164,203,6 script Quest Shop#1 998,{ callfunc "qshop"; } To this: prontera,164,203,6 script Quest Shop#1 998,{ callfunc "qshop"; end; OnInit: getmapflag .m$,.@x,.@y,UNITTYPE_NPC; setmapflag .m$,mf_loadevent; end; OnPCLoadMapEvent: if(strcharinfo(3) == .m$) showevent QTYPE_QUEST; end; }
-
Show the whole script.
-
I'm pretty sure that function is also attack related, since it shows this: if (!skill_id) { // Normal attack checks. // This mode is only needed for melee attacking. if (!status_has_mode(status,MD_CANATTACK)) return false; // Dead state is not checked for skills as some skills can be used // on dead characters, said checks are left to skill.c [Skotlex] if (target && status_isdead(target)) return false; } Prove it and tell how it goes.
-
// ============== Credit ===================== // Scripted by WhiteEagle // =============== For ======================= // Delphin Project // =========================================== - script Levelupbox -1,{ OnPCBaseLvUpEvent: if(eaclass()&EAJL_UPPER) end; set .@item,501; // Level 1 with Item "Red Potion"; set .@item2,501; // Level 2 with Item "Red Potion"; set .@item3,501; // Level 3 with Item "Red Potion"; set .@item4,501; // Level 4 with Item "Red Potion"; set .@item5,501; // Level 5 with Item "Red Potion"; set .@item6,501; // Level 6 with Item "Red Potion"; set .@item7,501; // Level 7 with Item "Red Potion"; set .@item8,501; // Level 8 with Item "Red Potion"; set .@item9,501; // Level 9 with Item "Red Potion"; set .@item10,501; // Level 10 with Item "Red Potion"; set .@item11,501; // Level 11 with Item "Red Potion"; set .@item12,501; // Level 12 with Item "Red Potion"; set .@item13,501; // Level 13 with Item "Red Potion"; set .@item14,501; // Level 14 with Item "Red Potion"; set .@item15,501; // Level 15 with Item "Red Potion"; set .@effect,71; // Specialeffect Spiral White balls set .@effect2,72; // Specialeffect Bigger Spiral White balls set .@effect3,73; // Specialeffect Blue/White Small Aura if(BaseLevel == 10) { specialeffect2 .@effect; specialeffect2 .@effect2; specialeffect2 .@effect3; getitem .@item,1; dispbottom "Congratulation "+strcharinfo(0)+" to level 10!"; end; } if(BaseLevel == 20) { specialeffect2 .@effect; specialeffect2 .@effect2; specialeffect2 .@effect3; getitem .@item2,1; dispbottom "Congratulation "+strcharinfo(0)+" to level 20!"; end; } if(BaseLevel == 30) { specialeffect2 .@effect; specialeffect2 .@effect2; specialeffect2 .@effect3; getitem .@item3,1; dispbottom "Congratulation "+strcharinfo(0)+" to level 30!"; end; } if(BaseLevel == 40) { specialeffect2 .@effect; specialeffect2 .@effect2; specialeffect2 .@effect3; getitem .@item4,1; dispbottom "Congratulation "+strcharinfo(0)+" to level 40!"; end; } if(BaseLevel == 50) { specialeffect2 .@effect; specialeffect2 .@effect2; specialeffect2 .@effect3; getitem .@item5,1; dispbottom "Congratulation "+strcharinfo(0)+" to level 50!"; end; } if(BaseLevel == 60) { specialeffect2 .@effect; specialeffect2 .@effect2; specialeffect2 .@effect3; getitem .@item6,1; dispbottom "Congratulation "+strcharinfo(0)+" to level 60!"; end; } if(BaseLevel == 70) { specialeffect2 .@effect; specialeffect2 .@effect2; specialeffect2 .@effect3; getitem .@item7,1; dispbottom "Congratulation "+strcharinfo(0)+" to level 70!"; end; } if(BaseLevel == 80) { specialeffect2 .@effect; specialeffect2 .@effect2; specialeffect2 .@effect3; getitem .@item8,1; dispbottom "Congratulation "+strcharinfo(0)+" to level 80!"; end; } if(BaseLevel == 90) { specialeffect2 .@effect; specialeffect2 .@effect2; specialeffect2 .@effect3; getitem .@item9,1; dispbottom "Congratulation "+strcharinfo(0)+" to level 90!"; end; } if(BaseLevel == 100) { specialeffect2 .@effect; specialeffect2 .@effect2; specialeffect2 .@effect3; getitem .@item10,1; dispbottom "Congratulation "+strcharinfo(0)+" to level 100!"; end; } if(BaseLevel == 110) { specialeffect2 .@effect; specialeffect2 .@effect2; specialeffect2 .@effect3; getitem .@item11,1; dispbottom "Congratulation "+strcharinfo(0)+" to level 110!"; end; } if(BaseLevel == 120) { specialeffect2 .@effect; specialeffect2 .@effect2; specialeffect2 .@effect3; getitem .@item12,1; dispbottom "Congratulation "+strcharinfo(0)+" to level 120!"; end; } if(BaseLevel == 130) { specialeffect2 .@effect; specialeffect2 .@effect2; specialeffect2 .@effect3; getitem .@item13,1; dispbottom "Congratulation "+strcharinfo(0)+" to level 130!"; end; } if(BaseLevel == 140) { specialeffect2 .@effect; specialeffect2 .@effect2; specialeffect2 .@effect3; getitem .@item14,1; dispbottom "Congratulation "+strcharinfo(0)+" to level 140!"; end; } if(BaseLevel == 150) { specialeffect2 .@effect; specialeffect2 .@effect2; specialeffect2 .@effect3; getitem .@item15,1; dispbottom "Congratulation "+strcharinfo(0)+" to level 150!"; end; } } Like this?
-
Yeah, but now I added some debug announces: - script Duel_Death -1,{ OnCommand: if(.duel) { message strcharinfo(0),"There is a duel going on right now. Wait for it to finish."; } else if(.duel_delay > gettimetick(2)) { message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+"."; } else if(@wait_duelaid) { message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel."; } else { set .@player$,strcharinfo(0); set .@oid,getcharid(3); set .@enemy$,implode(.@atcmd_parameters$," "); set .@aid,getcharid(3,.@enemy$); set .@cid,getcharid(0,.@enemy$); if(!.@aid) { message strcharinfo(0),"That character is not online."; } else if(getvar(@duel,.@cid)) { message strcharinfo(0),"That character is already in a duel."; } else if(.@oid == .@aid) { message strcharinfo(0),"You can't duel yourself."; } else { set @duel_creator,1; set @wait_duelaid,.@aid; set @wait_duelaid,.@cid; message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject."; attachrid .@aid; set @wait_duelaid,.@oid; set @wait_duelcid,getcharid(0,.@player$); message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it."; } } end; OnAccept: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@duel_creator) { message strcharinfo(0),"You are the creater of the duel. Wait for the other player's answer."; } else if(@wait_duelaid) { set .@oid,getcharid(3); set .@cid,getcharid(0); if(isloggedin(@wait_duelaid,@wait_duelcid)) { // Player 2. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(prompt("No.","Yes.") == 2) { message strcharinfo(0),"You accepted the duel. Prepare yourself."; close2; attachrid @wait_duelaid; // Player 1. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(prompt("Não","Sim") == 2) { if(!.duel) { message strcharinfo(0),rid2name(.@oid)+" has accepted the duel."; announce strcharinfo(0)+" e "+rid2name(.@oid)+" gonna make a Death Duel where the loser get's his character deleted!",bc_all|bc_blue; announce "If you want to spectate use @spectatedd",bc_all|bc_blue; set .duel,true; set .cancel,false; removemapflag .duel_map$,mf_pvp; removemapflag .duel_map$,mf_pvp_nocalcrank; set .@first_id,getcharid(3); explode .@xy$,.duel_xy$,","; set .@r,rand(2); set @duel,.@oid; set @wait_duelaid,0; set @wait_duelcid,0; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; attachrid .@oid; set @duel,@wait_duelaid; set @wait_duelaid,0; set @wait_duelcid,0; set .@r,!.@r; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; detachrid; set .@i,30; while(.@i > 0 && !.cancel) { if(!(.@i % 10) || .@i < 6) announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" vs "+rid2name(.@oid)+"!",bc_all|bc_blue; sleep 1000; set .@i,.@i - 1; } if(.@i || .cancel) { announce "The Death Duel has been cancelled!",bc_all|bc_blue; } else { setmapflag .duel_map$,mf_pvp; setmapflag .duel_map$,mf_pvp_nocalcrank; set .@i,0; while(.@i < .time && !.cancel && .duel) { sleep 5000; set .@i,.@i + 5; } if(.@i >= .time) announce "Death Duel time is over. There was no winner.",bc_all|bc_blue; } sleep 1000; if(.logout && .duel) { announce "One of the participants logged out.",bc_all|bc_blue; set .logout,false; } if(.cancel) set .cancel,false; set .duel,false; removemapflag .duel_map$,mf_pvp; removemapflag .duel_map$,mf_pvp_nocalcrank; addrid 5,0,.duel_map$; setoption 0x40,0; if(!@duel) { atcommand "@rmvperm disable_pvp"; } else { set @duel,0; set @duel_creator,0; } set .@i,5; while(.@i) { message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out."; sleep2 1000; set .@i,.@i - 1; } warp "prontera",156,161; pcblockskill getcharid(3),0; end; } else { message strcharinfo(0),"I'm sorry but a duel started a few moments ago."; message strcharinfo(0,.@cid),"I'm sorry but a duel started a few moments ago."; end; } } else { message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled."; } } set .duel,false; set .cancel,false; announce "DEBUG 1: this part should be executed when one of the players choose no.",bc_all; if(playerattached()) { announce "DEBUG 2: this part should be executed when one of the players choose no and there's one attached.",bc_all; message strcharinfo(0),"The duel has been cancelled."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),"The duel has been cancelled."; set @duel_creator,0,@wait_duelcid; set @wait_duelaid,0,@wait_duelcid; set @wait_duelcid,0,@wait_duelcid; } set @duel_creator,0; set @wait_duelaid,0; set @wait_duelcid,0; close; } } else { message strcharinfo(0),"The character who challenged you is now offline."; set @wait_duelaid,0; set @wait_duelcid,0; } } else { message strcharinfo(0),"There is no death duel invite for you right now."; } close; OnReject: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { message strcharinfo(0),"You rejected the duel."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } set .cancel,true; awake "Duel_Death"; } else { message strcharinfo(0),"You haven't been challenged to a duel."; } end; OnSpectate: if(@duel) { message strcharinfo(0),"You're part of the duel."; } else if(.duel) { if(strcharinfo(3) == .duel_map$) { message strcharinfo(0),"You're already in the map."; } else { setoption 0x40,1; atcommand "@addperm disable_pvp"; pcblockskill getcharid(3),1; warp .duel_map$,0,0; } } else { message strcharinfo(0),"There isn't a duel right now."; } end; OnPCKillEvent: if(@duel && killedrid == @duel) { set .duel_delay,gettimetick(2) + 5*60; set .duel,false; set .@oid,getcharid(3); announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue; announce rid2name(@duel)+" was deleted.",bc_all|bc_blue; attachrid @duel; setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown"; set .@deadplayer,getcharid(0); message strcharinfo(0),"Game Over"; atcommand "@kick "+strcharinfo(0); set .@j, getarraysize( .@char_delete$ ); for (.@i = 0; .@i < .@j; .@i++) { query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'"); } query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'"; } end; OnPCLogoutEvent: if(@duel) { set .cancel,true; set .logout,true; awake "Duel_Death"; } end; OnPCLoginEvent: if(checkoption(0x40) && getgmlevel() < 60) setoption 0x40,0; end; OnInit: // Map set .duel_map$,"pvp_n_8-5"; // Coordinates set .duel_xy$, "95,100,"+ // x,y first player "103,100"; // x,y second player bindatcmd "deathduel","Duel_Death::OnCommand"; bindatcmd "acceptdd","Duel_Death::OnAccept"; bindatcmd "rejectdd","Duel_Death::OnReject"; bindatcmd "spectatedd","Duel_Death::OnSpectate"; // Max duration of a duel (seconds). set .time,20; end; } pvp_n_8-5 mapflag pvp pvp_n_8-5 mapflag pvp_nocalcrank pvp_n_8-5 mapflag noreturn pvp_n_8-5 mapflag nowarp pvp_n_8-5 mapflag nocommand 99 pvp_n_8-5 mapflag nowarpto pvp_n_8-5 mapflag nosave SavePoint pvp_n_8-5 mapflag nomemo pvp_n_8-5 mapflag notrade pvp_n_8-5 mapflag nodrop pvp_n_8-5 mapflag nobranch pvp_n_8-5 mapflag nochat pvp_n_8-5 mapflag novending
-
With cancel do you mean choosing No or the "cancel" button in the menu? Anyways I added a detection for when the player chooses "cancel" (prompt instead of select). Also added the creator's thing. Tell me how it goes. - script Duel_Death -1,{ OnCommand: if(.duel) { message strcharinfo(0),"There is a duel going on right now. Wait for it to finish."; } else if(.duel_delay > gettimetick(2)) { message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+"."; } else if(@wait_duelaid) { message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel."; } else { set .@player$,strcharinfo(0); set .@oid,getcharid(3); set .@enemy$,implode(.@atcmd_parameters$," "); set .@aid,getcharid(3,.@enemy$); set .@cid,getcharid(0,.@enemy$); if(!.@aid) { message strcharinfo(0),"That character is not online."; } else if(getvar(@duel,.@cid)) { message strcharinfo(0),"That character is already in a duel."; } else if(.@oid == .@aid) { message strcharinfo(0),"You can't duel yourself."; } else { set @duel_creator,1; set @wait_duelaid,.@aid; set @wait_duelaid,.@cid; message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject."; attachrid .@aid; set @wait_duelaid,.@oid; set @wait_duelcid,getcharid(0,.@player$); message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it."; } } end; OnAccept: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@duel_creator) { message strcharinfo(0),"You are the creater of the duel. Wait for the other player's answer."; } else if(@wait_duelaid) { set .@oid,getcharid(3); set .@cid,getcharid(0); if(isloggedin(@wait_duelaid,@wait_duelcid)) { // Player 2. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(prompt("No.","Yes.") == 2) { message strcharinfo(0),"You accepted the duel. Prepare yourself."; close2; attachrid @wait_duelaid; // Player 1. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(prompt("Não","Sim") == 2) { if(!.duel) { message strcharinfo(0),rid2name(.@oid)+" has accepted the duel."; announce strcharinfo(0)+" e "+rid2name(.@oid)+" gonna make a Death Duel where the loser get's his character deleted!",bc_all|bc_blue; announce "If you want to spectate use @spectatedd",bc_all|bc_blue; set .duel,true; set .cancel,false; removemapflag .duel_map$,mf_pvp; removemapflag .duel_map$,mf_pvp_nocalcrank; set .@first_id,getcharid(3); explode .@xy$,.duel_xy$,","; set .@r,rand(2); set @duel,.@oid; set @wait_duelaid,0; set @wait_duelcid,0; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; attachrid .@oid; set @duel,@wait_duelaid; set @wait_duelaid,0; set @wait_duelcid,0; set .@r,!.@r; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; detachrid; set .@i,30; while(.@i > 0 && !.cancel) { if(!(.@i % 10) || .@i < 6) announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" vs "+rid2name(.@oid)+"!",bc_all|bc_blue; sleep 1000; set .@i,.@i - 1; } if(.@i || .cancel) { announce "The Death Duel has been cancelled!",bc_all|bc_blue; } else { setmapflag .duel_map$,mf_pvp; setmapflag .duel_map$,mf_pvp_nocalcrank; set .@i,0; while(.@i < .time && !.cancel && .duel) { sleep 5000; set .@i,.@i + 5; } if(.@i >= .time) announce "Death Duel time is over. There was no winner.",bc_all|bc_blue; } sleep 1000; if(.logout && .duel) { announce "One of the participants logged out.",bc_all|bc_blue; set .logout,false; } if(.cancel) set .cancel,false; set .duel,false; removemapflag .duel_map$,mf_pvp; removemapflag .duel_map$,mf_pvp_nocalcrank; addrid 5,0,.duel_map$; setoption 0x40,0; if(!@duel) { atcommand "@rmvperm disable_pvp"; } else { set @duel,0; set @duel_creator,0; } set .@i,5; while(.@i) { message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out."; sleep2 1000; set .@i,.@i - 1; } warp "prontera",156,161; pcblockskill getcharid(3),0; end; } else { message strcharinfo(0),"I'm sorry but a duel started a few moments ago."; message strcharinfo(0,.@cid),"I'm sorry but a duel started a few moments ago."; end; } } else { message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled."; } } set .duel,false; set .cancel,false; if(playerattached()) { message strcharinfo(0),"The duel has been cancelled."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),"The duel has been cancelled."; set @duel_creator,0,@wait_duelcid; set @wait_duelaid,0,@wait_duelcid; set @wait_duelcid,0,@wait_duelcid; } set @duel_creator,0; set @wait_duelaid,0; set @wait_duelcid,0; close; } } else { message strcharinfo(0),"The character who challenged you is now offline."; set @wait_duelaid,0; set @wait_duelcid,0; } } else { message strcharinfo(0),"There is no death duel invite for you right now."; } close; OnReject: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { message strcharinfo(0),"You rejected the duel."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } set .cancel,true; awake "Duel_Death"; } else { message strcharinfo(0),"You haven't been challenged to a duel."; } end; OnSpectate: if(@duel) { message strcharinfo(0),"You're part of the duel."; } else if(.duel) { if(strcharinfo(3) == .duel_map$) { message strcharinfo(0),"You're already in the map."; } else { setoption 0x40,1; atcommand "@addperm disable_pvp"; pcblockskill getcharid(3),1; warp .duel_map$,0,0; } } else { message strcharinfo(0),"There isn't a duel right now."; } end; OnPCKillEvent: if(@duel && killedrid == @duel) { set .duel_delay,gettimetick(2) + 5*60; set .duel,false; set .@oid,getcharid(3); announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue; announce rid2name(@duel)+" was deleted.",bc_all|bc_blue; attachrid @duel; setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown"; set .@deadplayer,getcharid(0); message strcharinfo(0),"Game Over"; atcommand "@kick "+strcharinfo(0); set .@j, getarraysize( .@char_delete$ ); for (.@i = 0; .@i < .@j; .@i++) { query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'"); } query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'"; } end; OnPCLogoutEvent: if(@duel) { set .cancel,true; set .logout,true; awake "Duel_Death"; } end; OnPCLoginEvent: if(checkoption(0x40) && getgmlevel() < 60) setoption 0x40,0; end; OnInit: // Map set .duel_map$,"pvp_n_8-5"; // Coordinates set .duel_xy$, "95,100,"+ // x,y first player "103,100"; // x,y second player bindatcmd "deathduel","Duel_Death::OnCommand"; bindatcmd "acceptdd","Duel_Death::OnAccept"; bindatcmd "rejectdd","Duel_Death::OnReject"; bindatcmd "spectatedd","Duel_Death::OnSpectate"; // Max duration of a duel (seconds). set .time,20; end; } pvp_n_8-5 mapflag pvp pvp_n_8-5 mapflag pvp_nocalcrank pvp_n_8-5 mapflag noreturn pvp_n_8-5 mapflag nowarp pvp_n_8-5 mapflag nocommand 99 pvp_n_8-5 mapflag nowarpto pvp_n_8-5 mapflag nosave SavePoint pvp_n_8-5 mapflag nomemo pvp_n_8-5 mapflag notrade pvp_n_8-5 mapflag nodrop pvp_n_8-5 mapflag nobranch pvp_n_8-5 mapflag nochat pvp_n_8-5 mapflag novending
-
Thank you for the screenshots. Literally just a lack of "_". - script Duel_Death -1,{ OnCommand: if(.duel) { message strcharinfo(0),"There is a duel going on right now. Wait for it to finish."; } else if(.duel_delay > gettimetick(2)) { message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+"."; } else if(@wait_duelaid) { message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel."; } else { set .@player$,strcharinfo(0); set .@oid,getcharid(3); set .@enemy$,implode(.@atcmd_parameters$," "); set .@aid,getcharid(3,.@enemy$); set .@cid,getcharid(0,.@enemy$); if(!.@aid) { message strcharinfo(0),"That character is not online."; } else if(getvar(@duel,.@cid)) { message strcharinfo(0),"That character is already in a duel."; } else if(.@oid == .@aid) { message strcharinfo(0),"You can't duel yourself."; } else { set @wait_duelaid,.@aid; set @wait_duelaid,.@cid; message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject."; attachrid .@aid; set @wait_duelaid,.@oid; set @wait_duelcid,getcharid(0,.@player$); message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it."; } } end; OnAccept: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { set .@oid,getcharid(3); set .@cid,getcharid(0); if(isloggedin(@wait_duelaid,@wait_duelcid)) { // Player 2. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("No.","Yes.") == 2) { message strcharinfo(0),"You accepted the duel. Prepare yourself."; close2; attachrid @wait_duelaid; // Player 1. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("Não","Sim") == 2) { if(!.duel) { message strcharinfo(0),rid2name(.@oid)+" has accepted the duel."; announce strcharinfo(0)+" e "+rid2name(.@oid)+" gonna make a Death Duel where the loser get's his character deleted!",bc_all|bc_blue; announce "If you want to spectate use @spectatedd",bc_all|bc_blue; set .duel,true; set .cancel,false; removemapflag .duel_map$,mf_pvp; removemapflag .duel_map$,mf_pvp_nocalcrank; set .@first_id,getcharid(3); explode .@xy$,.duel_xy$,","; set .@r,rand(2); set @duel,.@oid; set @wait_duelaid,0; set @wait_duelcid,0; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; attachrid .@oid; set @duel,@wait_duelaid; set @wait_duelaid,0; set @wait_duelcid,0; set .@r,!.@r; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; detachrid; set .@i,30; while(.@i > 0 && !.cancel) { if(!(.@i % 10) || .@i < 6) announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" vs "+rid2name(.@oid)+"!",bc_all|bc_blue; sleep 1000; set .@i,.@i - 1; } if(.@i || .cancel) { announce "The Death Duel has been cancelled!",bc_all|bc_blue; } else { setmapflag .duel_map$,mf_pvp; setmapflag .duel_map$,mf_pvp_nocalcrank; set .@i,0; while(.@i < .time && !.cancel && .duel) { sleep 5000; set .@i,.@i + 5; } if(.@i >= .time) announce "Death Duel time is over. There was no winner.",bc_all|bc_blue; } sleep 1000; if(.logout && .duel) { announce "One of the participants logged out.",bc_all|bc_blue; set .logout,false; } if(.cancel) set .cancel,false; set .duel,false; removemapflag .duel_map$,mf_pvp; removemapflag .duel_map$,mf_pvp_nocalcrank; addrid 5,0,.duel_map$; setoption 0x40,0; if(!@duel) atcommand "@rmvperm disable_pvp"; else set @duel,0; set .@i,5; while(.@i) { message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out."; sleep2 1000; set .@i,.@i - 1; } warp "prontera",156,161; pcblockskill getcharid(3),0; end; } else { message strcharinfo(0),"I'm sorry but a duel started a few moments ago."; message strcharinfo(0,.@cid),"I'm sorry but a duel started a few moments ago."; } } else { message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled."; } } if(!.duel || .cancel) { set .duel,false; set .cancel,false; if(playerattached()) { message strcharinfo(0),"The duel has been cancelled."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),"The duel has been cancelled."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; close2; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } } end; } } else { message strcharinfo(0),"The character who challenged you is now offline."; set @wait_duelaid,0; set @wait_duelcid,0; } } else { message strcharinfo(0),"You haven't been challenged to a duel."; } close; OnReject: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { message strcharinfo(0),"You rejected the duel."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } set .cancel,true; awake "Duel_Death"; } else { message strcharinfo(0),"You haven't been challenged to a duel."; } end; OnSpectate: if(@duel) { message strcharinfo(0),"You're part of the duel."; } else if(.duel) { if(strcharinfo(3) == .duel_map$) { message strcharinfo(0),"You're already in the map."; } else { setoption 0x40,1; atcommand "@addperm disable_pvp"; pcblockskill getcharid(3),1; warp .duel_map$,0,0; } } else { message strcharinfo(0),"There isn't a duel right now."; } end; OnPCKillEvent: if(@duel && killedrid == @duel) { set .duel_delay,gettimetick(2) + 5*60; set .duel,false; set .@oid,getcharid(3); announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue; announce rid2name(@duel)+" was deleted.",bc_all|bc_blue; attachrid @duel; setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown"; set .@deadplayer,getcharid(0); message strcharinfo(0),"Game Over"; atcommand "@kick "+strcharinfo(0); set .@j, getarraysize( .@char_delete$ ); for (.@i = 0; .@i < .@j; .@i++) { query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'"); } query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'"; } end; OnPCLogoutEvent: if(@duel) { set .cancel,true; set .logout,true; awake "Duel_Death"; } end; OnPCLoginEvent: if(checkoption(0x40) && getgmlevel() < 60) setoption 0x40,0; end; OnInit: // Map set .duel_map$,"pvp_n_8-5"; // Coordinates set .duel_xy$, "95,100,"+ // x,y first player "103,100"; // x,y second player bindatcmd "deathduel","Duel_Death::OnCommand"; bindatcmd "acceptdd","Duel_Death::OnAccept"; bindatcmd "rejectdd","Duel_Death::OnReject"; bindatcmd "spectatedd","Duel_Death::OnSpectate"; // Max duration of a duel (seconds). set .time,20; end; } pvp_n_8-5 mapflag pvp pvp_n_8-5 mapflag pvp_nocalcrank pvp_n_8-5 mapflag noreturn pvp_n_8-5 mapflag nowarp pvp_n_8-5 mapflag nocommand 99 pvp_n_8-5 mapflag nowarpto pvp_n_8-5 mapflag nosave SavePoint pvp_n_8-5 mapflag nomemo pvp_n_8-5 mapflag notrade pvp_n_8-5 mapflag nodrop pvp_n_8-5 mapflag nobranch pvp_n_8-5 mapflag nochat pvp_n_8-5 mapflag novending
-
- script Duel_Death -1,{ OnCommand: if(.duel) { message strcharinfo(0),"There is a duel going on right now. Wait for it to finish."; } else if(.duel_delay > gettimetick(2)) { message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+"."; } else if(@wait_duelaid) { message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel."; } else { set .@player$,strcharinfo(0); set .@oid,getcharid(3); set .@enemy$,implode(.@atcmd_parameters$," "); set .@aid,getcharid(3,.@enemy$); set .@cid,getcharid(0,.@enemy$); if(!.@aid) { message strcharinfo(0),"That character is not online."; } else if(getvar(@duel,.@cid)) { message strcharinfo(0),"That character is already in a duel."; } else if(.@oid == .@aid) { message strcharinfo(0),"You can't duel yourself."; } else { set @wait_duelaid,.@aid; set @wait_duelaid,.@cid; message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject."; attachrid .@aid; set @wait_duelaid,.@oid; set @wait_duelcid,getcharid(0,.@player$); message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it."; } } end; OnAccept: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { set .@oid,getcharid(3); set .@cid,getcharid(0); if(isloggedin(@wait_duelaid,@wait_duelcid)) { // Player 2. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("No.","Yes.") == 2) { message strcharinfo(0),"You accepted the duel. Prepare yourself."; close2; attachrid @wait_duelaid; // Player 1. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("Não","Sim") == 2) { if(!.duel) { message strcharinfo(0),rid2name(.@oid)+" has accepted the duel."; announce strcharinfo(0)+" e "+rid2name(.@oid)+" gonna make a Death Duel where the loser get's his character deleted!",bc_all|bc_blue; announce "If you want to spectate use @spectatedd",bc_all|bc_blue; set .duel,true; set .cancel,false; removemapflag .duel_map$,mf_pvp; removemapflag .duel_map$,mf_pvpnocalcrank; set .@first_id,getcharid(3); explode .@xy$,.duel_xy$,","; set .@r,rand(2); set @duel,.@oid; set @wait_duelaid,0; set @wait_duelcid,0; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; attachrid .@oid; set @duel,@wait_duelaid; set @wait_duelaid,0; set @wait_duelcid,0; set .@r,!.@r; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; detachrid; set .@i,30; while(.@i > 0 && !.cancel) { if(!(.@i % 10) || .@i < 6) announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" vs "+rid2name(.@oid)+"!",bc_all|bc_blue; sleep 1000; set .@i,.@i - 1; } if(.@i || .cancel) { announce "The Death Duel has been cancelled!",bc_all|bc_blue; } else { setmapflag .duel_map$,mf_pvp; setmapflag .duel_map$,mf_pvpnocalcrank; set .@i,0; while(.@i < .time && !.cancel && .duel) { sleep 5000; set .@i,.@i + 5; } if(.@i >= .time) announce "Death Duel time is over. There was no winner.",bc_all|bc_blue; } sleep 1000; if(.logout && .duel) { announce "One of the participants logged out.",bc_all|bc_blue; set .logout,false; } if(.cancel) set .cancel,false; set .duel,false; removemapflag .duel_map$,mf_pvp; removemapflag .duel_map$,mf_pvpnocalcrank; addrid 5,0,.duel_map$; setoption 0x40,0; if(!@duel) atcommand "@rmvperm disable_pvp"; else set @duel,0; set .@i,5; while(.@i) { message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out."; sleep2 1000; set .@i,.@i - 1; } warp "prontera",156,161; pcblockskill getcharid(3),0; end; } else { message strcharinfo(0),"I'm sorry but a duel started a few moments ago."; message strcharinfo(0,.@cid),"I'm sorry but a duel started a few moments ago."; } } else { message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled."; } } if(!.duel || .cancel) { set .duel,false; set .cancel,false; if(playerattached()) { message strcharinfo(0),"The duel has been cancelled."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),"The duel has been cancelled."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; close2; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } } end; } } else { message strcharinfo(0),"The character who challenged you is now offline."; set @wait_duelaid,0; set @wait_duelcid,0; } } else { message strcharinfo(0),"You haven't been challenged to a duel."; } close; OnReject: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { message strcharinfo(0),"You rejected the duel."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } set .cancel,true; awake "Duel_Death"; } else { message strcharinfo(0),"You haven't been challenged to a duel."; } end; OnSpectate: if(@duel) { message strcharinfo(0),"You're part of the duel."; } else if(.duel) { if(strcharinfo(3) == .duel_map$) { message strcharinfo(0),"You're already in the map."; } else { setoption 0x40,1; atcommand "@addperm disable_pvp"; pcblockskill getcharid(3),1; warp .duel_map$,0,0; } } else { message strcharinfo(0),"There isn't a duel right now."; } end; OnPCKillEvent: if(@duel && killedrid == @duel) { set .duel_delay,gettimetick(2) + 5*60; set .duel,false; set .@oid,getcharid(3); announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue; announce rid2name(@duel)+" was deleted.",bc_all|bc_blue; attachrid @duel; setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown"; set .@deadplayer,getcharid(0); message strcharinfo(0),"Game Over"; atcommand "@kick "+strcharinfo(0); set .@j, getarraysize( .@char_delete$ ); for (.@i = 0; .@i < .@j; .@i++) { query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'"); } query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'"; } end; OnPCLogoutEvent: if(@duel) { set .cancel,true; set .logout,true; awake "Duel_Death"; } end; OnPCLoginEvent: if(checkoption(0x40) && getgmlevel() < 60) setoption 0x40,0; end; OnInit: // Map set .duel_map$,"pvp_n_8-5"; // Coordinates set .duel_xy$, "95,100,"+ // x,y first player "103,100"; // x,y second player bindatcmd "deathduel","Duel_Death::OnCommand"; bindatcmd "acceptdd","Duel_Death::OnAccept"; bindatcmd "rejectdd","Duel_Death::OnReject"; bindatcmd "spectatedd","Duel_Death::OnSpectate"; // Max duration of a duel (seconds). set .time,20; end; } pvp_n_8-5 mapflag pvp pvp_n_8-5 mapflag pvp_nocalcrank pvp_n_8-5 mapflag noreturn pvp_n_8-5 mapflag nowarp pvp_n_8-5 mapflag nocommand 99 pvp_n_8-5 mapflag nowarpto pvp_n_8-5 mapflag nosave SavePoint pvp_n_8-5 mapflag nomemo pvp_n_8-5 mapflag notrade pvp_n_8-5 mapflag nodrop pvp_n_8-5 mapflag nobranch pvp_n_8-5 mapflag nochat pvp_n_8-5 mapflag novending
-
Had a stupid typo. Also changed the logout thing, it seems isloggedin needs some time to check the status? Anyways here it is. I also added security to avoid a situation where a player waited with the menu too long and a duel already started. EDIT 2: changed another thing. Damn. - script Duel_Death -1,{ OnCommand: if(.duel) { message strcharinfo(0),"There is a duel going on right now. Wait for it to finish."; } else if(.duel_delay > gettimetick(2)) { message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+"."; } else if(@wait_duelaid) { message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel."; } else { set .@player$,strcharinfo(0); set .@oid,getcharid(3); set .@enemy$,implode(.@atcmd_parameters$," "); set .@aid,getcharid(3,.@enemy$); set .@cid,getcharid(0,.@enemy$); if(!.@aid) { message strcharinfo(0),"That character is not online."; } else if(getvar(@duel,.@cid)) { message strcharinfo(0),"That character is already in a duel."; } else if(.@oid == .@aid) { message strcharinfo(0),"You can't duel yourself."; } else { set @wait_duelaid,.@aid; set @wait_duelaid,.@cid; message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject."; attachrid .@aid; set @wait_duelaid,.@oid; set @wait_duelcid,getcharid(0,.@player$); message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it."; } } end; OnAccept: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { set .@oid,getcharid(3); set .@cid,getcharid(0); if(isloggedin(@wait_duelaid,@wait_duelcid)) { // Player 2. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("No.","Yes.") == 2) { message strcharinfo(0),"You accepted the duel. Prepare yourself."; close2; attachrid @wait_duelaid; // Player 1. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("Não","Sim") == 2) { if(!.duel) { message strcharinfo(0),rid2name(.@oid)+" has accepted the duel."; announce strcharinfo(0)+" e "+rid2name(.@oid)+" gonna make a Death Duel where the loser get's his character deleted!",bc_all|bc_blue; announce "If you want to spectate use @spectatedd",bc_all|bc_blue; set .duel,true; set .cancel,false; removemapflag .duel_map$,mf_pvp; removemapflag .duel_map$,mf_pvpnocalcrank; set .@first_id,getcharid(3); explode .@xy$,.duel_xy$,","; set .@r,rand(2); set @duel,.@oid; set @wait_duelaid,0; set @wait_duelcid,0; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; attachrid .@oid; set @duel,@wait_duelaid; set @wait_duelaid,0; set @wait_duelcid,0; set .@r,!.@r; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; detachrid; set .@i,30; while(.@i > 0 && !.cancel) { if(!(.@i % 10) || .@i < 6) announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" vs "+rid2name(.@oid)+"!",bc_all|bc_blue; sleep 1000; set .@i,.@i - 1; } if(.@i || .cancel) { announce "The Death Duel has been cancelled!",bc_all|bc_blue; if(.logout) { announce "One of the participants logged out.",bc_all|bc_blue; set .logout,0; } } else { setmapflag .duel_map$,mf_pvp; setmapflag .duel_map$,mf_pvpnocalcrank; set .@i,0; while(.@i < .time && !.cancel) { sleep 5000; set .@i,.@i + 5; } if(.@i >= .time) announce "Death Duel time is over. There was no winner.",bc_all|bc_blue; } if(.cancel) set .cancel,false; set .duel,false; removemapflag .duel_map$,mf_pvp; removemapflag .duel_map$,mf_pvpnocalcrank; addrid 5,0,.duel_map$; setoption 0x40,0; if(!@duel) atcommand "@rmvperm disable_pvp"; else set @duel,0; set .@i,5; while(.@i) { message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out."; sleep2 1000; set .@i,.@i - 1; } warp "prontera",156,161; pcblockskill getcharid(3),0; end; } else { message strcharinfo(0),"I'm sorry but a duel started a few moments ago."; message strcharinfo(0,.@cid),"I'm sorry but a duel started a few moments ago."; } } else { message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled."; } } if(!.duel || .cancel) { set .duel,false; set .cancel,false; if(playerattached()) { message strcharinfo(0),"The duel has been cancelled."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),"The duel has been cancelled."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; close2; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } } end; } } else { message strcharinfo(0),"The character who challenged you is now offline."; set @wait_duelaid,0; set @wait_duelcid,0; } } else { message strcharinfo(0),"You haven't been challenged to a duel."; } close; OnReject: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { message strcharinfo(0),"You rejected the duel."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } set .cancel,true; awake "Duel_Death"; } else { message strcharinfo(0),"You haven't been challenged to a duel."; } end; OnSpectate: if(@duel) { message strcharinfo(0),"You're part of the duel."; } else if(.duel) { if(strcharinfo(3) == .duel_map$) { message strcharinfo(0),"You're already in the map."; } else { setoption 0x40,1; atcommand "@addperm disable_pvp"; pcblockskill getcharid(3),1; warp .duel_map$,0,0; } } else { message strcharinfo(0),"There isn't a duel right now."; } end; OnPCKillEvent: if(@duel && killedrid == @duel) { set .duel_delay,gettimetick(2) + 5*60; set .@oid,getcharid(3); announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue; announce rid2name(@duel)+" was deleted.",bc_all|bc_blue; attachrid @duel; setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown"; set .@deadplayer,getcharid(0); message strcharinfo(0),"Game Over"; atcommand "@kick "+strcharinfo(0); set .@j, getarraysize( .@char_delete$ ); for (.@i = 0; .@i < .@j; .@i++) { query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'"); } query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'"; attachrid .@oid; } end; OnPCLogoutEvent: if(@duel) { set .cancel,true; set .logout,1; awake "Duel_Death"; } end; OnPCLoginEvent: if(checkoption(0x40) && getgmlevel() < 60) setoption 0x40,0; end; OnInit: // Map set .duel_map$,"pvp_n_8-5"; // Coordinates set .duel_xy$, "95,100,"+ // x,y first player "103,100"; // x,y second player bindatcmd "deathduel","Duel_Death::OnCommand"; bindatcmd "acceptdd","Duel_Death::OnAccept"; bindatcmd "rejectdd","Duel_Death::OnReject"; bindatcmd "spectatedd","Duel_Death::OnSpectate"; // Max duration of a duel (seconds). set .time,10*120; end; } pvp_n_8-5 mapflag pvp pvp_n_8-5 mapflag pvp_nocalcrank pvp_n_8-5 mapflag noreturn pvp_n_8-5 mapflag nowarp pvp_n_8-5 mapflag nocommand 99 pvp_n_8-5 mapflag nowarpto pvp_n_8-5 mapflag nosave SavePoint pvp_n_8-5 mapflag nomemo pvp_n_8-5 mapflag notrade pvp_n_8-5 mapflag nodrop pvp_n_8-5 mapflag nobranch pvp_n_8-5 mapflag nochat pvp_n_8-5 mapflag novending
-
Done. Anything else, I'm here. - script Duel_Death -1,{ OnCommand: if(.duel) { message strcharinfo(0),"There is a duel going on right now. Wait for it to finish."; } else if(.duel_delay > gettimetick(2)) { message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+"."; } else if(@wait_duelaid) { message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel."; } else { set .@player$,strcharinfo(0); set .@oid,getcharid(3); set .@enemy$,implode(.@atcmd_parameters$," "); set .@aid,getcharid(3,.@enemy$); set .@cid,getcharid(0,.@enemy$); if(!.@aid) { message strcharinfo(0),"That character is not online."; } else if(getvar(@duel,.@cid)) { message strcharinfo(0),"That character is already in a duel."; } else if(.@oid == .@aid) { message strcharinfo(0),"You can't duel yourself."; } else { set @wait_duelaid,.@aid; set @wait_duelaid,.@cid; message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject."; attachrid .@aid; set @wait_duelaid,.@oid; set @wait_duelcid,getcharid(0,.@player$); message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it."; } } end; OnAccept: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { set .@oid,getcharid(3); set .@cid,getcharid(0); if(isloggedin(@wait_duelaid,@wait_duelcid)) { // Player 2. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("No.","Yes.") == 2) { message strcharinfo(0),"You accepted the duel. Prepare yourself."; close2; attachrid @wait_duelaid; // Player 1. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("Não","Sim") == 2) { message strcharinfo(0),rid2name(.@oid)+" has accepted the duel."; announce strcharinfo(0)+" e "+rid2name(.@oid)+" gonna make a Death Duel where the loser get's his character deleted!",bc_all|bc_blue; announce "If you want to spectate use @spectatedd",bc_all|bc_blue; set .duel,true; set .cancel,false; setmapflag .duel_map$,mf_pvp,false; set .@first_id,getcharid(3); explode .@xy$,.duel_xy$,","; set .@r,rand(2); set @duel,.@oid; set @wait_duelaid,0; set @wait_duelcid,0; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; attachrid .@oid; set @duel,@wait_duelaid; set @wait_duelaid,0; set @wait_duelcid,0; set .@r,!.@r; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; detachrid; set .@i,30; while(.@i > 0 && !.cancel) { if(!(.@i % 10) || .@i < 6) announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" vs "+rid2name(.@oid)+"!",bc_all|bc_blue; sleep 1000; set .@i,.@i - 1; } if(.@i || .cancel) { announce "The Death Duel has been cancelled!",bc_all|bc_blue; if(!isloggedin(.@oid) || !isloggedin(.@first_id)) announce "One of the participans logged out.",bc_all|bc_blue; } else { setmapflag .duel_map$,mf_pvp,true; while(.@i < .time && !.cancel) { sleep 5000; set .@i,.@i + 5; } } if(.@i >= .time) announce "Death Duel time is over. There was no winner.",bc_all|bc_blue; if(.cancel) set .cancel,false; set .duel,false; setmapflag .duel_map$,mf_pvp,false; addrid 5,0,.duel_map$; setoption 0x40,0; if(!@duel) atcommand "@rmvperm disable_pvp"; else set @duel,0; set .@i,5; while(.@i) { message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out."; sleep2 1000; set .@i,.@i - 1; } warp "prontera",156,161; pcblockskill getcharid(3),0; end; } else { message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled."; } } if(!.duel || .cancel) { set .duel,false; set .cancel,false; if(playerattached()) { message strcharinfo(0),"The duel has been cancelled."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),"The duel has been cancelled."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; close2; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } } end; } } else { message strcharinfo(0),"The character who challenged you is now offline."; set @wait_duelaid,0; set @wait_duelcid,0; } } else { message strcharinfo(0),"You haven't been challenged to a duel."; } close; OnReject: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { message strcharinfo(0),"You rejected the duel."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } set .cancel,true; awake "Duel_Death"; } else { message strcharinfo(0),"You haven't been challenged to a duel."; } end; OnSpectate: if(@duel) { message strcharinfo(0),"You're part of the duel."; } else if(.duel) { if(strcharinfo(3) == .duel_map$) { message strcharinfo(0),"You're already in the map."; } else { setoption 0x40,1; atcommand "@addperm disable_pvp"; pcblockskill getcharid(3),1; warp .duel_map$,0,0; } } else { message strcharinfo(0),"There isn't a duel right now."; } end; OnPCKillEvent: if(@duel && killedrid == @duel) { set .duel_delay,gettimetick(2) + 5*60; set .@oid,getcharid(3); announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue; announce rid2name(@duel)+" was deleted.",bc_all|bc_blue; attachrid @duel; setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown"; set .@deadplayer,getcharid(0); message strcharinfo(0),"Game Over"; atcommand "@kick "+strcharinfo(0); set .@j, getarraysize( .@char_delete$ ); for (.@i = 0; .@i < .@j; .@i++) { query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'"); } query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'"; attachrid .@oid; } end; OnPCLogoutEvent: if(@duel) { set .cancel,true; awake "Duel_Death"; } end; OnPCLoginEvent: if(checkoption(0x40) && getgmlevel() < 60) setoption 0x40,0; end; OnInit: // Map set .duel_map$,"pvp_n_8-5"; // Coordinates set .duel_xy$, "95,100,"+ // x,y first player "103,100"; // x,y second player bindatcmd "deathduel","Duel_Death::OnCommand"; bindatcmd "acceptdd","Duel_Death::OnAccept"; bindatcmd "rejectdd","Duel_Death::OnReject"; bindatcmd "spectatedd","Duel_Death::OnSpectate"; // Max duration of a duel (seconds). set .time,10*120; end; } pvp_n_8-5 mapflag pvp pvp_n_8-5 mapflag pvp_nocalcrank pvp_n_8-5 mapflag noreturn pvp_n_8-5 mapflag nowarp pvp_n_8-5 mapflag nocommand 99 pvp_n_8-5 mapflag nowarpto pvp_n_8-5 mapflag nosave SavePoint pvp_n_8-5 mapflag nomemo pvp_n_8-5 mapflag notrade pvp_n_8-5 mapflag nodrop pvp_n_8-5 mapflag nobranch pvp_n_8-5 mapflag nochat pvp_n_8-5 mapflag novending
-
Do you mean Hiding and Chase Walk or Hiding or Chase Walk? I imagine Chase Walk being the main one since it's more advanced. Anyways, if you want to use skills with Chase Walk, delete this in status.cpp: if (sc->option&OPTION_CHASEWALK && skill_id != ST_CHASEWALK) return false;
-
This should fix the duel with yourself, and also I got rid of the OnStuck label and now is just part of the OnAccept label. - script Duel_Death -1,{ OnCommand: if(.duel) { message strcharinfo(0),"There is a duel going on right now. Wait for it to finish."; } else if(.duel_delay > gettimetick(2)) { message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+"."; } else if(@wait_duelaid) { message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel."; } else { set .@player$,strcharinfo(0); set .@oid,getcharid(3); set .@enemy$,implode(.@atcmd_parameters$," "); set .@aid,getcharid(3,.@enemy$); set .@cid,getcharid(0,.@enemy$); if(!.@aid) { message strcharinfo(0),"That character is not online."; } else if(getvar(@duel,.@cid)) { message strcharinfo(0),"That character is already in a duel."; } else if(.@oid == .@aid) { message strcharinfo(0),"You can't duel yourself."; } else { set @wait_duelaid,.@aid; set @wait_duelaid,.@cid; message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject."; attachrid .@aid; set @wait_duelaid,.@oid; set @wait_duelcid,getcharid(0,.@player$); message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it."; } } end; OnAccept: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { set .@oid,getcharid(3); set .@cid,getcharid(0); if(isloggedin(@wait_duelaid,@wait_duelcid)) { // Player 2. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("No.","Yes.") == 2) { message strcharinfo(0),"You accepted the duel. Prepare yourself."; close2; attachrid @wait_duelaid; // Player 1. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("Não","Sim") == 2) { message strcharinfo(0),rid2name(.@oid)+" has accepted the duel."; announce strcharinfo(0)+" e "+rid2name(.@oid)+" gonna make a Death Duel where the loser get's his character deleted!",bc_all|bc_blue; announce "If you want to spectate use @spectatedd",bc_all|bc_blue; set .duel,true; set .cancel,false; setmapflag .duel_map$,mf_pvp,false; set .@first_id,getcharid(3); explode .@xy$,.duel_xy$,","; set .@r,rand(2); set @duel,.@oid; set @wait_duelaid,0; set @wait_duelcid,0; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; attachrid .@oid; set @duel,@wait_duelaid; set @wait_duelaid,0; set @wait_duelcid,0; set .@r,!.@r; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; detachrid; set .@i,30; while(.@i > 0 && !.cancel) { if(!(.@i % 10) || .@i < 6) announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" vs "+rid2name(.@oid)+"!",bc_all|bc_blue; sleep 1000; set .@i,.@i - 1; } if(.@i || .cancel) { announce "The Death Duel has been cancelled!",bc_all|bc_blue; if(!isloggedin(.@oid) || !isloggedin(.@first_id)) announce "One of the participans logged out.",bc_all|bc_blue; } else { setmapflag .duel_map$,mf_pvp,true; while(.@i < .time && !.cancel) { sleep 5000; set .@i,.@i + 5; } } if(.cancel) set .cancel,false; set .duel,false; addrid 5,0,.duel_map$; setoption 0x40,0; if(!@duel) atcommand "@rmvperm disable_pvp"; else set @duel,0; set .@i,5; while(.@i) { message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out."; sleep2 1000; set .@i,.@i - 1; } warp "prontera",156,161; pcblockskill getcharid(3),0; end; } else { message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled."; } } if(!.duel || .cancel) { set .duel,false; set .cancel,false; if(playerattached()) { message strcharinfo(0),"The duel has been cancelled."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),"The duel has been cancelled."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; close2; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } } end; } } else { message strcharinfo(0),"The character who challenged you is now offline."; set @wait_duelaid,0; set @wait_duelcid,0; } } else { message strcharinfo(0),"You haven't been challenged to a duel."; } close; OnReject: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { message strcharinfo(0),"You rejected the duel."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } set .cancel,true; awake "Duel_Death"; } else { message strcharinfo(0),"You haven't been challenged to a duel."; } end; OnSpectate: if(@duel) { message strcharinfo(0),"You're part of the duel."; } else if(.duel) { if(strcharinfo(3) == .duel_map$) { message strcharinfo(0),"You're already in the map."; } else { setoption 0x40,1; atcommand "@addperm disable_pvp"; pcblockskill getcharid(3),1; warp .duel_map$,0,0; } } else { message strcharinfo(0),"There isn't a duel right now."; } end; OnPCKillEvent: if(@duel && killedrid == @duel) { set .duel_delay,gettimetick(2) + 5*60; set .@oid,getcharid(3); announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue; announce rid2name(@duel)+" was deleted.",bc_all|bc_blue; attachrid @duel; setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown"; set .@deadplayer,getcharid(0); message strcharinfo(0),"Game Over"; atcommand "@kick "+strcharinfo(0); set .@j, getarraysize( .@char_delete$ ); for (.@i = 0; .@i < .@j; .@i++) { query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'"); } query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'"; attachrid .@oid; } end; OnPCLogoutEvent: if(@duel) { set .cancel,true; awake "Duel_Death"; } end; OnPCLoginEvent: if(checkoption(0x40) && getgmlevel() < 60) setoption 0x40,0; end; OnInit: // Map set .duel_map$,"pvp_n_8-5"; // Coordinates set .duel_xy$, "95,100,"+ // x,y first player "103,100"; // x,y second player bindatcmd "deathduel","Duel_Death::OnCommand"; bindatcmd "acceptdd","Duel_Death::OnAccept"; bindatcmd "rejectdd","Duel_Death::OnReject"; bindatcmd "spectatedd","Duel_Death::OnSpectate"; // Max duration of a duel (seconds). set .time,10*120; end; } pvp_n_8-5 mapflag pvp pvp_n_8-5 mapflag pvp_nocalcrank pvp_n_8-5 mapflag noreturn pvp_n_8-5 mapflag nowarp pvp_n_8-5 mapflag nocommand 99 pvp_n_8-5 mapflag nowarpto pvp_n_8-5 mapflag nosave SavePoint pvp_n_8-5 mapflag nomemo pvp_n_8-5 mapflag notrade pvp_n_8-5 mapflag nodrop pvp_n_8-5 mapflag nobranch pvp_n_8-5 mapflag nochat pvp_n_8-5 mapflag novending
-
Ups. That's funny. - script Duel_Death -1,{ OnCommand: if(.duel) { message strcharinfo(0),"There is a duel going on right now. Wait for it to finish."; } else if(.duel_delay > gettimetick(2)) { message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+"."; } else if(@wait_duelaid) { message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel."; } else { set .@player$,strcharinfo(0); set .@oid,getcharid(3); set .@enemy$,implode(.@atcmd_parameters$," "); set .@aid,getcharid(3,.@enemy$); set .@cid,getcharid(0,.@enemy$); if(!.@aid) { message strcharinfo(0),"That character is not online."; } else if(getvar(@duel,.@cid)) { message strcharinfo(0),"That character is already in a duel."; } else { set @wait_duelaid,.@aid; set @wait_duelaid,.@cid; message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject."; attachrid .@aid; set @wait_duelaid,.@oid; set @wait_duelcid,getcharid(0,.@player$); message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it."; } } end; OnAccept: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { set .@oid,getcharid(3); set .@cid,getcharid(0); if(isloggedin(@wait_duelaid,@wait_duelcid)) { // Player 2. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("No.","Yes.") == 2) { message strcharinfo(0),"You accepted the duel. Prepare yourself."; close2; attachrid @wait_duelaid; // Player 1. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("Não","Sim") == 2) { message strcharinfo(0),rid2name(.@oid)+" has accepted the duel."; announce strcharinfo(0)+" e "+rid2name(.@oid)+" gonna make a Death Duel where the loser get's his character deleted!",bc_all|bc_blue; announce "If you want to spectate use @spectatedd",bc_all|bc_blue; set .duel,true; set .cancel,false; setmapflag .duel_map$,mf_pvp,false; set .@first_id,getcharid(3); explode .@xy$,.duel_xy$,","; set .@r,rand(2); set @duel,.@oid; set @wait_duelaid,0; set @wait_duelcid,0; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; attachrid .@oid; set @duel,@wait_duelaid; set @wait_duelaid,0; set @wait_duelcid,0; set .@r,!.@r; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; detachrid; set .@i,30; while(.@i > 0 && !.cancel) { if(!(.@i % 10) || .@i < 6) announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" vs "+rid2name(.@oid)+"!",bc_all|bc_blue; sleep 1000; set .@i,.@i - 1; } if(.@i || .cancel) { announce "The Death Duel has been cancelled!",bc_all|bc_blue; if(!isloggedin(.@oid) || !isloggedin(.@first_id)) announce "One of the participans logged out.",bc_all|bc_blue; } else { setmapflag .duel_map$,mf_pvp,true; donpcevent "Duel_Death::OnStuck"; } end; } else { message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled."; } } if(!.duel || .cancel) { set .duel,false; set .cancel,false; if(playerattached()) { message strcharinfo(0),"The duel has been cancelled."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),"The duel has been cancelled."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; close2; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } } end; } } else { message strcharinfo(0),"The character who challenged you is now offline."; set @wait_duelaid,0; set @wait_duelcid,0; } } else { message strcharinfo(0),"You haven't been challenged to a duel."; } close; OnReject: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { message strcharinfo(0),"You rejected the duel."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } set .cancel,true; } else { message strcharinfo(0),"You haven't been challenged to a duel."; } end; OnSpectate: if(@duel) { message strcharinfo(0),"You're part of the duel."; } else if(.duel) { if(strcharinfo(3) == .duel_map$) { message strcharinfo(0),"You're already in the map."; } else { setoption 0x40,1; atcommand "@addperm disable_pvp"; pcblockskill getcharid(3),1; warp .duel_map$,0,0; } } else { message strcharinfo(0),"There isn't a duel right now."; } end; OnPCKillEvent: if(@duel && killedrid == @duel) { set .duel_delay,gettimetick(2) + 5*60; set .@oid,getcharid(3); announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue; announce rid2name(@duel)+" was deleted.",bc_all|bc_blue; attachrid @duel; setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown"; set .@deadplayer,getcharid(0); message strcharinfo(0),"Game Over"; atcommand "@kick "+strcharinfo(0); set .@j, getarraysize( .@char_delete$ ); for (.@i = 0; .@i < .@j; .@i++) { query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'"); } query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'"; attachrid .@oid; } end; OnPCLogoutEvent: if(@duel) { set .cancel,true; awake "Duel_Death"; } end; OnPCLoginEvent: if(checkoption(0x40) && getgmlevel() < 60) setoption 0x40,0; end; OnStuck: while(.@i < .time && !.cancel) { sleep 5000; set .@i,.@i + 5; } if(.cancel) set .cancel,false; set .duel,false; addrid 5,0,.duel_map$; setoption 0x40,0; if(!@duel) atcommand "@rmvperm disable_pvp"; else set @duel,0; set .@i,5; while(.@i) { message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out."; sleep2 1000; set .@i,.@i - 1; } warp "prontera",156,161; pcblockskill getcharid(3),0; end; OnInit: // Map set .duel_map$,"pvp_n_8-5"; // Coordinates set .duel_xy$, "95,100,"+ // x,y first player "103,100"; // x,y second player bindatcmd "deathduel","Duel_Death::OnCommand"; bindatcmd "acceptdd","Duel_Death::OnAccept"; bindatcmd "rejectdd","Duel_Death::OnReject"; bindatcmd "spectatedd","Duel_Death::OnSpectate"; // Max duration of a duel (seconds). set .time,10*120; end; } pvp_n_8-5 mapflag pvp pvp_n_8-5 mapflag pvp_nocalcrank pvp_n_8-5 mapflag noreturn pvp_n_8-5 mapflag nowarp pvp_n_8-5 mapflag nocommand 99 pvp_n_8-5 mapflag nowarpto pvp_n_8-5 mapflag nosave SavePoint pvp_n_8-5 mapflag nomemo pvp_n_8-5 mapflag notrade pvp_n_8-5 mapflag nodrop pvp_n_8-5 mapflag nobranch pvp_n_8-5 mapflag nochat pvp_n_8-5 mapflag novending
-
Adapted to rAthena: https://pastebin.com/raw/NS2dU8WX
-
Multiprocessing again. Now only one part of the code deals with the .cancel so it doesn't interfere with the other. - script Duel_Death -1,{ OnCommand: if(.duel) { message strcharinfo(0),"There is a duel going on right now. Wait for it to finish."; } else if(.duel_delay > gettimetick(2)) { message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+"."; } else if(@wait_duelaid) { message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel."; } else { set .@player$,strcharinfo(0); set .@oid,getcharid(3); set .@enemy$,implode(.@atcmd_parameters$," "); set .@aid,getcharid(3,.@enemy$); set .@cid,getcharid(0,.@enemy$); if(!.@aid) { message strcharinfo(0),"That character is not online."; } else if(getvar(@duel,.@cid)) { message strcharinfo(0),"That character is already in a duel."; } else { set @wait_duelaid,.@aid; set @wait_duelaid,.@cid; message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject."; attachrid .@aid; set @wait_duelaid,.@oid; set @wait_duelcid,getcharid(0,.@player$); message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it."; } } end; OnAccept: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { set .@oid,getcharid(3); set .@cid,getcharid(0); if(isloggedin(@wait_duelaid,@wait_duelcid)) { // Player 2. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("No.","Yes.") == 2) { message strcharinfo(0),"You accepted the duel. Prepare yourself."; close2; attachrid @wait_duelaid; // Player 1. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("Não","Sim") == 2) { message strcharinfo(0),rid2name(.@oid)+" has accepted the duel."; announce strcharinfo(0)+" e "+rid2name(.@oid)+" gonna make a Death Duel where the loser get's his character deleted!",bc_all|bc_blue; announce "If you want to spectate use @spectatedd",bc_all|bc_blue; set .duel,true; set .cancel,false; setmapflag .duel_map$,mf_pvp,false; set .@first_id,getcharid(3); explode .@xy$,.duel_xy$,","; set .@r,rand(2); set @duel,.@oid; set @wait_duelaid,0; set @wait_duelcid,0; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; attachrid .@oid; set @duel,@wait_duelaid; set @wait_duelaid,0; set @wait_duelcid,0; set .@r,!.@r; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; detachrid; set .@i,30; while(.@i > 0 && !.cancel) { if(!(.@i % 10) || .@i < 6) announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" vs "+rid2name(.@oid)+"!",bc_all|bc_blue; sleep 1000; set .@i,.@i - 1; } if(.@i || .cancel) { announce "The Death Duel has been cancelled!",bc_all|bc_blue; if(!isloggedin(.@oid) || !isloggedin(.@first_id)) announce "One of the participans logged out.",bc_all|bc_blue; } else { setmapflag .duel_map$,mf_pvp,true; donpcevent "Duel_Death::OnStuck"; } end; } else { message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled."; } } if(!.duel) { message strcharinfo(0),"The duel has been cancelled."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),"The duel has been cancelled."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; close2; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } end; } } else { message strcharinfo(0),"The character who challenged you is now offline."; set @wait_duelaid,0; set @wait_duelcid,0; } } else { message strcharinfo(0),"You haven't been challenged to a duel."; } close; OnReject: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { message strcharinfo(0),"You rejected the duel."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } set .cancel,true; } else { message strcharinfo(0),"You haven't been challenged to a duel."; } end; OnSpectate: if(@duel) { message strcharinfo(0),"You're part of the duel."; } else if(.duel) { if(strcharinfo(3) == .duel_map$) { message strcharinfo(0),"You're already in the map."; } else { setoption 0x40,1; atcommand "@addperm disable_pvp"; pcblockskill getcharid(3),1; warp .duel_map$,0,0; } } else { message strcharinfo(0),"There isn't a duel right now."; } end; OnPCKillEvent: if(@duel && killedrid == @duel) { set .duel_delay,gettimetick(2) + 5*60; set .@oid,getcharid(3); announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue; announce rid2name(@duel)+" was deleted.",bc_all|bc_blue; attachrid @duel; setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown"; set .@deadplayer,getcharid(0); message strcharinfo(0),"Game Over"; atcommand "@kick "+strcharinfo(0); set .@j, getarraysize( .@char_delete$ ); for (.@i = 0; .@i < .@j; .@i++) { query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'"); } query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'"; attachrid .@oid; } end; OnPCLogoutEvent: if(@duel) { set .cancel,true; awake "Death_Duel"; } end; OnPCLoginEvent: if(checkoption(0x40) && getgmlevel() < 60) setoption 0x40,0; end; OnStuck: while(.@i < .time && !.cancel) { sleep 5000; set .@i,.@i + 5; } if(.cancel) set .cancel,false; set .duel,false; addrid 5,0,.duel_map$; setoption 0x40,0; if(!@duel) atcommand "@rmvperm disable_pvp"; else set @duel,0; set .@i,5; while(.@i) { message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out."; sleep2 1000; set .@i,.@i - 1; } warp "prontera",156,161; pcblockskill getcharid(3),0; end; OnInit: // Map set .duel_map$,"pvp_n_8-5"; // Coordinates set .duel_xy$, "95,100,"+ // x,y first player "103,100"; // x,y second player bindatcmd "deathduel","Duel_Death::OnCommand"; bindatcmd "acceptdd","Duel_Death::OnAccept"; bindatcmd "rejectdd","Duel_Death::OnReject"; bindatcmd "spectatedd","Duel_Death::OnSpectate"; // Max duration of a duel (seconds). set .time,10*120; end; } pvp_n_8-5 mapflag pvp pvp_n_8-5 mapflag pvp_nocalcrank pvp_n_8-5 mapflag noreturn pvp_n_8-5 mapflag nowarp pvp_n_8-5 mapflag nocommand 99 pvp_n_8-5 mapflag nowarpto pvp_n_8-5 mapflag nosave SavePoint pvp_n_8-5 mapflag nomemo pvp_n_8-5 mapflag notrade pvp_n_8-5 mapflag nodrop pvp_n_8-5 mapflag nobranch pvp_n_8-5 mapflag nochat pvp_n_8-5 mapflag novending
-
It shouldn't because the variable is a npc one, not a character one. But if you logout it means the variable was set to 0 again because the OnPCLogoutEvent got executed. But there's a 5 second refresh between the loops. Maybe if I refresh it so when a character logs out it's instantly canceled? - script Duel_Death -1,{ OnCommand: if(.duel) { message strcharinfo(0),"There is a duel going on right now. Wait for it to finish."; } else if(.duel_delay > gettimetick(2)) { message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+"."; } else if(@wait_duelaid) { message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel."; } else { set .@player$,strcharinfo(0); set .@oid,getcharid(3); set .@enemy$,implode(.@atcmd_parameters$," "); set .@aid,getcharid(3,.@enemy$); set .@cid,getcharid(0,.@enemy$); if(!.@aid) { message strcharinfo(0),"That character is not online."; } else if(getvar(@duel,.@cid)) { message strcharinfo(0),"That character is already in a duel."; } else { set @wait_duelaid,.@aid; set @wait_duelaid,.@cid; message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject."; attachrid .@aid; set @wait_duelaid,.@oid; set @wait_duelcid,getcharid(0,.@player$); message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it."; } } end; OnAccept: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { set .@oid,getcharid(3); set .@cid,getcharid(0); if(isloggedin(@wait_duelaid,@wait_duelcid)) { // Player 2. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("No.","Yes.") == 2) { message strcharinfo(0),"You accepted the duel. Prepare yourself."; close2; attachrid @wait_duelaid; // Player 1. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("Não","Sim") == 2) { message strcharinfo(0),rid2name(.@oid)+" has accepted the duel."; announce strcharinfo(0)+" e "+rid2name(.@oid)+" gonna make a Death Duel where the loser get's his character deleted!",bc_all|bc_blue; announce "If you want to spectate use @spectatedd",bc_all|bc_blue; set .duel,true; setmapflag .duel_map$,mf_pvp,false; set .@first_id,getcharid(3); explode .@xy$,.duel_xy$,","; set .@r,rand(2); set @duel,.@oid; set @wait_duelaid,0; set @wait_duelcid,0; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; attachrid .@oid; set @duel,@wait_duelaid; set @wait_duelaid,0; set @wait_duelcid,0; set .@r,!.@r; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; detachrid; set .@i,30; while(.@i > 0 && !.cancel) { if(!(.@i % 10) || .@i < 6) announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" vs "+rid2name(.@oid)+"!",bc_all|bc_blue; sleep 1000; set .@i,.@i - 1; } if(.@i || .cancel) { announce "The Death Duel has been cancelled!",bc_all|bc_blue; if(!isloggedin(.@oid) || !isloggedin(.@first_id)) announce "One of the participans logged out.",bc_all|bc_blue; set .cancel,false; } else { setmapflag .duel_map$,mf_pvp,true; donpcevent "Duel_Death::OnStuck"; } end; } else { message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled."; } } if(!.duel) { message strcharinfo(0),"The duel has been cancelled."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),"The duel has been cancelled."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; close2; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } end; } } else { message strcharinfo(0),"The character who challenged you is now offline."; set @wait_duelaid,0; set @wait_duelcid,0; } } else { message strcharinfo(0),"You haven't been challenged to a duel."; } close; OnReject: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { message strcharinfo(0),"You rejected the duel."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } set .cancel,true; } else { message strcharinfo(0),"You haven't been challenged to a duel."; } end; OnSpectate: if(@duel) { message strcharinfo(0),"You're part of the duel."; } else if(.duel) { if(strcharinfo(3) == .duel_map$) { message strcharinfo(0),"You're already in the map."; } else { setoption 0x40,1; atcommand "@addperm disable_pvp"; pcblockskill getcharid(3),1; warp .duel_map$,0,0; } } else { message strcharinfo(0),"There isn't a duel right now."; } end; OnPCKillEvent: if(@duel && killedrid == @duel) { set .duel_delay,gettimetick(2) + 5*60; set .@oid,getcharid(3); announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue; announce rid2name(@duel)+" was deleted.",bc_all|bc_blue; attachrid @duel; setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown"; set .@deadplayer,getcharid(0); message strcharinfo(0),"Game Over"; atcommand "@kick "+strcharinfo(0); set .@j, getarraysize( .@char_delete$ ); for (.@i = 0; .@i < .@j; .@i++) { query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'"); } query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'"; attachrid .@oid; } end; OnPCLogoutEvent: if(@duel) { set .cancel,true; awake "Death_Duel"; } end; OnPCLoginEvent: if(checkoption(0x40) && getgmlevel() < 60) setoption 0x40,0; end; OnStuck: while(.@i < .time && !.cancel) { sleep 5000; set .@i,.@i + 5; } if(.cancel) set .cancel,false; set .duel,false; addrid 5,0,.duel_map$; setoption 0x40,0; if(!@duel) atcommand "@rmvperm disable_pvp"; else set @duel,0; set .@i,5; while(.@i) { message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out."; sleep2 1000; set .@i,.@i - 1; } warp "prontera",156,161; pcblockskill getcharid(3),0; end; OnInit: // Map set .duel_map$,"pvp_n_8-5"; // Coordinates set .duel_xy$, "95,100,"+ // x,y first player "103,100"; // x,y second player bindatcmd "deathduel","Duel_Death::OnCommand"; bindatcmd "acceptdd","Duel_Death::OnAccept"; bindatcmd "rejectdd","Duel_Death::OnReject"; bindatcmd "spectatedd","Duel_Death::OnSpectate"; // Max duration of a duel (seconds). set .time,10*120; end; } pvp_n_8-5 mapflag pvp pvp_n_8-5 mapflag pvp_nocalcrank pvp_n_8-5 mapflag noreturn pvp_n_8-5 mapflag nowarp pvp_n_8-5 mapflag nocommand 99 pvp_n_8-5 mapflag nowarpto pvp_n_8-5 mapflag nosave SavePoint pvp_n_8-5 mapflag nomemo pvp_n_8-5 mapflag notrade pvp_n_8-5 mapflag nodrop pvp_n_8-5 mapflag nobranch pvp_n_8-5 mapflag nochat pvp_n_8-5 mapflag novending
-
I don't know if I understood well what you want... temporary? If so, I changed it all with changelook. https://pastebin.com/raw/kw2dezD5
-
It's not 100% necessary and I don't have a test server to test right now.
-
This is one of the weirdest bugs because the variable .cancel shouldn't be defined and that var only happens if one logouts or rejects. I changed it a little, but tell me how it goes - script Duel_Death -1,{ OnCommand: if(.duel) { message strcharinfo(0),"There is a duel going on right now. Wait for it to finish."; } else if(.duel_delay > gettimetick(2)) { message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+"."; } else if(@wait_duelaid) { message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel."; } else { set .@player$,strcharinfo(0); set .@oid,getcharid(3); set .@enemy$,implode(.@atcmd_parameters$," "); set .@aid,getcharid(3,.@enemy$); set .@cid,getcharid(0,.@enemy$); if(!.@aid) { message strcharinfo(0),"That character is not online."; } else if(getvar(@duel,.@cid)) { message strcharinfo(0),"That character is already in a duel."; } else { set @wait_duelaid,.@aid; set @wait_duelaid,.@cid; message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject."; attachrid .@aid; set @wait_duelaid,.@oid; set @wait_duelcid,getcharid(0,.@player$); message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it."; } } end; OnAccept: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { set .@oid,getcharid(3); set .@cid,getcharid(0); if(isloggedin(@wait_duelaid,@wait_duelcid)) { // Player 2. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("No.","Yes.") == 2) { message strcharinfo(0),"You accepted the duel. Prepare yourself."; close2; attachrid @wait_duelaid; // Player 1. mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("Não","Sim") == 2) { message strcharinfo(0),rid2name(.@oid)+" has accepted the duel."; announce strcharinfo(0)+" e "+rid2name(.@oid)+" gonna make a Death Duel where the loser get's his character deleted!",bc_all|bc_blue; announce "If you want to spectate use @spectatedd",bc_all|bc_blue; set .duel,true; setmapflag .duel_map$,mf_pvp,false; set .@first_id,getcharid(3); explode .@xy$,.duel_xy$,","; set .@r,rand(2); set @duel,.@oid; set @wait_duelaid,0; set @wait_duelcid,0; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; attachrid .@oid; set @duel,@wait_duelaid; set @wait_duelaid,0; set @wait_duelcid,0; set .@r,!.@r; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; detachrid; set .@i,30; while(.@i > 0 && !.cancel) { if(!(.@i % 10) || .@i < 6) announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" vs "+rid2name(.@oid)+"!",bc_all|bc_blue; sleep 1000; set .@i,.@i - 1; } if(.@i || .cancel) { announce "The Death Duel has been cancelled!",bc_all|bc_blue; if(!isloggedin(.@oid) || !isloggedin(.@first_id)) announce "One of the participans logged out.",bc_all|bc_blue; set .cancel,false; } else { setmapflag .duel_map$,mf_pvp,true; donpcevent "Duel_Death::OnStuck"; } end; } else { message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled."; } } if(!.duel) { message strcharinfo(0),"The duel has been cancelled."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),"The duel has been cancelled."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; close2; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } end; } } else { message strcharinfo(0),"The character who challenged you is now offline."; set @wait_duelaid,0; set @wait_duelcid,0; } } else { message strcharinfo(0),"You haven't been challenged to a duel."; } close; OnReject: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { message strcharinfo(0),"You rejected the duel."; if(isloggedin(@wait_duelaid,@wait_duelcid)) { message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel."; set .@id,@wait_duelaid; } set @wait_duelaid,0; set @wait_duelcid,0; if(.@id) { attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; } set .cancel,true; } else { message strcharinfo(0),"You haven't been challenged to a duel."; } end; OnSpectate: if(@duel) { message strcharinfo(0),"You're part of the duel."; } else if(.duel) { if(strcharinfo(3) == .duel_map$) { message strcharinfo(0),"You're already in the map."; } else { setoption 0x40,1; atcommand "@addperm disable_pvp"; pcblockskill getcharid(3),1; warp .duel_map$,0,0; } } else { message strcharinfo(0),"There isn't a duel right now."; } end; OnPCKillEvent: if(@duel && killedrid == @duel) { set .duel_delay,gettimetick(2) + 5*60; set .@oid,getcharid(3); announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue; announce rid2name(@duel)+" was deleted.",bc_all|bc_blue; attachrid @duel; setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown"; set .@deadplayer,getcharid(0); message strcharinfo(0),"Game Over"; atcommand "@kick "+strcharinfo(0); set .@j, getarraysize( .@char_delete$ ); for (.@i = 0; .@i < .@j; .@i++) { query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'"); } query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'"; attachrid .@oid; } end; OnPCLogoutEvent: if(@duel) set .cancel,true; end; OnPCLoginEvent: if(checkoption(0x40) && getgmlevel() < 60) setoption 0x40,0; end; OnStuck: while(.@i < .time && !.cancel) { sleep 5000; set .@i,.@i + 5; } if(.cancel) set .cancel,false; set .duel,false; addrid 5,0,.duel_map$; setoption 0x40,0; if(!@duel) atcommand "@rmvperm disable_pvp"; else set @duel,0; set .@i,5; while(.@i) { message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out."; sleep2 1000; set .@i,.@i - 1; } warp "prontera",156,161; pcblockskill getcharid(3),0; end; OnInit: // Map set .duel_map$,"pvp_n_8-5"; // Coordinates set .duel_xy$, "95,100,"+ // x,y first player "103,100"; // x,y second player bindatcmd "deathduel","Duel_Death::OnCommand"; bindatcmd "acceptdd","Duel_Death::OnAccept"; bindatcmd "rejectdd","Duel_Death::OnReject"; bindatcmd "spectatedd","Duel_Death::OnSpectate"; // Max duration of a duel (seconds). set .time,10*120; end; } pvp_n_8-5 mapflag pvp pvp_n_8-5 mapflag pvp_nocalcrank pvp_n_8-5 mapflag noreturn pvp_n_8-5 mapflag nowarp pvp_n_8-5 mapflag nocommand 99 pvp_n_8-5 mapflag nowarpto pvp_n_8-5 mapflag nosave SavePoint pvp_n_8-5 mapflag nomemo pvp_n_8-5 mapflag notrade pvp_n_8-5 mapflag nodrop pvp_n_8-5 mapflag nobranch pvp_n_8-5 mapflag nochat pvp_n_8-5 mapflag novending