Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- new szString[128];
- if ( isnull ( params ) )
- {
- SendClientMessage( playerid, -1, "Format:{FF9900} /duel (invite, accept, decline, block)");
- }
- if ( strcmp ( params, "invite", true ) == 0 )
- {
- new iVictim, iTrack;
- if ( sscanf ( params, "ii", iVictim, iTrack ) ) return SendClientMessage( playerid, -1, "Format:{FF9900} /duel invite [playerid] [track] "),
- SendClientMessage( playerid, -1, "Tracks:{FF9900} [Stadium: 1] [Star Tower: 2] [Trailer Park: 3] " );
- else
- {
- if ( iVictim == playerid )
- {
- return SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: You can't challenge yourself." );
- }
- if ( IsPlayerNPC ( iVictim ) )
- {
- return SendClientMessage ( playerid, -1, " You cannot do this to NPC's!" );
- }
- if ( BlockingDuels[iVictim] == 1)
- {
- return SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: This person is blocking duels. ");
- }
- if ( iTrack < 0 || iTrack > 3 )
- {
- return SendClientMessage( playerid, -1, "Tracks:{FF9900} [Stadium: 1] [Star Tower: 2] [Trailer Park: 3] " );
- }
- if ( !IsPlayerConnected( iVictim ) )
- {
- return SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: Player is not connected. " );
- }
- if ( iVictim == playerid )
- {
- return SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: You can't have a duel with yourself.");
- }
- Invited[playerid] = iVictim;
- InvitedBy[iVictim] = playerid;
- Track[playerid] = iTrack;
- new szTrack[32];
- switch ( iTrack )
- {
- case 0: szTrack = "Stadium";
- case 1: szTrack = "Star Tower";
- case 2: szTrack = "Trailer Park";
- }
- format( szString, 128, "DUEL: %s is challenging you to a duel [Track: %s]. Type /duel decline or /duel accept.", GetName( playerid ), szTrack );
- SendClientMessage( iVictim, COLOR_LIGHTBLUE, szString );
- }
- }
- else if ( strcmp ( params, "accept", true ) == 0 )
- {
- if ( InvitedBy[playerid] == -1 )
- {
- SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: Nobody invited you to a duel yet.");
- }
- else
- {
- foreach(Player, i)
- {
- if ( Invited[i] == playerid )
- {
- if ( InvitedBy[playerid] == i )
- {
- format( szString, 128, "INFO: You've accepted %s's invitation for a duel.", GetName( i ) );
- SendClientMessage( playerid, COLOR_LIGHTBLUE, szString );
- format( szString, 128, "INFO: %s has accepted your duel invitation", GetName( playerid ) );
- SendClientMessage( i, COLOR_LIGHTBLUE, szString );
- switch ( Track[i] )
- {
- case 0:
- {
- SetPlayerPos( i, 1346.5876,2183.4434,11.0234 );
- SetPlayerPos( playerid, 1379.2778,2155.8127,11.0234 );
- }
- case 1:
- {
- SetPlayerPos( i, 1557.2540,-1346.5852,329.4609 );
- SetPlayerPos( playerid, 1529.0140,-1358.4303,329.4609 );
- }
- case 2:
- {
- SetPlayerPos( i, -19.9413,1379.3442,9.1719 );
- SetPlayerPos( playerid, 0.4619,1361.3961,9.1719 );
- }
- }
- new rVW = random( 1 + 1023 );
- GivePlayerWeapon( i, 24, 100 );
- GivePlayerWeapon( playerid, 24, 100 );
- SetPlayerVirtualWorld( i, rVW );
- SetPlayerVirtualWorld( playerid, rVW );
- Invited[i] = -1;
- InvitedBy[i] = -1;
- Track[i] -= 1;
- Invited[playerid] = -1;
- InvitedBy[playerid] = -1;
- Track[playerid] -= 1;
- format( szString, 128, "DUEL: The duel between %s and %s has started! ", GetName( i ), GetName( playerid ) );
- SendClientMessageToAll( COLOR_ORANGE, szString );
- }
- else return SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: You were not invited by this person.");
- }
- else return SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: You were not invited by this person.");
- }
- }
- }
- else if ( strcmp ( params, "decline", true ) == 0 )
- {
- if ( InvitedBy[playerid] == -1 )
- {
- SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: Nobody invited you to a duel yet.");
- }
- else
- {
- foreach(Player, i)
- {
- if ( Invited[i] == playerid )
- {
- if ( InvitedBy[playerid] == i )
- {
- format( szString, 128, "INFO: You've declined %s's invitation for a duel.", GetName( i ) );
- SendClientMessage( playerid, COLOR_LIGHTBLUE, szString );
- format( szString, 128, "INFO: %s has declined your duel invitation", GetName( playerid ) );
- SendClientMessage( i, COLOR_LIGHTBLUE, szString );
- Invited[i] = -1;
- InvitedBy[i] = -1;
- Track[i] -= 1;
- Invited[playerid] = -1;
- InvitedBy[playerid] = -1;
- Track[playerid] -= 1;
- }
- else return SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: You were not invited by this person.");
- }
- else return SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: You were not invited by this person.");
- }
- }
- }
- else if ( strcmp ( params, "block", true ) == 0 )
- {
- if ( BlockingDuels[ playerid ] == 1 )
- {
- BlockingDuels[ playerid ] = 0;
- SendClientMessage( playerid, -1, "{c0c0c0}You are now allowing duel invitations.");
- }
- else if ( BlockingDuels[ playerid ] == 0 )
- {
- BlockingDuels[ playerid ] = 1;
- SendClientMessage( playerid, -1, "{c0c0c0}You are now disallowing duel invitations.");
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment