From 8e2101fad3f265834c4f81430ad94e1dcb4cd0a8 Mon Sep 17 00:00:00 2001 From: damen <16967401+basicDamen@users.noreply.github.com> Date: Tue, 25 Dec 2018 01:59:13 -0500 Subject: [PATCH 1/4] adds XP check for firetruck usage --- gamemodes/irresistible/cnr/features/fires.pwn | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gamemodes/irresistible/cnr/features/fires.pwn b/gamemodes/irresistible/cnr/features/fires.pwn index 1a240e1..1118822 100644 --- a/gamemodes/irresistible/cnr/features/fires.pwn +++ b/gamemodes/irresistible/cnr/features/fires.pwn @@ -128,9 +128,19 @@ hook OnServerGameDayEnd( ) hook OnPlayerDriveVehicle( playerid, vehicleid ) { new - modelid = GetVehicleModel( vehicleid ); + modelid = GetVehicleModel( vehicleid ), + Float: total_experience; + + GetPlayerTotalExperience( playerid, total_experience ); if ( modelid == 407 ) { + + if ( total_experience < 2500 ) + { + RemovePlayerFromVehicle( playerid ); + return SendServerMessage( playerid, "You must have 2,500XP to use a Firetruck." ); + } + ShowPlayerHelpDialog( playerid, 2500, "You can see where fires are using ~g~/fires" ); } return 1; From 3504a065d36399192fe58feaa378ae7c2254a7a2 Mon Sep 17 00:00:00 2001 From: Stev Date: Tue, 25 Dec 2018 16:11:17 +0000 Subject: [PATCH 2/4] reverting the change to fix mute detections. --- gamemodes/irresistible/cnr/auth/login.pwn | 7 ------- gamemodes/sf-cnr.pwn | 8 ++++++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/gamemodes/irresistible/cnr/auth/login.pwn b/gamemodes/irresistible/cnr/auth/login.pwn index a57290c..91f8fc8 100644 --- a/gamemodes/irresistible/cnr/auth/login.pwn +++ b/gamemodes/irresistible/cnr/auth/login.pwn @@ -17,13 +17,6 @@ hook OnPlayerText( playerid, text[ ] ) { if ( ! IsPlayerNPC( playerid ) ) { - if ( GetPlayerScore( playerid ) < 10 ) { - return SendServerMessage( playerid, "You need at least 10 score to talk. "COL_GREY"Use /ask or /report to talk to an admin in the meanwhile." ), Y_HOOKS_BREAK_RETURN_1; - } - - if ( ! IsPlayerLoggedIn( playerid ) ) { - return SendError( playerid, "You must be logged in to talk." ), Y_HOOKS_BREAK_RETURN_1; - } } return Y_HOOKS_CONTINUE_RETURN_1; } diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index d773dea..c9f536e 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -1934,6 +1934,14 @@ public OnPlayerText( playerid, text[ ] ) new time = g_iTime; + if ( GetPlayerScore( playerid ) < 10 ) { + return SendServerMessage( playerid, "You need at least 10 score to talk. "COL_GREY"Use /ask or /report to talk to an admin in the meanwhile." ), return 0; + } + + if ( ! IsPlayerLoggedIn( playerid ) ) { + return SendError( playerid, "You must be logged in to talk." ), return 0; + } + if ( textContainsIP( text ) ) return SendServerMessage( playerid, "Please do not advertise." ), 0; From 8855e91de7d59226b74c62b9acdd1760a191a6b8 Mon Sep 17 00:00:00 2001 From: Stev Date: Tue, 25 Dec 2018 16:24:09 +0000 Subject: [PATCH 3/4] cleanup --- gamemodes/sf-cnr.pwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index c9f536e..d35ea8a 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -1935,11 +1935,11 @@ public OnPlayerText( playerid, text[ ] ) time = g_iTime; if ( GetPlayerScore( playerid ) < 10 ) { - return SendServerMessage( playerid, "You need at least 10 score to talk. "COL_GREY"Use /ask or /report to talk to an admin in the meanwhile." ), return 0; + return SendServerMessage( playerid, "You need at least 10 score to talk. "COL_GREY"Use /ask or /report to talk to an admin in the meanwhile." ), 0; } if ( ! IsPlayerLoggedIn( playerid ) ) { - return SendError( playerid, "You must be logged in to talk." ), return 0; + return SendError( playerid, "You must be logged in to talk." ), 0; } if ( textContainsIP( text ) ) From 99e1c77bb6f9ff8582dd60164445cf7d9b256a81 Mon Sep 17 00:00:00 2001 From: Stev Date: Tue, 25 Dec 2018 16:35:25 +0000 Subject: [PATCH 4/4] code cleaning --- gamemodes/irresistible/cnr/features/duel.pwn | 40 ++++++++++---------- gamemodes/irresistible/cnr/features/pool.pwn | 33 ++++++++-------- 2 files changed, 35 insertions(+), 38 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/duel.pwn b/gamemodes/irresistible/cnr/features/duel.pwn index b2c2348..eacced8 100644 --- a/gamemodes/irresistible/cnr/features/duel.pwn +++ b/gamemodes/irresistible/cnr/features/duel.pwn @@ -362,16 +362,16 @@ CMD:duel( playerid, params[ ] ) new targetid; - if ( sscanf( params[7], "u", targetid) ) + if ( sscanf( params[ 7 ], "u", targetid ) ) return SendUsage( playerid, "/duel accept [PLAYER_ID]"); - if ( !IsPlayerConnected( targetid )) + if ( !IsPlayerConnected( targetid ) ) return SendError( playerid, "You do not have any duel invitations to accept."); - if ( gettime() > p_duelInvitation[ targetid ][ playerid ] ) + if ( gettime( ) > p_duelInvitation[ targetid ][ playerid ] ) return SendError( playerid, "You have not been invited by %s to duel or it has expired."); - if ( IsPlayerDueling( playerid )) + if ( IsPlayerDueling( playerid ) ) return SendError( playerid, "You cannot accept this invite as you are currently dueling."); if ( GetDistanceBetweenPlayers( playerid, targetid ) > 25.0) @@ -380,15 +380,15 @@ CMD:duel( playerid, params[ ] ) new waged_amount = g_duelData[ targetid ][ E_BET ]; - if (g_duelData[ targetid ][ E_BET ] != 0) + if ( g_duelData[ targetid ][ E_BET ] != 0 ) { - if ( GetPlayerCash( targetid ) < waged_amount) + if ( GetPlayerCash( targetid ) < waged_amount ) { SendClientMessageFormatted( targetid, -1, ""COL_DUEL"[DUEL]"COL_WHITE" %s has accepted but you don't have money to wage (%s).", ReturnPlayerName( playerid ), cash_format( waged_amount ) ); SendClientMessageFormatted( playerid, -1, ""COL_DUEL"[DUEL]"COL_WHITE" You have accepted %s's duel invitation but they don't have money.", ReturnPlayerName( targetid ) ); return 1; } - else if ( GetPlayerCash( playerid ) < waged_amount) + else if ( GetPlayerCash( playerid ) < waged_amount ) { SendClientMessageFormatted( playerid, -1, ""COL_DUEL"[DUEL]"COL_WHITE" %s requires you to wage %s.", ReturnPlayerName( targetid ), cash_format( waged_amount ) ); SendClientMessageFormatted( targetid, -1, ""COL_DUEL"[DUEL]"COL_WHITE" %s has accepted the duel invitation but they don't have money to wage.", ReturnPlayerName( playerid ) ); @@ -451,9 +451,9 @@ CMD:duel( playerid, params[ ] ) } return 1; } - else if (strmatch(params, "cancel")) + else if ( strmatch( params, "cancel" ) ) { - if ( ClearDuelInvites( playerid )) + if ( ClearDuelInvites( playerid ) ) { return SendServerMessage( playerid, "You have cancelled every duel offer that you have made." ); } @@ -486,7 +486,7 @@ stock IsPlayerDueling( playerid ) { return p_playerDueling{ playerid }; } -stock ShowPlayerDuelMenu(playerid) +stock ShowPlayerDuelMenu( playerid ) { if ( p_Class[ playerid ] != CLASS_CIVILIAN ) return SendError( playerid, "You can only use this feature whist being a civilian."); @@ -496,7 +496,7 @@ stock ShowPlayerDuelMenu(playerid) 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">>>", - (!IsPlayerConnected(g_duelData[ playerid ][ E_PLAYER ]) ? (""COL_RED"No-one") : (ReturnPlayerName( g_duelData[ playerid ][ E_PLAYER ] ) ) ), + ( ! 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 ] ), @@ -505,13 +505,13 @@ stock ShowPlayerDuelMenu(playerid) cash_format( g_duelData[ playerid ][ E_BET ] ) ); - ShowPlayerDialog(playerid, DIALOG_DUEL, DIALOG_STYLE_TABLIST, ""COL_WHITE"Duel Settings", szBigString, "Select", "Cancel"); + ShowPlayerDialog( playerid, DIALOG_DUEL, DIALOG_STYLE_TABLIST, ""COL_WHITE"Duel Settings", szBigString, "Select", "Cancel" ); return 1; } static stock forfeitPlayerDuel(playerid) { - if ( !IsPlayerDueling( playerid )) + if ( !IsPlayerDueling( playerid ) ) return 0; ClearDuelInvites( playerid ); @@ -519,22 +519,22 @@ static stock forfeitPlayerDuel(playerid) new winnerid = g_duelData[ playerid ][ E_PLAYER ]; - if ( ! IsPlayerConnected( winnerid ) || ! IsPlayerDueling( winnerid )) + if ( ! IsPlayerConnected( winnerid ) || ! IsPlayerDueling( winnerid ) ) return 0; // begin wager info new amount_waged = g_duelData[ playerid ][ E_BET ]; - SpawnPlayer(winnerid); - ClearDuelInvites(winnerid); + SpawnPlayer( winnerid ); + ClearDuelInvites( winnerid ); // decrement rounds g_duelData[ playerid ][ E_ROUNDS ] --; g_duelData[ winnerid ][ E_ROUNDS ] = g_duelData[ playerid ][ E_ROUNDS ]; // check if theres a remaining round - if (g_duelData[ playerid ][ E_ROUNDS ] == 0) + if ( g_duelData[ playerid ][ E_ROUNDS ] == 0) { if ( 0 < amount_waged < 10000000 ) { @@ -552,10 +552,10 @@ static stock forfeitPlayerDuel(playerid) return 1; } -function OnDuelTimer(targetid) +function OnDuelTimer( targetid ) { new - playerid = g_duelData[targetid][ E_PLAYER ]; + playerid = g_duelData[ targetid ][ E_PLAYER ]; g_duelData[ targetid ][ E_COUNTDOWN ] --; @@ -574,7 +574,7 @@ function OnDuelTimer(targetid) } else { - format(szSmallString, sizeof(szSmallString), "~w~%d", g_duelData[ targetid ][ E_COUNTDOWN ]); + format( szSmallString, sizeof( szSmallString ), "~w~%d", g_duelData[ targetid ][ E_COUNTDOWN ] ); GameTextForPlayer( targetid, szSmallString, 1500, 4 ); GameTextForPlayer( playerid, szSmallString, 1500, 4 ); diff --git a/gamemodes/irresistible/cnr/features/pool.pwn b/gamemodes/irresistible/cnr/features/pool.pwn index 5d5fc78..078e57a 100644 --- a/gamemodes/irresistible/cnr/features/pool.pwn +++ b/gamemodes/irresistible/cnr/features/pool.pwn @@ -10,20 +10,17 @@ //#include < physics_dynamic > /* ** Definitions ** */ -#define POCKET_RADIUS 0.09 -#define POOL_TIMER_SPEED 30 -#define DEFAULT_AIM 0.38 +#define POCKET_RADIUS ( 0.09 ) +#define POOL_TIMER_SPEED ( 30 ) +#define DEFAULT_AIM ( 0.38 ) #define DEFAULT_POOL_STRING "Pool Table\n{FFFFFF}Press ENTER To Play" -#define POOL_FEE_RATE 0.02 +#define POOL_FEE_RATE ( 0.02 ) -#define MAX_POOL_TABLES 48 -#define MAX_POOL_BALLS (16) // do not modify - -//#define DIALOG_POOL_WAGER 3284 +#define MAX_POOL_TABLES ( 48 ) +#define MAX_POOL_BALLS ( 16 ) // do not modify /* ** Macros ** */ -#define SendPoolMessage(%0,%1) \ - SendClientMessageFormatted(%0, -1, "{4B8774}[POOL] {E5861A}" # %1) +#define SendPoolMessage(%0,%1) SendClientMessageFormatted(%0, -1, "{4B8774}[POOL] {E5861A}" # %1) /* ** Constants (do not modify) ** */ enum E_POOL_BALL_TYPE { @@ -133,14 +130,14 @@ forward PlayPoolSound ( poolid, soundid ); hook OnScriptInit( ) { // textdraws - g_PoolTextdraw = TextDrawCreate(529.000000, 218.000000, "Power"); - TextDrawBackgroundColor(g_PoolTextdraw, 255); - TextDrawFont(g_PoolTextdraw, 1); - TextDrawLetterSize(g_PoolTextdraw, 0.300000, 1.299998); - TextDrawColor(g_PoolTextdraw, -1); - TextDrawSetOutline(g_PoolTextdraw, 1); - TextDrawSetProportional(g_PoolTextdraw, 1); - TextDrawSetSelectable(g_PoolTextdraw, 0); + g_PoolTextdraw = TextDrawCreate( 529.000000, 218.000000, "Power" ); + TextDrawBackgroundColor( g_PoolTextdraw, 255 ); + TextDrawFont( g_PoolTextdraw, 1 ); + TextDrawLetterSize( g_PoolTextdraw, 0.300000, 1.299998 ); + TextDrawColor( g_PoolTextdraw, -1 ); + TextDrawSetOutline( g_PoolTextdraw, 1 ); + TextDrawSetProportional( g_PoolTextdraw, 1 ); + TextDrawSetSelectable( g_PoolTextdraw, 0 ); // create static pooltables CreatePoolTableEx( 510.10159, -84.83590, 998.9375, 90.00000, POOL_SKIN_DEFAULT, 11, 7, 54, 55, 56, 50, 52, 51, 15, 10, 21, 58, 48, 17, 36, 41, 22 );