Advertisement
Guest User

Untitled

a guest
Aug 29th, 2011
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.74 KB | None | 0 0
  1. // Author: alastrim
  2.  
  3. 017-2.gat,26,27,0|script|PVP Master|126,{
  4.     if ($@pvp_Status == 1)
  5.         goto L_Existent_Challenge;
  6.     if ($@pvp_Status == 2)
  7.         goto L_During_Countdown;
  8.     if ($@pvp_Status == 3)
  9.         goto L_Existent_Fight;
  10.  
  11.     mes "[PVP master]";
  12.     mes "\"Do you want to enter the ring?\"";
  13.     next;
  14.     menu
  15.         "Yes", -,
  16.         "No", L_Close;
  17.     mes "\"You need to give me an amount in gold pieces first. Whoever decides to fight you have to deposit the same value. In the end, the one who wins will get all the money.\"";
  18.     next;
  19.  
  20. L_GetGP:
  21.     input @gp;
  22.     if (@gp <= 0)
  23.         goto L_GetGP;
  24.     if (Zeny < @gp)
  25.         goto L_No_Money;
  26.  
  27.     mes "[PVP master]";
  28.     mes "\"Good! You have set up a PVP challenge with the minimum requirement of " + @gp + " GP.\"";
  29.     warp "017-2.gat", 26, 23;
  30.     set $@pvp_Status, 1;
  31.     set $@pvp_Price, @gp;
  32.     set $@pvp_StarterID, getcharid(3);
  33.     set $@pvp_StarterName$, strcharinfo(0);
  34.     goto L_Close;
  35.  
  36. L_During_Countdown:
  37.     end;
  38.  
  39. L_Existent_Fight:
  40.     // TODO: Create a label that offers the players the option to give up.
  41.     if (getcharid(3) == $@pvp_StarterID || getcharid(3) == $@pvp_ChallengerID)
  42.         goto L_Giveup_Offer;
  43.     mes "[PVP master]";
  44.     mes "\"Enjoy the fight.\"";
  45.     close;
  46.  
  47. L_Giveup_Offer:
  48.     mes "[PVP master]";
  49.     mes "\"Do you want to give up?\"";
  50.     menu
  51.         "Yes", -,
  52.         "No", L_Close;
  53.     if (getcharid(3) == $@pvp_StarterID)
  54.         set $@pvp_Winner, $@pvp_ChallengerID;
  55.     if (getcharid(3) == $@pvp_ChallengerID)
  56.         set $@pvp_Winner, $@pvp_StarterID;
  57.     close;
  58.  
  59. L_Cancel_Challenge:
  60.     mes "[PVP master]";
  61.     mes "\"Do you want to cancel your challenge?\"";
  62.     menu
  63.         "Yes", -,
  64.         "No", L_Close;
  65.     close2;
  66.     set Zeny, Zeny + $@pvp_Price;
  67.     goto L_Clear_Vars;
  68.  
  69. L_Existent_Challenge:
  70.     if ($@pvp_StarterID == getcharid(3))
  71.         goto L_Cancel_Challenge;
  72.  
  73.     mes "[PVP master]";
  74.     mes "\"Hello. " + $@pvp_StarterName$ + " started a PVP challenge worth " + $@pvp_Price + " Gold Pieces. Do you want to accept?\"";
  75.     next;
  76.     menu
  77.         "Yes.", -,
  78.         "No.", L_Close;
  79.     if (Zeny < $@pvp_Price)
  80.         goto L_No_Money;
  81.     set Zeny, Zeny - $@pvp_Price;
  82.     warp "017-2.gat", 26, 23;
  83.     set $@pvp_Status, 2;
  84.     set $@pvp_ChallengerID, getcharid(3);
  85.     set $@pvp_ChallengerName$, strcharinfo(0);
  86.     set $@pvp_Time, 11;
  87.     initnpctimer;
  88.     goto L_Close;
  89.  
  90. L_No_Money:
  91.     mes "[PVP master]";
  92.     mes "\"Sorry, but you don't have enough money.\"";
  93.     close;
  94.  
  95. OnTimer1000:
  96.     if ($@pvp_Status == 2) goto L_Count_Down;
  97.     if ($@pvp_Status == 3) goto L_Handle_Fight;
  98.     goto L_Continue_Timer;
  99.  
  100. L_Count_Down:
  101.     set $@pvp_Time, $@pvp_Time - 1;
  102.  
  103.     if ($@pvp_Time == 10)
  104.         npctalk $@pvp_StarterName$ + " Vs " + $@pvp_ChallengerName$ + "!";
  105.     if ($@pvp_Time == 5)
  106.         npctalk "Attention! The fight is starting in...";
  107.     if ($@pvp_Time < 5 && $@pvp_Time > 0)
  108.         npctalk $@pvp_Time;
  109.     if ($@pvp_Time == 0)
  110.         npctalk "Now!";
  111.     if ($@pvp_Time == 0)
  112.         goto L_Start_Fight;
  113.  
  114. L_Continue_Timer:
  115.     setnpctimer 0;
  116.     end;
  117.  
  118. L_Start_Fight:
  119.     if (!(isloggedin($@pvp_StarterID)))
  120.         goto L_Starter_Gaveup;
  121.     if (!(isloggedin($@pvp_ChallengerID)))
  122.         goto L_Challenger_Gaveup;
  123.  
  124.     attachrid($@pvp_StarterID);
  125.     if (!(isin("017-2.gat", 22, 20, 31, 26)))
  126.         goto L_Starter_Gaveup;
  127.     attachrid($@pvp_ChallengerID);
  128.     if (!(isin("017-2.gat", 22, 20, 31, 26)))
  129.         goto L_Challenger_Gaveup;
  130.  
  131.     attachrid($@pvp_StarterID);
  132.     gmcommand "@charkillable " + strcharinfo(0);
  133.     set @killable, 1;
  134.     attachrid($@pvp_ChallengerID);
  135.     gmcommand "@charkillable " + strcharinfo(0);
  136.     set @killable, 1;
  137.  
  138.     set $@pvp_Status, 3;
  139.     goto L_Continue_Timer;
  140.  
  141. L_Handle_Fight:
  142.     if ($@pvp_Winner != 0)
  143.         goto L_End_Fight;
  144.  
  145.     if (isloggedin($@pvp_StarterID) == 0)
  146.         set $@pvp_Winner, $@pvp_ChallengerID;
  147.     if (isloggedin($@pvp_ChallengerID) == 0)
  148.         set $@pvp_Winner, $@pvp_StarterID;
  149.  
  150.     attachrid($@pvp_StarterID);
  151.     if (!(isin("017-2.gat", 22, 20, 31, 26)))
  152.         set $@pvp_Winner, $@pvp_ChallengerID;
  153.      if (@killable && !(isin("017-2.gat", 22, 20, 31, 26)))
  154.         gmcommand "@charkillable " + strcharinfo(0);
  155.     attachrid($@pvp_ChallengerID);
  156.     if (!(isin("017-2.gat", 22, 20, 31, 26)))
  157.         set $@pvp_Winner, $@pvp_StarterID;
  158.     if (@killable && !(isin("017-2.gat", 22, 20, 31, 26)))
  159.         gmcommand "@charkillable " + strcharinfo(0);
  160.  
  161.     goto L_Continue_Timer;
  162.  
  163. OnPCKilledEvent:
  164.     if ($@pvp_Status != 3)
  165.         end;
  166.     npctalk @killerrid;
  167.     attachrid(@killerrid);
  168.     set $@pvp_Winner, getcharid(3);
  169.     end;
  170.  
  171. L_Starter_Gaveup:
  172.     npctalk "Sorry, but the player who started the challenge gave up from the fight";
  173.     goto L_Clear_Vars;
  174.  
  175. L_Challenger_Gaveup:
  176.     npctalk "Challenger gave up from the fight";
  177.     set $@pvp_Time, 0;
  178.     set $@pvp_ChallengerID, 0;
  179.     set $@pvp_ChallengerName$, "";
  180.     set $@pvp_Status, 1;
  181.     end;
  182.  
  183. L_End_Fight:
  184.     attachrid($@pvp_Winner);
  185.     set Zeny, Zeny + $@pvp_Price * 2;
  186.     npctalk "Congratulations " + strcharinfo(0) + "! You are the winner!";
  187.  
  188. L_Clear_Vars:
  189.     set $@pvp_Status, 0;
  190.     set $@pvp_Price, 0;
  191.     set $@pvp_Winner, 0;
  192.     set $@pvp_Time, 0;
  193.     set $@pvp_StarterID, 0;
  194.     set $@pvp_StarterName$, "";
  195.     set $@pvp_ChallengerID, 0;
  196.     set $@pvp_ChallengerName$, "";
  197.     areatimer "017-2.gat", 22, 20, 31, 26, 10, "PVP Master::OnCleaning";
  198.     stopnpctimer;
  199.     setnpctimer 0;
  200.     end;
  201.  
  202. OnCleaning:
  203.     warp "017-2.gat", 26, 28;
  204.     if (@killable)
  205.         gmcommand "@charkillable " + strcharinfo(0);
  206.     end;
  207.  
  208. L_Close:
  209.     set @gp, 0;
  210.     close;
  211. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement