commit
8db168b9c8
@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Irresistible Gaming (c) 2018
|
||||
* Developed by Steven
|
||||
* Developed by Stev
|
||||
* Module: cnr/features/duel.pwn
|
||||
* Purpose: player duling system
|
||||
* Purpose: player dueling system
|
||||
*/
|
||||
|
||||
/* ** Includes ** */
|
||||
@ -11,26 +11,18 @@
|
||||
/* ** Definitions ** */
|
||||
#define COL_DUEL "{B74AFF}"
|
||||
|
||||
// #define DIALOG_DUEL 7360
|
||||
// #define DIALOG_DUEL_PLAYER 7361
|
||||
// #define DIALOG_DUEL_LOCATION 7362
|
||||
// #define DIALOG_DUEL_WEAPON 7363
|
||||
// #define DIALOG_DUEL_WAGER 7364
|
||||
// #define DIALOG_DUEL_WEAPON_TWO 7365
|
||||
// #define DIALOG_DUEL_HEALTH 7366
|
||||
// #define DIALOG_DUEL_ARMOUR 7367
|
||||
|
||||
/* ** Variables ** */
|
||||
enum E_DUEL_DATA
|
||||
{
|
||||
E_PLAYER, E_WEAPON[ 2 ], E_BET,
|
||||
Float: E_ARMOUR, Float: E_HEALTH, E_COUNTDOWN,
|
||||
E_TIMER, E_LOCATION_ID, E_ROUNDS,
|
||||
bool: E_CAC
|
||||
};
|
||||
|
||||
enum E_DUEL_LOCATION_DATA
|
||||
{
|
||||
E_NAME [ 19 ], Float: E_POS_ONE[ 3 ], Float: E_POS_TWO[ 3 ]
|
||||
E_NAME [ 22 ], Float: E_POS_ONE[ 3 ], Float: E_POS_TWO[ 3 ]
|
||||
};
|
||||
|
||||
new
|
||||
@ -39,19 +31,18 @@ new
|
||||
g_duelData [ MAX_PLAYERS ][ E_DUEL_DATA ],
|
||||
g_duelLocationData [ ][ E_DUEL_LOCATION_DATA ] =
|
||||
{
|
||||
{ "Santa Maria Beach", { 369.75770, -1831.576, 7.67190 }, { 369.65890, -1871.215, 7.67190 }},
|
||||
{ "Greenglass College", { 1078.0353, 1084.4989, 10.8359 }, { 1095.4019, 1064.7239, 10.8359 }},
|
||||
{ "Baseball Arena", { 1393.0995, 2177.4585, 9.75780 }, { 1377.7881, 2195.4214, 9.75780 }},
|
||||
//{"The Visage", { 1960.4512, 1907.6881, 130.937 }, { 1969.4047, 1923.2622, 130.937 }},
|
||||
{ "Mount Chilliad", { -2318.471, -1632.880, 483.703 }, { -2329.174, -1604.657, 483.760 }},
|
||||
{ "The Farm", { -1044.856, -996.8120, 129.218 }, { -1125.599, -996.7523, 129.218 }},
|
||||
{ "Tennis Courts", { 755.93790, -1280.710, 13.5565 }, { 755.93960, -1238.688, 13.5516 }},
|
||||
{ "Underwater World", { 520.59600, -2125.663, -28.257 }, { 517.96600, -2093.610, -28.257 }},
|
||||
{ "Grove Street", { 2476.4580, -1668.631, 13.3249 }, { 2501.1560, -1667.655, 13.3559 }},
|
||||
{ "Ocean Docks", { 2683.5440, -2485.137, 13.5425 }, { 2683.8470, -2433.726, 13.5553 }}
|
||||
{ "Santa Maria Beach", { 369.75770, -1831.576, 7.67190 }, { 369.65890, -1871.215, 7.67190 } },
|
||||
{ "Greenglass College", { 1078.0353, 1084.4989, 10.8359 }, { 1095.4019, 1064.7239, 10.8359 } },
|
||||
{ "Baseball Arena", { 1393.0995, 2177.4585, 9.75780 }, { 1377.7881, 2195.4214, 9.75780 } },
|
||||
{ "Mount Chilliad", { -2318.471, -1632.880, 483.703 }, { -2329.174, -1604.657, 483.760 } },
|
||||
{ "The Farm", { -1044.856, -996.8120, 129.218 }, { -1125.599, -996.7523, 129.218 } },
|
||||
{ "Tennis Courts", { 755.93790, -1280.710, 13.5565 }, { 755.93960, -1238.688, 13.5516 } },
|
||||
{ "Underwater World", { 520.59600, -2125.663, -28.257 }, { 517.96600, -2093.610, -28.257 } },
|
||||
{ "Grove Street", { 2476.4580, -1668.631, 13.3249 }, { 2501.1560, -1667.655, 13.3559 } },
|
||||
{ "Ocean Docks", { 2683.5440, -2485.137, 13.5425 }, { 2683.8470, -2433.726, 13.5553 } },
|
||||
{ "Gacia Baseball Ground", { -2305.7549, 92.3505, 35.3516 }, { -2322.0908, 108.5021, 35.3984 } }
|
||||
},
|
||||
|
||||
|
||||
bool: p_playerDueling [ MAX_PLAYERS char ],
|
||||
p_duelInvitation [ MAX_PLAYERS ][ MAX_PLAYERS ],
|
||||
|
||||
@ -178,6 +169,14 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[] )
|
||||
case 6: ShowPlayerDialog(playerid, DIALOG_DUEL_WAGER, DIALOG_STYLE_INPUT, ""COL_WHITE"Duel Settings - Set A Wager", ""COL_WHITE"Please enter the wager for this duel:", "Select", "Back");
|
||||
|
||||
case 7:
|
||||
{
|
||||
g_duelData[ playerid ][ E_CAC ] = !g_duelData[ playerid ][ E_CAC ];
|
||||
|
||||
SendClientMessageFormatted( playerid, -1, ""COL_DUEL"[DUEL]{FFFFFF} You have %s "COL_GREY"CAC Only"COL_WHITE".", g_duelData[ playerid ][ E_CAC ] ? ( "enabled" ) : ( "disabled" ) );
|
||||
ShowPlayerDuelMenu( playerid );
|
||||
}
|
||||
|
||||
case 8:
|
||||
{
|
||||
new
|
||||
pID = g_duelData [ playerid ][ E_PLAYER ];
|
||||
@ -188,8 +187,15 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[] )
|
||||
return ShowPlayerDuelMenu( playerid );
|
||||
}
|
||||
|
||||
if ( g_duelData[ playerid ][ E_CAC ] && ( ! IsPlayerUsingSampAC( pID ) && ! IsPlayerUsingSampAC( playerid ) ) )
|
||||
{
|
||||
SendError( playerid, "You and your opponent must be using CAC to duel!" );
|
||||
return ShowPlayerDuelMenu( playerid );
|
||||
}
|
||||
|
||||
p_duelInvitation[ playerid ][ pID ] = gettime( ) + 60;
|
||||
ShowPlayerHelpDialog( pID, 10000, "%s wants to duel!~n~~n~~y~Location: ~w~%s~n~~y~Weapon: ~w~%s and %s~n~~y~Wager: ~w~%s", ReturnPlayerName( playerid ), g_duelLocationData [ g_duelData[ playerid ][ E_LOCATION_ID ] ][ E_NAME ], ReturnWeaponName( g_duelData[ playerid ][ E_WEAPON ][ 0 ] ), ReturnWeaponName( g_duelData[ playerid ][ E_WEAPON ][ 1 ] ), cash_format(g_duelData[ playerid ][ E_BET ]));
|
||||
ShowPlayerHelpDialog( pID, 10000, "%s wants to duel!~n~~n~~y~Location: ~w~%s~n~~y~Weapon: ~w~%s and %s~n~~y~Wager: ~w~%s~n~~y~CAC: ~w~%s", ReturnPlayerName( playerid ), g_duelLocationData [ g_duelData[ playerid ][ E_LOCATION_ID ] ][ E_NAME ], ReturnWeaponName( g_duelData[ playerid ][ E_WEAPON ][ 0 ] ), ReturnWeaponName( g_duelData[ playerid ][ E_WEAPON ][ 1 ] ), cash_format(g_duelData[ playerid ][ E_BET ] ), g_duelData[ playerid ][ E_CAC ] ? ( "~g~Yes" ) : ( "~r~No" ) );
|
||||
|
||||
SendClientMessageFormatted( playerid, -1, ""COL_DUEL"[DUEL]"COL_WHITE" You have sent a duel invitation to %s for "COL_GOLD"%s"COL_WHITE".", ReturnPlayerName( pID ), cash_format( g_duelData[ playerid ][ E_BET ] ) );
|
||||
SendClientMessageFormatted( pID, -1, ""COL_DUEL"[DUEL]"COL_WHITE" You are invited to duel %s for "COL_GOLD"%s"COL_WHITE", use \"/duel accept %d\".", ReturnPlayerName( playerid ), cash_format( g_duelData[ playerid ][ E_BET ] ), playerid );
|
||||
}
|
||||
@ -495,14 +501,15 @@ stock ShowPlayerDuelMenu( playerid )
|
||||
return SendError( playerid, "You cannot duel whilst having a wanted level.");
|
||||
|
||||
format( szBigString, sizeof(szBigString),
|
||||
"Player\t"COL_GREY"%s\nHealth\t"COL_GREY"%.2f%%\nArmour\t"COL_GREY"%.2f%%\nPrimary Weapon\t"COL_GREY"%s\nSecondary Weapon\t"COL_GREY"%s\nLocation\t"COL_GREY"%s\nWager\t"COL_GREY"%s\n"COL_GOLD"Send Invite\t"COL_GOLD">>>",
|
||||
"Player\t"COL_GREY"%s\nHealth\t"COL_GREY"%.2f%%\nArmour\t"COL_GREY"%.2f%%\nPrimary Weapon\t"COL_GREY"%s\nSecondary Weapon\t"COL_GREY"%s\nLocation\t"COL_GREY"%s\nWager\t"COL_GREY"%s\nCAC Only\t"COL_GREY"%s\n"COL_GOLD"Send Invite\t"COL_GOLD">>>",
|
||||
( ! IsPlayerConnected( g_duelData[ playerid ][ E_PLAYER ] ) ? ( ""COL_RED"No-one" ) : ( ReturnPlayerName( g_duelData[ playerid ][ E_PLAYER ] ) ) ),
|
||||
g_duelData[ playerid ][ E_HEALTH ],
|
||||
g_duelData[ playerid ][ E_ARMOUR ],
|
||||
ReturnWeaponName( g_duelData[ playerid ][ E_WEAPON ][ 0 ] ),
|
||||
ReturnWeaponName( g_duelData[ playerid ][ E_WEAPON ][ 1 ] ),
|
||||
g_duelLocationData[ g_duelData[ playerid ][ E_LOCATION_ID ] ][ E_NAME ],
|
||||
cash_format( g_duelData[ playerid ][ E_BET ] )
|
||||
cash_format( g_duelData[ playerid ][ E_BET ] ),
|
||||
( g_duelData[ playerid ][ E_CAC ] ? ( ""COL_GREEN"ENABLED" ) : ( ""COL_RED"DISABLED" ) )
|
||||
);
|
||||
|
||||
ShowPlayerDialog( playerid, DIALOG_DUEL, DIALOG_STYLE_TABLIST, ""COL_WHITE"Duel Settings", szBigString, "Select", "Cancel" );
|
||||
|
Loading…
Reference in New Issue
Block a user