Guest User

Untitled

a guest
Nov 11th, 2011
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.55 KB | None | 0 0
  1. {
  2.     new szString[128];
  3.     if ( isnull ( params ) )
  4.     {
  5.         SendClientMessage( playerid, -1, "Format:{FF9900} /duel (invite, accept, decline, block)");
  6.     }
  7.     if ( strcmp ( params, "invite", true ) == 0 )
  8.     {
  9.         new iVictim, iTrack;
  10.         if ( sscanf ( params, "ii", iVictim, iTrack ) ) return SendClientMessage( playerid, -1, "Format:{FF9900} /duel invite [playerid] [track] "),
  11.             SendClientMessage( playerid, -1, "Tracks:{FF9900} [Stadium: 1] [Star Tower: 2] [Trailer Park: 3] " );
  12.  
  13.         else
  14.         {
  15.             if ( iVictim == playerid )
  16.             {
  17.                 return SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: You can't challenge yourself." );
  18.             }
  19.             if ( IsPlayerNPC ( iVictim ) )
  20.             {
  21.                 return SendClientMessage ( playerid, -1, " You cannot do this to NPC's!" );
  22.             }
  23.             if ( BlockingDuels[iVictim] == 1)
  24.             {
  25.                 return SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: This person is blocking duels. ");
  26.             }
  27.             if ( iTrack < 0 || iTrack > 3 )
  28.             {
  29.                 return SendClientMessage( playerid, -1, "Tracks:{FF9900} [Stadium: 1] [Star Tower: 2] [Trailer Park: 3] " );
  30.             }
  31.            
  32.             if ( !IsPlayerConnected( iVictim ) )
  33.             {
  34.                 return SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: Player is not connected. " );
  35.             }
  36.            
  37.             if ( iVictim == playerid )
  38.             {
  39.                 return SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: You can't have a duel with yourself.");
  40.             }
  41.            
  42.             Invited[playerid] = iVictim;
  43.             InvitedBy[iVictim] = playerid;
  44.             Track[playerid] = iTrack;
  45.            
  46.             new szTrack[32];
  47.             switch ( iTrack )
  48.             {
  49.                 case 0: szTrack = "Stadium";
  50.                 case 1: szTrack = "Star Tower";
  51.                 case 2: szTrack = "Trailer Park";
  52.             }
  53.            
  54.             format( szString, 128, "DUEL: %s is challenging you to a duel [Track: %s]. Type /duel decline or /duel accept.", GetName( playerid ), szTrack );
  55.             SendClientMessage( iVictim, COLOR_LIGHTBLUE, szString );
  56.         }
  57.     }
  58.     else if ( strcmp ( params, "accept", true ) == 0 )
  59.     {
  60.         if ( InvitedBy[playerid] == -1 )
  61.         {
  62.             SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: Nobody invited you to a duel yet.");
  63.         }
  64.         else
  65.         {
  66.             foreach(Player, i)
  67.             {
  68.                 if ( Invited[i] == playerid )
  69.                 {
  70.                     if ( InvitedBy[playerid] == i )
  71.                     {
  72.                         format( szString, 128, "INFO: You've accepted %s's invitation for a duel.", GetName( i ) );
  73.                         SendClientMessage( playerid, COLOR_LIGHTBLUE, szString );
  74.                         format( szString, 128, "INFO: %s has accepted your duel invitation", GetName( playerid ) );
  75.                         SendClientMessage( i, COLOR_LIGHTBLUE, szString );
  76.  
  77.                         switch ( Track[i] )
  78.                         {
  79.                             case 0:
  80.                             {
  81.                                 SetPlayerPos( i, 1346.5876,2183.4434,11.0234 );
  82.                                 SetPlayerPos( playerid, 1379.2778,2155.8127,11.0234 );
  83.                             }
  84.                             case 1:
  85.                             {
  86.                                 SetPlayerPos( i, 1557.2540,-1346.5852,329.4609 );
  87.                                 SetPlayerPos( playerid, 1529.0140,-1358.4303,329.4609 );
  88.                             }
  89.                             case 2:
  90.                             {
  91.                                 SetPlayerPos( i, -19.9413,1379.3442,9.1719 );
  92.                                 SetPlayerPos( playerid, 0.4619,1361.3961,9.1719 );
  93.                             }
  94.                         }
  95.                        
  96.                         new rVW = random( 1 + 1023 );
  97.                         GivePlayerWeapon( i, 24, 100 );
  98.                         GivePlayerWeapon( playerid, 24, 100 );
  99.                         SetPlayerVirtualWorld( i, rVW );
  100.                         SetPlayerVirtualWorld( playerid, rVW );
  101.                        
  102.                         Invited[i] = -1;
  103.                         InvitedBy[i] = -1;
  104.                         Track[i] -= 1;
  105.  
  106.                         Invited[playerid] = -1;
  107.                         InvitedBy[playerid] = -1;
  108.                         Track[playerid] -= 1;
  109.                        
  110.                         format( szString, 128, "DUEL: The duel between %s and %s has started! ", GetName( i ), GetName( playerid ) );
  111.                         SendClientMessageToAll( COLOR_ORANGE, szString );
  112.                     }
  113.                     else return SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: You were not invited by this person.");
  114.                 }
  115.                 else return SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: You were not invited by this person.");
  116.             }
  117.         }
  118.     }
  119.     else if ( strcmp ( params, "decline", true ) == 0 )
  120.     {
  121.         if ( InvitedBy[playerid] == -1 )
  122.         {
  123.             SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: Nobody invited you to a duel yet.");
  124.         }
  125.         else
  126.         {
  127.             foreach(Player, i)
  128.             {
  129.                 if ( Invited[i] == playerid )
  130.                 {
  131.                     if ( InvitedBy[playerid] == i )
  132.                     {
  133.                         format( szString, 128, "INFO: You've declined %s's invitation for a duel.", GetName( i ) );
  134.                         SendClientMessage( playerid, COLOR_LIGHTBLUE, szString );
  135.                         format( szString, 128, "INFO: %s has declined your duel invitation", GetName( playerid ) );
  136.                         SendClientMessage( i, COLOR_LIGHTBLUE, szString );
  137.  
  138.                         Invited[i] = -1;
  139.                         InvitedBy[i] = -1;
  140.                         Track[i] -= 1;
  141.                        
  142.                         Invited[playerid] = -1;
  143.                         InvitedBy[playerid] = -1;
  144.                         Track[playerid] -= 1;
  145.                     }
  146.                     else return SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: You were not invited by this person.");
  147.                 }
  148.                 else return SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: You were not invited by this person.");
  149.             }
  150.         }
  151.     }
  152.     else if ( strcmp ( params, "block", true ) == 0 )
  153.     {
  154.         if ( BlockingDuels[ playerid ] == 1 )
  155.         {
  156.             BlockingDuels[ playerid ] = 0;
  157.             SendClientMessage( playerid, -1, "{c0c0c0}You are now allowing duel invitations.");
  158.         }
  159.         else if ( BlockingDuels[ playerid ] == 0 )
  160.         {
  161.             BlockingDuels[ playerid ] = 1;
  162.             SendClientMessage( playerid, -1, "{c0c0c0}You are now disallowing duel invitations.");
  163.         }
  164.     }
  165.     return 1;
  166. }
  167.  
Advertisement
Add Comment
Please, Sign In to add comment