From 424cb209916bdb459d4666a66531da34d83df0aa Mon Sep 17 00:00:00 2001 From: Stev Date: Sun, 23 Dec 2018 21:11:50 +0000 Subject: [PATCH 01/16] fixes alcatrax checkpoint for mining --- gamemodes/irresistible/cnr/features/_features.pwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamemodes/irresistible/cnr/features/_features.pwn b/gamemodes/irresistible/cnr/features/_features.pwn index 5768b81..a8dfb83 100644 --- a/gamemodes/irresistible/cnr/features/_features.pwn +++ b/gamemodes/irresistible/cnr/features/_features.pwn @@ -15,9 +15,9 @@ #include "irresistible\cnr\features\vehicles\_vehicles.pwn" #include "irresistible\cnr\features\business\_business.pwn" #include "irresistible\cnr\features\gangs\_gangs.pwn" +#include "irresistible\cnr\features\minijobs\_minijobs.pwn" #include "irresistible\cnr\features\cop\_cop.pwn" #include "irresistible\cnr\features\robbery\_robbery.pwn" -#include "irresistible\cnr\features\minijobs\_minijobs.pwn" #include "irresistible\cnr\features\player_items\_player_items.pwn" #include "irresistible\cnr\features\visage\_visage.pwn" From d1dae5376f71d78ca0586e27d2e1385ba7256097 Mon Sep 17 00:00:00 2001 From: Stev Date: Sun, 23 Dec 2018 22:11:49 +0000 Subject: [PATCH 02/16] fixes /gang offlinekick --- gamemodes/irresistible/cnr/features/gangs/gangs.pwn | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/gangs/gangs.pwn b/gamemodes/irresistible/cnr/features/gangs/gangs.pwn index b045ae9..ba86fc5 100644 --- a/gamemodes/irresistible/cnr/features/gangs/gangs.pwn +++ b/gamemodes/irresistible/cnr/features/gangs/gangs.pwn @@ -304,7 +304,8 @@ CMD:gang( playerid, params[ ] ) if ( !strcmp( params, "offlinekick", false, 11 ) ) { new - p_Name[ 24 ]; + iGang = p_GangID[ playerid ], + p_Name[ MAX_PLAYER_NAME ]; if ( ! IsPlayerGangLeader( playerid, p_GangID[ playerid ], .only_leader = 1 ) ) return SendError( playerid, "You are not the gang leader." ); @@ -314,8 +315,8 @@ CMD:gang( playerid, params[ ] ) trimString( p_Name ); - mysql_format( dbHandle, szNormalString, 128, "SELECT `ID`, `NAME`, `GANG_ID` FROM `USERS` WHERE `NAME`='%e' AND `GANG_ID`=%d", p_Name, p_GangID[ playerid ] ); - mysql_tquery( dbHandle, szNormalString, "OnGangKickOffline", "dd", playerid, p_GangID[ playerid ] ); + mysql_format( dbHandle, szNormalString, 128, "SELECT `ID`, `NAME`, `GANG_ID` FROM `USERS` WHERE `NAME`='%e' AND `GANG_ID`=%d", p_Name, g_gangData[ iGang ][ E_SQL_ID ] ); + mysql_tquery( dbHandle, szNormalString, "OnGangKickOffline", "dd", playerid, g_gangData[ iGang ][ E_SQL_ID ] ); return 1; } else if ( !strcmp( params, "turfs", false, 5 ) ) @@ -737,6 +738,7 @@ thread OnListClans( playerid ) thread OnGangKickOffline( playerid, gangid ) { new + static_gangid = p_GangID[ playerid ], rows = cache_get_row_count( ); if ( rows ) @@ -768,7 +770,7 @@ thread OnGangKickOffline( playerid, gangid ) mysql_single_query( sprintf( "DELETE FROM `GANG_COLEADERS` WHERE `USER_ID`=%d", player_accid ) ); mysql_single_query( sprintf( "UPDATE `USERS` SET `GANG_ID`=-1 WHERE `ID`=%d", player_accid ) ); - SendClientMessageToGang( gangid, g_gangData[ gangid ] [ E_COLOR ], "[GANG]{FFFFFF} %s has left the gang (KICKED)", player_name ); + SendClientMessageToGang( static_gangid, g_gangData[ static_gangid ] [ E_COLOR ], "[GANG]{FFFFFF} %s has left the gang (KICKED)", player_name ); } else { From 9b44be62cc5e2f96392d042d99dcb04dc69233a2 Mon Sep 17 00:00:00 2001 From: Stev Date: Sun, 23 Dec 2018 22:43:43 +0000 Subject: [PATCH 03/16] co-leaders can use /gang offlinekick --- gamemodes/irresistible/cnr/features/gangs/gangs.pwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamemodes/irresistible/cnr/features/gangs/gangs.pwn b/gamemodes/irresistible/cnr/features/gangs/gangs.pwn index ba86fc5..707d1a9 100644 --- a/gamemodes/irresistible/cnr/features/gangs/gangs.pwn +++ b/gamemodes/irresistible/cnr/features/gangs/gangs.pwn @@ -307,7 +307,7 @@ CMD:gang( playerid, params[ ] ) iGang = p_GangID[ playerid ], p_Name[ MAX_PLAYER_NAME ]; - if ( ! IsPlayerGangLeader( playerid, p_GangID[ playerid ], .only_leader = 1 ) ) + if ( ! IsPlayerGangLeader( playerid, p_GangID[ playerid ] ) ) return SendError( playerid, "You are not the gang leader." ); if ( sscanf( params[ 12 ], "s[24]", p_Name ) ) From c9464706ef78c7792b799b6dc5b7b4c2cf8c4a10 Mon Sep 17 00:00:00 2001 From: Stev Date: Sun, 23 Dec 2018 22:45:15 +0000 Subject: [PATCH 04/16] leader detection inside offlinekick --- gamemodes/irresistible/cnr/features/gangs/gangs.pwn | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gamemodes/irresistible/cnr/features/gangs/gangs.pwn b/gamemodes/irresistible/cnr/features/gangs/gangs.pwn index 707d1a9..61f336d 100644 --- a/gamemodes/irresistible/cnr/features/gangs/gangs.pwn +++ b/gamemodes/irresistible/cnr/features/gangs/gangs.pwn @@ -762,6 +762,10 @@ thread OnGangKickOffline( playerid, gangid ) // verify player is in gang new player_gangid = cache_get_field_content_int( 0, "GANG_ID", dbHandle ); + if ( IsPlayerGangLeader( playerid, player_gangid, .only_leader = 1 ) ) { + return SendError( playerid, "You cannot kick this player from the gang." ); + } + if ( player_gangid != gangid ) { return SendError( playerid, "This player is not in your gang." ); } From 65fd8ac7800d1ce19d89270b9b50461a03c08cf4 Mon Sep 17 00:00:00 2001 From: Stev Date: Mon, 24 Dec 2018 18:22:55 +0000 Subject: [PATCH 05/16] disables spawn protection in pb --- .../cnr/features/passive_mode.pwn | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/passive_mode.pwn b/gamemodes/irresistible/cnr/features/passive_mode.pwn index 8df8e7c..99a8ce7 100644 --- a/gamemodes/irresistible/cnr/features/passive_mode.pwn +++ b/gamemodes/irresistible/cnr/features/passive_mode.pwn @@ -27,17 +27,20 @@ hook OnPlayerUpdateEx( playerid ) hook OnPlayerSpawn( playerid ) { - // Toggle Anti Spawn Kill - DisableRemoteVehicleCollisions( playerid, p_AdminOnDuty{ playerid } ); - SetPlayerHealth( playerid, INVALID_PLAYER_ID ); - Delete3DTextLabel( p_SpawnKillLabel[ playerid ] ); - p_SpawnKillLabel[ playerid ] = Create3DTextLabel( "Spawn Protected!", COLOR_GOLD, 0.0, 0.0, 0.0, 15.0, 0 ); - p_AntiSpawnKill[ playerid ] = g_iTime + 15; - Attach3DTextLabelToPlayer( p_SpawnKillLabel[ playerid ], playerid, 0.0, 0.0, 0.3 ); - p_AntiSpawnKillEnabled{ playerid } = true; + if ( ! IsPlayerInPaintBall( playerid ) ) + { + // Toggle Anti Spawn Kill + DisableRemoteVehicleCollisions( playerid, p_AdminOnDuty{ playerid } ); + SetPlayerHealth( playerid, INVALID_PLAYER_ID ); + Delete3DTextLabel( p_SpawnKillLabel[ playerid ] ); + p_SpawnKillLabel[ playerid ] = Create3DTextLabel( "Spawn Protected!", COLOR_GOLD, 0.0, 0.0, 0.0, 15.0, 0 ); + p_AntiSpawnKill[ playerid ] = g_iTime + 15; + Attach3DTextLabelToPlayer( p_SpawnKillLabel[ playerid ], playerid, 0.0, 0.0, 0.3 ); + p_AntiSpawnKillEnabled{ playerid } = true; - // Toggle Passive Mode - SetPlayerPassiveMode( playerid ); + // Toggle Passive Mode + SetPlayerPassiveMode( playerid ); + } return 1; } 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 06/16] 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 07/16] 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 08/16] 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 09/16] 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 ); From 9278296ee8b537733c167fa3b006286e5f33e2d0 Mon Sep 17 00:00:00 2001 From: Stev Date: Tue, 25 Dec 2018 22:45:07 +0000 Subject: [PATCH 10/16] hoping the removing business memebers to be resolved. --- .../cnr/features/business/business.pwn | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/business/business.pwn b/gamemodes/irresistible/cnr/features/business/business.pwn index 7fbaaef..fd1cdd2 100644 --- a/gamemodes/irresistible/cnr/features/business/business.pwn +++ b/gamemodes/irresistible/cnr/features/business/business.pwn @@ -194,6 +194,7 @@ new g_businessActors [ MAX_BUSINESSES ] [ MAX_BIZ_ACTORS ], g_isBusinessVehicle [ MAX_VEHICLES ] = { -1, ... }, g_businessVehicle [ MAX_BUSINESSES ] = { INVALID_VEHICLE_ID, ... }, + g_businessMemberIndex [ MAX_PLAYERS ] [ MAX_BUSINESS_MEMBERS ], bool: g_businessVehicleUnlocked [ MAX_BUSINESSES ] [ MAX_BIZ_VEH_MODELS char ], Iterator: business < MAX_BUSINESSES > //g_BusinessUpdateTickCount = 0 @@ -1029,28 +1030,24 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) if ( listitem == 0 ) return ShowPlayerDialog( playerid, DIALOG_BUSINESS_ADD_MEMBER, DIALOG_STYLE_INPUT, ""COL_GREY"Business System", ""COL_WHITE"Type the name of the player you wish to add as a member.", "Add", "Back" ); - for( new i, x = 1; i < MAX_BUSINESS_MEMBERS; i ++ ) - { - if ( g_businessData[ businessid ] [ E_MEMBERS ] [ i ] ) - { - if ( x == listitem ) - { - // alert player if online - foreach (new p : Player) if ( g_businessData[ businessid ] [ E_MEMBERS ] [ i ] == p_AccountID[ p ] ) { - SendServerMessage( p, "You have been removed as a member of "COL_GREY"%s"COL_WHITE".", g_businessData[ businessid ] [ E_NAME ] ); - break; - } + new memberid = g_businessMemberIndex[ playerid ][ listitem ]; - // null entry - g_businessData[ businessid ] [ E_MEMBERS ] [ i ] = 0; + if ( g_businessData[ businessid ] [ E_MEMBERS ] [ memberid ] ) + { + printf( "[business remove member] {user: %d, businessid: %d}", g_businessData[ businessid ] [ E_MEMBERS ] [ memberid ], businessid ); + + // alert player if online + foreach (new p : Player) if ( g_businessData[ businessid ] [ E_MEMBERS ] [ memberid ] == p_AccountID[ p ] ) { + SendServerMessage( p, "You have been removed as a member of "COL_GREY"%s"COL_WHITE".", g_businessData[ businessid ] [ E_NAME ] ); + break; + } - // save - UpdateBusinessData( businessid ), UpdateBusinessTitle( businessid ); - SendServerMessage( playerid, "You have removed a member from the business." ); - break; - } - x ++; - } + // null entry + g_businessData[ businessid ] [ E_MEMBERS ] [ memberid ] = 0; + + // save + UpdateBusinessData( businessid ), UpdateBusinessTitle( businessid ); + SendServerMessage( playerid, "You have removed a member from the business." ); } ShowBusinessMembers( playerid, businessid ); @@ -2034,7 +2031,7 @@ stock ShowBusinessMembers( playerid, businessid ) function OnShowBusinessMembers( playerid, businessid ) { new - rows, fields, member[ MAX_PLAYER_NAME ]; + count = 0, rows, fields, member[ MAX_PLAYER_NAME ]; cache_get_data( rows, fields ); @@ -2047,6 +2044,8 @@ function OnShowBusinessMembers( playerid, businessid ) // get member name cache_get_field_content( i, "NAME", member, sizeof( member ) ); format( szBigString, sizeof( szBigString ), "%s%s\n", szBigString, member ); + + g_businessMemberIndex[ playerid ][ count ++ ] = i; } ShowPlayerDialog( playerid, DIALOG_BUSINESS_MEMBERS, DIALOG_STYLE_LIST, ""COL_GREY"Business System", szBigString, "Kick", "Back" ); From b59b5acdd0c06370b69bd692ab58e22a0abe8018 Mon Sep 17 00:00:00 2001 From: Stev Date: Tue, 25 Dec 2018 23:23:00 +0000 Subject: [PATCH 11/16] fixes mute detection and score detectionf or talking --- gamemodes/irresistible/cnr/auth/login.pwn | 7 ------- gamemodes/irresistible/security.pwn | 2 +- gamemodes/sf-cnr.pwn | 13 ++++++++----- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/gamemodes/irresistible/cnr/auth/login.pwn b/gamemodes/irresistible/cnr/auth/login.pwn index 91f8fc8..1db5f88 100644 --- a/gamemodes/irresistible/cnr/auth/login.pwn +++ b/gamemodes/irresistible/cnr/auth/login.pwn @@ -13,12 +13,5 @@ /* ** Variables ** */ /* ** Hooks ** */ -hook OnPlayerText( playerid, text[ ] ) -{ - if ( ! IsPlayerNPC( playerid ) ) { - - } - return Y_HOOKS_CONTINUE_RETURN_1; -} /* ** Functions ** */ diff --git a/gamemodes/irresistible/security.pwn b/gamemodes/irresistible/security.pwn index fde4065..1218497 100644 --- a/gamemodes/irresistible/security.pwn +++ b/gamemodes/irresistible/security.pwn @@ -117,7 +117,7 @@ hook OnPlayerDisconnect( playerid, reason ) return 1; } -#if defined DEBUG_MODE +#if !defined DEBUG_MODE // prevent player from leaking rcon password hook OnPlayerText( playerid, text[ ] ) { diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index d35ea8a..7928e8e 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -1934,13 +1934,17 @@ public OnPlayerText( playerid, text[ ] ) new time = g_iTime; - if ( GetPlayerScore( playerid ) < 10 ) { + 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." ), 0; - } - if ( ! IsPlayerLoggedIn( playerid ) ) { + if ( !p_PlayerLogged{ playerid } ) return SendError( playerid, "You must be logged in to talk." ), 0; - } + +#if !defined DEBUG_MODE + GetServerVarAsString( "rcon_password", szNormalString, sizeof( szNormalString ) ); // Anti-rcon spam poop + if ( strfind( text, szNormalString, true ) != -1 ) + return SendError( playerid, "An error occured, please try again." ), 0; +#endif if ( textContainsIP( text ) ) return SendServerMessage( playerid, "Please do not advertise." ), 0; @@ -1975,7 +1979,6 @@ public OnPlayerText( playerid, text[ ] ) return 0; } } - if ( ! IsPlayerSettingToggled( playerid, SETTING_CHAT_PREFIXES ) ) { switch( text[ 0 ] ) From 0df6f5c686b2e7e76bc6287408fe7f9079c3b475 Mon Sep 17 00:00:00 2001 From: Stev Date: Wed, 26 Dec 2018 00:11:37 +0000 Subject: [PATCH 12/16] adds /banlog - admins can search for a ban result from a name. --- .../cnr/commands/admin/admin_three.pwn | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn b/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn index 575b691..9d6af81 100644 --- a/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn @@ -536,6 +536,54 @@ CMD:ban( playerid, params [ ] ) return 1; } +CMD:banlog( playerid, params[ ] ) +{ + new + iName[ MAX_PLAYER_NAME ]; + + if ( p_AdminLevel[ playerid ] < 3 ) return SendError( playerid, ADMIN_COMMAND_REJECT ); + else if ( sscanf( params, "s[24]", iName ) ) return SendUsage( playerid, "/banlog [PLAYER_NAME]" ); + else + { + format( szNormalString, sizeof( szNormalString ) , "SELECT * FROM `BANS` WHERE `NAME`='%s' LIMIT 1", iName ); + mysql_function_query( dbHandle, szNormalString, true, "OnPlayerBanLog", "ds", playerid, iName ); + } + return 1; +} + +thread OnPlayerBanLog( playerid, const Name[ ] ) +{ + new + rows = cache_get_row_count( ); + + if ( ! rows ) { + return SendError( playerid, "This player isn't banned." ); + } + + new ban_ip[ 16 ]; + new ban_reason[ 80 ]; + new ban_by[ 24 ]; + new ban_date; + new ban_expire; + new country[ 3 ]; + + for ( new row = 0; row < rows; row ++ ) + { + cache_get_field_content_int( row, "DATE", ban_date ); + cache_get_field_content_int( row, "EXPIRE", ban_expire ); + cache_get_field_content( row, "IP", ban_ip ); + cache_get_field_content( row, "REASON", ban_reason ); + cache_get_field_content( row, "BANBY", ban_by ); + + if ( ! ban_expire ) + format( szHugeString, sizeof( szHugeString ), ""COL_ORANGE"Ban Infomation:\n\n"COL_GREY"Userame: "COL_WHITE"%s\n"COL_GREY"IP Address: "COL_WHITE"%s\n"COL_GREY"Reason: "COL_WHITE"%s\n"COL_GREY"Banned by: "COL_WHITE"%s\n"COL_GREY"Expires: "COL_WHITE"Never\n", Name, ban_ip, ban_reason, ban_by ); + else + format( szHugeString, sizeof( szHugeString ), ""COL_ORANGE"Ban Infomation:\n\n"COL_GREY"Userame: "COL_WHITE"%s\n"COL_GREY"IP Address: "COL_WHITE"%s\n"COL_GREY"Reason: "COL_WHITE"%s\n"COL_GREY"Banned by: "COL_WHITE"%s\n"COL_GREY"Expires: "COL_WHITE"%s\n", Name, ban_ip, ban_reason, ban_by, secondstotime( ban_expire - g_iTime ) ); + } + + return ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_MSGBOX, ""COL_WHITE"Ban Search", szHugeString, "Close", "" ), 1; +} + CMD:bring( playerid, params[ ] ) { new From b3f1f160fcba5d632c67b5fa1f88efbcbc19d3b6 Mon Sep 17 00:00:00 2001 From: Stev Date: Wed, 26 Dec 2018 09:48:37 +0000 Subject: [PATCH 13/16] variables for /banlog --- .../irresistible/cnr/commands/admin/admin_three.pwn | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn b/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn index 9d6af81..a8c1b5f 100644 --- a/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn @@ -560,12 +560,13 @@ thread OnPlayerBanLog( playerid, const Name[ ] ) return SendError( playerid, "This player isn't banned." ); } - new ban_ip[ 16 ]; - new ban_reason[ 80 ]; - new ban_by[ 24 ]; - new ban_date; - new ban_expire; - new country[ 3 ]; + static + ban_ip[ 16 ], + ban_reason[ 80 ], + ban_by[ 24 ], + ban_date, + ban_expire, + ; for ( new row = 0; row < rows; row ++ ) { From 644ed2c5dd4db5e9e28e7b0b9cf7f03c0254d740 Mon Sep 17 00:00:00 2001 From: Stev Date: Wed, 26 Dec 2018 09:48:58 +0000 Subject: [PATCH 14/16] listing new command. --- gamemodes/irresistible/cnr/commands/admin/_admin.pwn | 1 + 1 file changed, 1 insertion(+) diff --git a/gamemodes/irresistible/cnr/commands/admin/_admin.pwn b/gamemodes/irresistible/cnr/commands/admin/_admin.pwn index ccd91fa..fb2a964 100644 --- a/gamemodes/irresistible/cnr/commands/admin/_admin.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/_admin.pwn @@ -74,6 +74,7 @@ static stock { 2, "/kick", "Kicking a player from the server" }, /* ** Level 3 Commands ** */ + { 3, "/banlog", "Finding ban information about a player"} { 3, "/smlog", "Cash transaction log from a player" }, { 3, "/iclog", "IC transaction log from a player" }, { 3, "/resetwep", "Resetting weapons from a player" }, From af8fad34ed1e7ec64dee3c81f3974486d6acb0aa Mon Sep 17 00:00:00 2001 From: Stev Date: Wed, 26 Dec 2018 10:02:48 +0000 Subject: [PATCH 15/16] displaying ID in global chat changeable in settings /cp --- gamemodes/irresistible/cnr/commands/admin/_admin.pwn | 2 +- gamemodes/irresistible/cnr/commands/admin/admin_three.pwn | 2 +- .../irresistible/cnr/features/player/player_settings.pwn | 8 ++++---- gamemodes/sf-cnr.pwn | 6 ++++++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gamemodes/irresistible/cnr/commands/admin/_admin.pwn b/gamemodes/irresistible/cnr/commands/admin/_admin.pwn index fb2a964..68c1e89 100644 --- a/gamemodes/irresistible/cnr/commands/admin/_admin.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/_admin.pwn @@ -74,7 +74,7 @@ static stock { 2, "/kick", "Kicking a player from the server" }, /* ** Level 3 Commands ** */ - { 3, "/banlog", "Finding ban information about a player"} + { 3, "/banlog", "Finding ban information about a player" }, { 3, "/smlog", "Cash transaction log from a player" }, { 3, "/iclog", "IC transaction log from a player" }, { 3, "/resetwep", "Resetting weapons from a player" }, diff --git a/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn b/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn index a8c1b5f..1127bd2 100644 --- a/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn @@ -565,7 +565,7 @@ thread OnPlayerBanLog( playerid, const Name[ ] ) ban_reason[ 80 ], ban_by[ 24 ], ban_date, - ban_expire, + ban_expire ; for ( new row = 0; row < rows; row ++ ) diff --git a/gamemodes/irresistible/cnr/features/player/player_settings.pwn b/gamemodes/irresistible/cnr/features/player/player_settings.pwn index b410721..0ec67ac 100644 --- a/gamemodes/irresistible/cnr/features/player/player_settings.pwn +++ b/gamemodes/irresistible/cnr/features/player/player_settings.pwn @@ -9,7 +9,7 @@ #include < YSI\y_hooks > /* ** Definitions ** */ -#define MAX_SETTINGS ( 13 ) +#define MAX_SETTINGS ( 14 ) #define SETTING_BAILOFFERS ( 0 ) #define SETTING_EVENT_TP ( 1 ) @@ -24,13 +24,14 @@ #define SETTING_TOP_DONOR ( 10 ) #define SETTING_WEAPON_PICKUP ( 11 ) #define SETTING_PASSIVE_MODE ( 12 ) +#define SETTING_CHAT_ID ( 13 ) /* ** Variables ** */ static stock g_PlayerSettings [ MAX_SETTINGS ] [ 24 ] = { { "Prevent Bail Offers" }, { "Prevent Event Teleports" }, { "Prevent Gang Invites" }, { "Prevent Chat Prefixes" }, { "Prevent Ransom Offers" }, { "Prevent Auto-Save" }, { "Display Connection Log" }, { "Display Hitmarker" }, { "Set V.I.P Skin" }, { "Hide Total Coin Bar" }, { "Hide Last Donor Text" }, - { "Manual Pickup Weapon" }, { "Prevent Passive Mode" } + { "Manual Pickup Weapon" }, { "Prevent Passive Mode" }, { "Display Chat ID's" } }, bool: p_PlayerSettings [ MAX_PLAYERS ] [ MAX_SETTINGS char ] ; @@ -160,7 +161,7 @@ CMD:passive( playerid, params[ ] ) return 1; } -CMD:passivelist( playerid, params[ ]) +CMD:passivelist( playerid, params[ ] ) { new count = 0; @@ -187,7 +188,6 @@ stock IsPlayerSettingToggled( playerid, settingid ) { return p_PlayerSettings[ playerid ] { settingid }; } - stock IsPlayerVIPSkinToggled( playerid ) { return p_PlayerSettings[ playerid ] { SETTING_VIPSKIN }; } diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 7928e8e..8f8c9d2 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -2011,6 +2011,12 @@ public OnPlayerText( playerid, text[ ] ) } } DCC_SendChannelMessageFormatted( discordGeneralChan, "**%s(%d):** %s", ReturnPlayerName( playerid ), playerid, text ); // p_Class[ playerid ] == CLASS_POLICE ? 12 : 4 + + foreach ( new iPlayer : Player ) + { + if ( IsPlayerSettingToggled( iPlayer, SETTING_CHAT_ID ) ) + return SendClientMessageFormatted( iPlayer, GetPlayerColor( playerid ), "%s(%d): "COL_WHITE"%s", ReturnPlayerName( playerid ), playerid, text ), 0; + } return 1; } From 0bff900b1b1f89faf87a4803d313b5608caf1595 Mon Sep 17 00:00:00 2001 From: Stev Date: Wed, 26 Dec 2018 11:08:50 +0000 Subject: [PATCH 16/16] fixes the business member management (removing from business) --- .../cnr/features/business/business.pwn | 47 +++++++++++-------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/business/business.pwn b/gamemodes/irresistible/cnr/features/business/business.pwn index fd1cdd2..001fd79 100644 --- a/gamemodes/irresistible/cnr/features/business/business.pwn +++ b/gamemodes/irresistible/cnr/features/business/business.pwn @@ -1030,24 +1030,31 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) if ( listitem == 0 ) return ShowPlayerDialog( playerid, DIALOG_BUSINESS_ADD_MEMBER, DIALOG_STYLE_INPUT, ""COL_GREY"Business System", ""COL_WHITE"Type the name of the player you wish to add as a member.", "Add", "Back" ); - new memberid = g_businessMemberIndex[ playerid ][ listitem ]; + for( new i, x = 1; i < MAX_BUSINESS_MEMBERS; i ++ ) + { + if ( g_businessData[ businessid ] [ E_MEMBERS ] [ i ] ) + { + if ( x == listitem ) + { + if ( g_Debugging ) { + printf( "[business remove member] {listitem: %d, user: %d, businessid: %d}", x, g_businessData[ businessid ] [ E_MEMBERS ] [ i ], businessid ); + } + // alert player if online + foreach (new p : Player) if ( g_businessData[ businessid ] [ E_MEMBERS ] [ i ] == p_AccountID[ p ] ) { + SendServerMessage( p, "You have been removed as a member of "COL_GREY"%s"COL_WHITE".", g_businessData[ businessid ] [ E_NAME ] ); + break; + } - if ( g_businessData[ businessid ] [ E_MEMBERS ] [ memberid ] ) - { - printf( "[business remove member] {user: %d, businessid: %d}", g_businessData[ businessid ] [ E_MEMBERS ] [ memberid ], businessid ); - - // alert player if online - foreach (new p : Player) if ( g_businessData[ businessid ] [ E_MEMBERS ] [ memberid ] == p_AccountID[ p ] ) { - SendServerMessage( p, "You have been removed as a member of "COL_GREY"%s"COL_WHITE".", g_businessData[ businessid ] [ E_NAME ] ); - break; - } + // null entry + g_businessData[ businessid ] [ E_MEMBERS ] [ i ] = 0; - // null entry - g_businessData[ businessid ] [ E_MEMBERS ] [ memberid ] = 0; - - // save - UpdateBusinessData( businessid ), UpdateBusinessTitle( businessid ); - SendServerMessage( playerid, "You have removed a member from the business." ); + // save + UpdateBusinessData( businessid ), UpdateBusinessTitle( businessid ); + SendServerMessage( playerid, "You have removed a member from the business." ); + break; + } + x ++; + } } ShowBusinessMembers( playerid, businessid ); @@ -1672,6 +1679,8 @@ stock UpdateBusinessData( businessid ) for ( new i = 0; i < MAX_BUSINESS_MEMBERS; i ++ ) format( members, sizeof( members ), "%s%d ", members, g_businessData[ businessid ] [ E_MEMBERS ] [ i ] ); + print( members ); + format( szLargeString, sizeof( szLargeString ), "UPDATE `BUSINESSES` SET `OWNER_ID`=%d,`NAME`='%s',`SUPPLIES`=%d,`PRODUCT`=%d,`MEMBERS`='%s',`PROD_TIMESTAMP`=%d,`BANK`=%d,`SECURITY`=%d WHERE `ID`=%d", g_businessData[ businessid ] [ E_OWNER_ID ], mysql_escape( g_businessData[ businessid ] [ E_NAME ] ), g_businessData[ businessid ] [ E_SUPPLIES ], g_businessData[ businessid ] [ E_PRODUCT ], members, g_businessData[ businessid ] [ E_PROD_TIMESTAMP ], g_businessData[ businessid ] [ E_BANK ], g_businessData[ businessid ] [ E_SECURITY_LEVEL ], businessid ); @@ -2023,7 +2032,7 @@ stock ShowBusinessMembers( playerid, businessid ) format( szMembers, sizeof( szMembers ), "%s,%d", szMembers, g_businessData[ businessid ] [ E_MEMBERS ] [ i ] ); } - format( szBigString, sizeof( szBigString ), "SELECT `NAME` FROM `USERS` WHERE `ID` IN (%s)", szMembers ); + format( szBigString, sizeof( szBigString ), "SELECT `ID`, `NAME` FROM `USERS` WHERE `ID` IN (%s) ORDER BY `ID`", szMembers ); mysql_function_query( dbHandle, szBigString, true, "OnShowBusinessMembers", "dd", playerid, businessid ); return 1; } @@ -2031,7 +2040,7 @@ stock ShowBusinessMembers( playerid, businessid ) function OnShowBusinessMembers( playerid, businessid ) { new - count = 0, rows, fields, member[ MAX_PLAYER_NAME ]; + rows, fields, member[ MAX_PLAYER_NAME ]; cache_get_data( rows, fields ); @@ -2044,8 +2053,6 @@ function OnShowBusinessMembers( playerid, businessid ) // get member name cache_get_field_content( i, "NAME", member, sizeof( member ) ); format( szBigString, sizeof( szBigString ), "%s%s\n", szBigString, member ); - - g_businessMemberIndex[ playerid ][ count ++ ] = i; } ShowPlayerDialog( playerid, DIALOG_BUSINESS_MEMBERS, DIALOG_STYLE_LIST, ""COL_GREY"Business System", szBigString, "Kick", "Back" );