From 6b54ff2e1340b76662417482f325b7cdfe7d18c8 Mon Sep 17 00:00:00 2001 From: Stev Date: Fri, 31 May 2019 17:24:06 +0100 Subject: [PATCH 1/3] adding new location for duel --- gamemodes/irresistible/cnr/features/duel.pwn | 36 +++++++------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/duel.pwn b/gamemodes/irresistible/cnr/features/duel.pwn index eacced8..fd0036f 100644 --- a/gamemodes/irresistible/cnr/features/duel.pwn +++ b/gamemodes/irresistible/cnr/features/duel.pwn @@ -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,15 +11,6 @@ /* ** 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 { @@ -30,7 +21,7 @@ enum E_DUEL_DATA 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 +30,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 ], From faf53995b7913720b3f050aa6fcb18453e39f5db Mon Sep 17 00:00:00 2001 From: Stev Date: Fri, 31 May 2019 17:41:51 +0100 Subject: [PATCH 2/3] adding CAC only option in duel player --- gamemodes/irresistible/cnr/features/duel.pwn | 22 +++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/duel.pwn b/gamemodes/irresistible/cnr/features/duel.pwn index fd0036f..a61c527 100644 --- a/gamemodes/irresistible/cnr/features/duel.pwn +++ b/gamemodes/irresistible/cnr/features/duel.pwn @@ -17,6 +17,7 @@ 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 @@ -168,6 +169,13 @@ 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" ) ); + } + + case 8: { new pID = g_duelData [ playerid ][ E_PLAYER ]; @@ -178,8 +186,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 ); } @@ -485,14 +500,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" ); From af4f9ae4c70405dd27f0f22ed8da61fafe3ff35e Mon Sep 17 00:00:00 2001 From: Stev Date: Fri, 31 May 2019 19:08:05 +0100 Subject: [PATCH 3/3] returning dialog menu when setting cac --- gamemodes/irresistible/cnr/features/duel.pwn | 1 + 1 file changed, 1 insertion(+) diff --git a/gamemodes/irresistible/cnr/features/duel.pwn b/gamemodes/irresistible/cnr/features/duel.pwn index a61c527..d43f58c 100644 --- a/gamemodes/irresistible/cnr/features/duel.pwn +++ b/gamemodes/irresistible/cnr/features/duel.pwn @@ -173,6 +173,7 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[] ) 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: