Jump to content

LucianoCP

Members
  • Posts

    50
  • Joined

  • Last visited

Everything posted by LucianoCP

  1. I meant selecting "no". Did you checked it?
  2. Found another issues: - When i create a duel and type @acceptdd on the same char, it says "The character who challenged you is offline". Can you change it to "You are the creater of the duel. Wait for the other player's answer." - After i accept the duel, in the dialogue menu, another dialogue is created to the one who invited, right? So, if i cancel in this one, the other player still can @acceptdd. Look: the player receives the "the character who challenged you has changed his mind. The duel is cancelled" and still can use @accept and it opens the dialogue menu. I think is should appears a "there is no death duel invite for you right now" message. Everything else is working.
  3. This happens when i leave before the duel starts: (in game, "the death duel has been cancelled" and "one of the participants logged out". No warp back countdown and no warp back) This happens when the countdown for the duel begins (x seconds for the duel between a vs b) ends:
  4. If i leave before the duel starts, the announcement is made but there is no warp back countdown, so there is no warp back. If i leave after the duel starts, there is no announcement, no warp back countdown and no warp back. And after relogg both chars, can't use @death duel because "there is a duel going on right now..." I think max duration of a duel isn't working anymore... it is set to 20 seconds, after that, nothing happened.
  5. Sorry for testing your patience, man ? But the pvp still on when the warp back starts after the death duel time ends. Also, when a dueler logs out, the death duel is cancelled and the warp back countdown starts. If i leave when the hasn't started yet, it says the duel got cancelled and says the time of death duel has ended. If the duel has started, nothing is announced and the warp back countdown starts.
  6. Now it's working! But... I made a test with the time limit now and i have a question: After the time ends, the 5 sec warp back countdown starts. The issue is that pvp keeps on. Can you set the pvp to off when the warp back countdown starts? Another thing, when the time ends, can you set an announcement like "Death Duel time is over. There was no winner."?
  7. mapserv.bat error doesn't show up anymore, but after one of the players loggs out, an announcement "the death duel has been canceled" shows up. I remember that a previous code announced something about one of the players logging out. Also, the remaining player still keeps in the map. Another thing, i had confused the clients and realized that is possible to create a @deathduel with your own character. Can you please fix it too?
  8. Same thing, bro. But, i think the mistake is on the NPC Name. Look: first line of your code: script Duel_Death Sorry for bottering, i'm just trying to not change anything and mess up de code =x
  9. logged out with one of the participants to test it and realized something new: nothing happens except an announcement. The other player and the spectators keeps there and it's impossible to start a new death duel (i tried to relogg the player who was left there), because "there is a duel going on right now.", so... maybe you should take a look at this part of the code.
  10. The "this is one of the weirdest bugs" message made me think "what if i create new chars to test it?" so... i created, and it worked. But, i think this tells us that the variable keeps it's value when char reloggs. Am i right?
  11. Still doesn't work. The players get recalled and this happens:
  12. Hi, dude. You've fixed the dialogue issues, including the mapserv.bat error. But now, the death duel isn't starting. The players get recalled to the map, but the countdown doesn't start. ?
  13. it looks to be working 100% fine, except for this: the "buildin_strcharinfo" error, on mapserv.bat happens when i refuse the DD with the player who creates it. And the message that i asked to appears to the player who got invited, doesn't appears.
  14. what do you think of setting a message like "the challenger changed his mind. The Death Duel is cancelled." to the one who accepts the duel, after the creator of the duel sends "no" to the confirmation? mapserv.bat send me this: but i can't tell you when this happened. Everything else appears to be working 100%. I'll run more tests later, ok? Need to leave right now. Be back in a few hours. Thank you very much!!!
  15. menu still bugged when invited player refuses the deathduel ? mapserv.bat sends me this (several times) when players are warpped to deathduel: and this for last: and players still in the map when deathduel ends. Countdown doesn't starts too.
  16. I'm testing this last code. When i choose "No" on confirmation, dialogue bugs: and i can't make a new death duel unless i relogg. After all, when i started the duel i got this: players got warpped to the map, but the countdown doesn't starts, so the duel doesn't too.
  17. Mate, the second question was a mistake of mine. Here is the code i'm using: - 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$); dispbottom .@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); if(isloggedin(@wait_duelaid,@wait_duelcid)) { mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("No.","Yes.") == 2) { close2; message strcharinfo(0),"You accepted the duel. Prepare yourself."; attachrid @wait_duelaid; mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("Não","Sim") == 2) { set .@second_id,@wait_duelaid; 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,1; //close2; 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) { announce "The Death Duel has been cancelled!",bc_all|bc_blue; set .cancel,0; } else { setmapflag .duel_map$,mf_pvp,true; donpcevent "Duel_Death::OnStuck"; } } } if(!@duel) { message strcharinfo(0),"The duel has been cancelled."; message strcharinfo(0,@wait_duelcid),"The duel has been cancelled."; set .@id,@wait_duelaid; set @wait_duelaid,0; set @wait_duelcid,0; attachrid .@id; 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),"You haven't been challenged to a duel."; } end; OnReject: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { message strcharinfo(0),"You rejected the duel."; message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel."; set .@id,@wait_duelaid; set @wait_duelaid,0; set @wait_duelcid,0; attachrid .@id; set @wait_duelaid,0; set @wait_duelcid,0; set .cancel,1; awake "Death_Duel"; } 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; awake "Death_Duel"; } end; OnPCLogoutEvent: if(@duel) awake "Death_Duel"; end; OnPCLoginEvent: if(checkoption(0x40) && getgmlevel() < 60) setoption 0x40,0; end; OnStuck: announce "donpcevent OnStuck succesful label.",bc_all; sleep .time*1000; if(.duel) { set .duel,0; addrid 5,.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 "SavePoint",0,0; 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 By now, the only error i found is about the players keeping in the map after the duel ends. Also, i get a "donpcevent OnStuck succesful label" announcement. Is that right?
  18. Please, don't be sorry for making me test it. I'm really enjoying it! As in fact, i'm the one who needs to be sorry hahaha Thanks for helping me with it. I was making some tests here before i noticed your reply and found this: got a deletion problem here: setarray has ".@char_delete$[0]" query_sql has ".char_detele$[.@i]" should i delete the @ on setarray or add it to querysql? Another thing, depending on who wins the duel, the loser doesn't get his char deleted. But i can't tell you for sure if it is who accept or who creates the duel because it's past 3:00 am here =x About the @hide "bug", is it possible that group_id of all accounts i'm using are 99 are messing this up? Now i'm going to test those codes you sent and then going to sleep (; @edit When the countdown ends, mapserv.bat get's me this: when the death duel is over, players (winner and the spectators) still on the map... i think would be nice if they had another countdown, for 5 seconds, telling they will be sent to their savepoints.
  19. here are some issues i have found: when a player refuses your invite, you can't make another one unless you relogg. when selected "no", on the confirmation if player really wants to bet his character, the dialogue bugs. there is no "close" buttom. Altough, the duel is cancelled. When you select "yes" on the confirmation, another ask is made to you, on the same window. i guess it should be to the player who typed the @deathduel <player> at first, right? You can use @rejectdd while countdown is goingon. The countdown keeps rolling. You can use @spectatedd while you should duel. After i relloged this char, he kept with @hide on. Well, with this bug above, i've relogged and i think the @deathduel didn't turn off. So, i guess if a player quit in the middle of the duel, the delay won't be activated and nobody will be able to deathduel after it ? player who starts the @deathduel doesn't get warped. the countdown starts and only when it ends the players get there. I think they should get there at the begining, like spectators do. The pvp between them could be activated when the countdown ends. i THINK the the max duration for a duel isn't working. Don't know if i configured it right (set .time,10*120; = 120 seconds?) If it is right, it isn't working. Only the invited player got sended to the map. He didn't get warped back to his savepoint +10 minutes after the duel "began". The countdown announcement repeats the X* player name like "There'll be a Death Duel between X* and X*", where X* = the player who accepted the duel. i recalled the player who didn't get warpped to the duel map, and when i killed him, the winner wasn't warpped to his save point and "user 'player' doesn't possess the 'disable_pvp' permission. Is that because i choose pvp_n_1-5 map? I think it already has pvpon, don't know. Didn't tested, but i think spectators doesn't get warpped to their savepoints too when duel ends.
  20. Wow, i was thinking something about a @duel, where players duel anywhere, but this idea of teleporting the rivals to a map and send spectators there is AMAZING! Really, this shit will be crazy! Just one thing i didn't notice, i guess... What do you think about giving 30~60 seconds of waiting to spectators enter it, and the players who will duel prepare themselves? A countdown on the map, advertising "30 seconds left to duel begins, get ready", then "5... 4... 3... 2... 1... GO!". I'm going to test the code as it is right now, but i had to make this question as sooner as possible hahaha @EDIT Dude, tested it and there was some typing erros, missing ";" letters changed, etc... Here is the code 100% functional, only missing those changes i've asked ? - script Duel_Death -1,{ end; 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 { 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 { 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$); dispbottom .@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); if(isloggedin(@wait_duelaid,@wait_duelcid)) { 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."; attachrid @duel; mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000"; if(select("No.","Yes") == 2) { message strcharinfo(0),rid2name(.@oid)+" has accepted the duel."; announce "There'll be a Death Duel between "+strcharinfo(0)+" and "+rid2name(.@oid)+"!",bc_all|bc_blue; announce "If you want to spectate use @spectatedd",bc_all|bc_blue; set .duel,1; close2; sleep2 20000; explode .@xy$,.duel_xy$,","; set .@r,rand(2); set @duel,.@oid; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); 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]); donpcevent "Duel_Death::OnStuck"; } } if(!@duel) { message strcharinfo(0),"The duel has been cancelled."; message strcharinfo(0,@wait_duelcid),"The duel has been cancelled."; set @wait_duelaid,0; set @wait_duelcid,0; } } 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."; } end; OnReject: if(@duel) { message strcharinfo(0),"You're already in a duel."; } else if(@wait_duelaid) { message strcharinfo(0),"You rejected the duel."; message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel."; set @wait_duelaid,0; set @wait_duelcid,0; } else { message strcharinfo(0),"You haven't been challenged to a duel."; } end; OnSpectate: if(.duel) { if(strcharinfo(3) == .duel_map$) { message strcharinfo(0),"You're already in the map."; } else { atcommand "@hide"; 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,0; 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; 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); 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; awake "Death_Duel"; addrid 5,.duel_map$; if(!@duel) atcommand "@hide"; set @duel,0; atcommand "@rmvperm disable_pvp"; pcblockskill getcharid(3),0; } end; OnPCLogoutEvent: if(@duel) { set .duel,0; attachrid @duel; set @duel,0; } end; OnStuck: sleep .time*1000; if(.duel) set .duel,0; end; OnInit: // Map set .duel_map$,"map"; //put the map name where you want to Death Duel happens. // Coordinates set .duel_xy$, "x,y,"+ // x,y first player "x,y"; // 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*60; end; } //change the "map"s below to the same mape you've put on OnInit. map mapflag pvp map mapflag pvp_nocalcrank map mapflag noreturn map mapflag nowarp map mapflag nocommand 99 map mapflag nowarpto map mapflag nosave SavePoint map malflag nomemo map mapflag notrade map mapflag nodrop map mapflag nobranch map mapflag nochat map mapflag novending
  21. Of course not ? Hi, mate. I finally tested it. I've found some minor bugs (missing ; for example), but i was able to correct it. However, your code is missing some functional things. I tried to add them by myself since last light, but my knowledge at coding (and english too hahaha) are really bad ? So, if you could do these adjustments bellow, i would be very pleased. - Need to test if the target @duel_death is already on a duel_death. - Need to create a @reject option and let the player who started the @duel_death knows it. - Need to create a delay to @duel_death about 2~5 minutes. (let's don't make a massive deletion, right? hahaha) - Need to disable @accept/@reject option when players are in a duel, and make a dispbottom like "You need to relogg to cancel the duel_death" - Need to create a dispbottom to @accept/reject when they have no invites to @duel_death. Something like "You don't have any duel_death invite right now." - Need to create a "mes" (like NPC dialogue) checking if the players are REALLY SURE with betting their characters. (important for users to know that this isn't @duel command) - Need to create a "pvpon" between the players, similar to @duel command in case they are in a pvpoff map. - Need to create an announcement of who are dueling, and later, who won and who lost his character. - Need to set off the @duel on the winner player, turning him able to @duel_death again. You see, some of the items are just to make the @duel_death exactly like @duel command, except for the loser character deletion. Reinforcing, this needs to be as functional as @duel command, plus the deletion of loser character, some "are you really sure of it?" questions and announcements. I guess everybody would like to know if a duel of this kind is happening on the server, and of course, who is the loser hahaha So, in case i forgot something, just try make @duel_death a copy of @duel command.
  22. Hi, mate. Thanks for the script. I'll be able to test it in a few hours. The original script is more about "if you die, you'll lose your character". I want it to be part of an especific duel command. Players will be able to duel normally, and who wins is the best, but they also will be able to bet their characters, turning the duel something a bit more serious hahahaha
  23. Hey, guys... I saw this script below, from @Nova, and wondered if was possible to turn it into a command, similar to @duel, where players will bet their characters. //===== rAthena Script ======================================= //= Character Deletion on Death Script //===== By: ================================================== //= Nova http://www.novaragnarok.com //============================================================ - script PERMANENTDEATH -1,{ end; OnPCDieEvent: 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; OnInit: 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"; end; } Thanks. @edit: Here's the final code by @n0tttt: - 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("No","Yes") == 2) { if(isloggedin(.@oid,.@cid)) { 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; setmapflag .duel_map$,mf_restricted,9; 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; pcblockmove .@first_id,1; message strcharinfo(0),"You will not be able to move until the duel starts."; attachrid .@oid; set @duel,.@first_id; set .@r,!.@r; warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]); setoption 0x40,0; pcblockmove .@oid,1; message strcharinfo(0),"You will not be able to move until the duel starts."; 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; } pcblockmove .@first_id,0; pcblockmove .@oid,0; removemapflag .duel_map$,mf_restricted,9; if(.@i || .cancel) { announce "The Death Duel has been cancelled!",bc_all|bc_blue; } else { announce "The Death Duel has just started!",bc_all|bc_blue; 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),"The other player disconnected."; } } else { message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled."; } } else { message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel."; } 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."; } end; 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; OnFixDuel: set .duel,false; set .cancel,false; set .logout,false; set .duel_delay,false; message strcharinfo(0),"Every variable has been cleared successfully."; addrid 0; set @duel,0; set @wait_duelaid,0; set @wait_duelcid,0; set @duel_creator,0; 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(@wait_duelaid) { message strcharinfo(0,@wait_duelcid),"The other player disconnected."; set @wait_duelaid,0,@wait_duelcid; set @creator_duel,0,@wait_duelcid; set @wait_duelcid,0,@wait_duelcid; } 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$,"map"; //insert the map name // Coordinates set .duel_xy$, "x,y,"+ // x,y first player "x,y"; // x,y second player bindatcmd "deathduel","Duel_Death::OnCommand"; bindatcmd "acceptdd","Duel_Death::OnAccept"; bindatcmd "rejectdd","Duel_Death::OnReject"; bindatcmd "spectatedd","Duel_Death::OnSpectate"; bindatcmd "fixduel","Duel_Death::OnFix",60; // Max duration of a duel (seconds). set .time,20; end; } // change "map" to the same map you've insert above map mapflag pvp map mapflag pvp_nocalcrank map mapflag noreturn map mapflag nowarp map mapflag nocommand 99 map mapflag nowarpto map mapflag nosave SavePoint map mapflag nomemo map mapflag notrade map mapflag nodrop map mapflag nobranch map mapflag nochat map mapflag novending map mapflag restricted 9 To forbid the use of some skills during the countdown (i asked for movement ones), you should add this to your db/import/skill_nocast_db.txt: //---------------------------------------------------------------------------- // Zone 9 - Death Duel //---------------------------------------------------------------------------- 150,8192 //TF_BACKSLIDING 426,8192 //TK_HIGHJUMP if it doesn't work, maybe you need to do this:
×
×
  • Create New...