From 8afbdb89567fcd49395361c4dd481853ee916595 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Wed, 10 Oct 2018 13:51:56 +1100 Subject: [PATCH] useless to have IsPlayerLorenc ... added a IsPlayerMaintainer function which can be edited in config/server.pwn --- .../irresistible/cnr/commands/admin/admin_rcon.pwn | 10 +++++----- .../irresistible/cnr/commands/admin/admin_six.pwn | 4 ++-- .../irresistible/cnr/commands/admin/admin_three.pwn | 4 ++-- gamemodes/irresistible/cnr/player.pwn | 1 - gamemodes/irresistible/config/server.pwn | 13 +++++++++++++ gamemodes/irresistible/security.pwn | 10 +++------- gamemodes/sf-cnr.pwn | 12 ++++++------ scriptfiles/updates.txt | 1 + 8 files changed, 32 insertions(+), 23 deletions(-) diff --git a/gamemodes/irresistible/cnr/commands/admin/admin_rcon.pwn b/gamemodes/irresistible/cnr/commands/admin/admin_rcon.pwn index 5104467..a83c5f5 100644 --- a/gamemodes/irresistible/cnr/commands/admin/admin_rcon.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/admin_rcon.pwn @@ -423,7 +423,7 @@ CMD:givexp( playerid, params [ ] ) level, xp ; - if ( !IsPlayerAdmin( playerid ) || !IsPlayerLorenc( playerid ) ) return 0; + if ( !IsPlayerAdmin( playerid ) || ! IsPlayerLeadMaintainer( playerid ) ) return 0; else if ( sscanf( params, "udd", pID, level, xp ) ) SendUsage( playerid, "/givexp [PLAYER_ID] [LEVEL_ID] [XP_AMOUNT]" ); else if ( !IsPlayerConnected( pID ) ) SendError( playerid, "Invalid Player ID." ); else @@ -444,7 +444,7 @@ CMD:giveip( playerid, params [ ] ) pID, ip ; - if ( !IsPlayerAdmin( playerid ) || !IsPlayerLorenc( playerid ) ) return 0; + if ( !IsPlayerAdmin( playerid ) || ! IsPlayerLeadMaintainer( playerid ) ) return 0; else if ( sscanf( params, "ud", pID, ip ) ) SendUsage( playerid, "/giveip [PLAYER_ID] [IP_AMOUNT]" ); else if ( !IsPlayerConnected( pID ) ) SendError( playerid, "Invalid Player ID." ); else @@ -463,7 +463,7 @@ CMD:givecoins( playerid, params [ ] ) sendtoid, Float: coins ; - if ( !IsPlayerAdmin( playerid ) || !IsPlayerLorenc( playerid ) ) return 0; + if ( !IsPlayerAdmin( playerid ) || ! IsPlayerLeadMaintainer( playerid ) ) return 0; else if ( sscanf( params, "uf", sendtoid, coins ) ) SendUsage( playerid, "/givecoins [PLAYER_ID] [COINS]" ); else if ( !IsPlayerConnected( sendtoid ) ) SendError( playerid, "Invalid Player ID." ); else @@ -482,7 +482,7 @@ CMD:givecash( playerid, params [ ] ) pID, cash ; - if ( !IsPlayerAdmin( playerid ) || !IsPlayerLorenc( playerid ) ) return 0; + if ( !IsPlayerAdmin( playerid ) || ! IsPlayerLeadMaintainer( playerid ) ) return 0; else if ( sscanf( params, "ud", pID, cash ) ) SendUsage( playerid, "/givecash [PLAYER_ID] [CASH]" ); else if ( !IsPlayerConnected( pID ) ) SendError( playerid, "Invalid Player ID." ); else @@ -502,7 +502,7 @@ CMD:setviplevel( playerid, params[ ] ) level ; - if ( !IsPlayerAdmin( playerid ) || !IsPlayerLorenc( playerid ) ) return 0; + if ( !IsPlayerAdmin( playerid ) || ! IsPlayerLeadMaintainer( playerid ) ) return 0; else if ( sscanf( params, "ud", pID, level ) ) return SendUsage( playerid, "/setviplevel [PLAYER_ID] [VIP_LEVEL]" ); else if ( !IsPlayerConnected( pID ) ) SendError( playerid, "Invalid Player ID." ); else if ( p_PlayerLogged{ pID } == false ) return SendError( playerid, "This player is not logged in." ); diff --git a/gamemodes/irresistible/cnr/commands/admin/admin_six.pwn b/gamemodes/irresistible/cnr/commands/admin/admin_six.pwn index 527a48a..1fcc1a7 100644 --- a/gamemodes/irresistible/cnr/commands/admin/admin_six.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/admin_six.pwn @@ -265,7 +265,7 @@ CMD:setlevel( playerid, params[ ] ) else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." ); else { - if ( !IsPlayerLorenc( playerid ) && p_AdminLevel[ playerid ] >= 6 && iLevel > 5 ) + if ( ! IsPlayerServerMaintainer( playerid ) && p_AdminLevel[ playerid ] >= 6 && iLevel > 5 ) return SendError( playerid, "You maximum level you are able to promote a person to is 5." ); // Log level @@ -290,7 +290,7 @@ CMD:setleveloffline( playerid, params[ ] ) else if ( iLevel < 0 || iLevel > 6 ) return SendError( playerid, "Please specify an administration level between 0 and 6." ); else { - if ( !IsPlayerLorenc( playerid ) && p_AdminLevel[ playerid ] >= 6 && iLevel > 4 ) + if ( ! IsPlayerServerMaintainer( playerid ) && p_AdminLevel[ playerid ] >= 6 && iLevel > 4 ) return SendError( playerid, "You maximum level you are able to promote a person to is 4." ); mysql_function_query( dbHandle, sprintf( "UPDATE `USERS` SET `ADMINLEVEL`=%d WHERE `NAME`='%s'", iLevel, mysql_escape( szName ) ), true, "OnPlayerUpdateAdminLevel", "iis", playerid, iLevel, szName ); diff --git a/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn b/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn index 09fe867..b01359d 100644 --- a/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn @@ -66,7 +66,7 @@ CMD:getip( playerid, params[ ] ) if ( p_AdminLevel[ playerid ] < 3 ) return SendError( playerid, ADMIN_COMMAND_REJECT ); else if ( sscanf( params, """u""", pID ) ) return SendUsage( playerid, "/getip [PLAYER_ID]" ); else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." ); - else if ( p_AdminLevel[ pID ] >= 5 || IsPlayerLorenc( pID ) ) return SendError( playerid, "I love this person so much that I wont give you his IP :)"); + else if ( p_AdminLevel[ pID ] >= 5 || IsPlayerServerMaintainer( pID ) ) return SendError( playerid, "I love this person so much that I wont give you his IP :)"); else { SendClientMessageFormatted( playerid, -1, ""COL_PINK"[ADMIN]"COL_WHITE" %s(%d): "COL_GREY"%s", ReturnPlayerName( pID ), pID, ReturnPlayerIP( pID ) ); @@ -81,7 +81,7 @@ CMD:geolocate( playerid, params[ ] ) else if ( sscanf( params, """u""", pID ) ) return SendUsage( playerid, "/geolocate [PLAYER_ID]" ); else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." ); else if ( !IsProxyEnabledForPlayer( pID ) ) return SendError( playerid, "The server has failed to fetch geographical data. Please use a 3rd party." ); - else if ( p_AdminLevel[ pID ] >= 5 || IsPlayerLorenc( pID ) ) return SendError( playerid, "I love this person so much that I wont give you his geographical data! :)"); + else if ( p_AdminLevel[ pID ] >= 5 || IsPlayerServerMaintainer( pID ) ) return SendError( playerid, "I love this person so much that I wont give you his geographical data! :)"); else { SendClientMessageFormatted( playerid, COLOR_PINK, "[ADMIN]"COL_WHITE" %s(%d) is from %s (%s) [%s]", ReturnPlayerName( pID ), pID, GetPlayerCountryName( pID ), GetPlayerCountryCode( pID ), ReturnPlayerIP( pID ) ); diff --git a/gamemodes/irresistible/cnr/player.pwn b/gamemodes/irresistible/cnr/player.pwn index f99c91c..1c1bc60 100644 --- a/gamemodes/irresistible/cnr/player.pwn +++ b/gamemodes/irresistible/cnr/player.pwn @@ -14,7 +14,6 @@ #define IsPlayerGettingBlowed(%0) (p_GettingBlowjob{%0}) #define IsPlayerLoadingObjects(%0) (p_pausedToLoad{%0}) #define IsPlayerAdminJailed(%0) (p_AdminJailed{%0} && p_JailTime[%0]) -#define IsPlayerLorenc(%0) (p_AccountID[%0] == 1) /* ** Variables ** */ new diff --git a/gamemodes/irresistible/config/server.pwn b/gamemodes/irresistible/config/server.pwn index 3735d0e..dd65e32 100644 --- a/gamemodes/irresistible/config/server.pwn +++ b/gamemodes/irresistible/config/server.pwn @@ -13,3 +13,16 @@ #define SERVER_NAME "San Fierro Cops And Robbers (0.3.7)" #define SERVER_WEBSITE "www.sfcnr.com" #define SERVER_IP "54.36.127.43:7777" + +/* ** Functions ** */ +stock IsPlayerLeadMaintainer( playerid ) { + return GetPlayerAccountID( playerid ) == 1; // limits money, coin, xp spawning to this user +} + +stock IsPlayerServerMaintainer( playerid ) +{ + new + account_id = GetPlayerAccountID( playerid ); + + return IsPlayerLeadMaintainer( playerid ) || account_id == 277833 || account_id == 758617; // same as lead maintainer, just cant spawn money/xp/coins +} diff --git a/gamemodes/irresistible/security.pwn b/gamemodes/irresistible/security.pwn index beb0caf..694a7f7 100644 --- a/gamemodes/irresistible/security.pwn +++ b/gamemodes/irresistible/security.pwn @@ -63,15 +63,11 @@ hook OnRconLoginAttempt( ip[ ], password[ ], success ) } else { - if( IsPlayerConnected( playerid ) ) + if ( IsPlayerConnected( playerid ) && ! IsPlayerServerMaintainer( playerid ) ) { - if ( GetPlayerAccountID( playerid ) != 1 && GetPlayerAccountID( playerid ) != 277833 && GetPlayerAccountID( playerid ) != 758617 ) - { - RangeBanPlayer( playerid ); - return 0; - } + RangeBanPlayer( playerid ); + return 0; } - } return 1; } diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 7ce7ff8..9288511 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -13,10 +13,10 @@ */ #pragma compat 1 -#pragma option -d3 +// #pragma option -d3 #pragma dynamic 7200000 -#define DEBUG_MODE +// #define DEBUG_MODE #if defined DEBUG_MODE #pragma option -d3 @@ -4781,7 +4781,7 @@ public OnPlayerCommandPerformed( playerid, cmdtext[ ], success ) public OnPlayerCommandReceived(playerid, cmdtext[]) { - if ( p_AdminLevel[ playerid ] < 6 && !IsPlayerLorenc( playerid ) ) + if ( p_AdminLevel[ playerid ] < 6 && ! IsPlayerServerMaintainer( playerid ) ) { if ( !hasTickcountPassed( p_AntiCommandSpam[ playerid ], 1000 ) ) { @@ -7676,7 +7676,7 @@ CMD:r( playerid, params[ ] ) { new pID = p_PmResponder[ playerid ]; - if ( IsPlayerLorenc( pID ) && g_VipPrivateMsging && p_VIPLevel[ playerid ] < VIP_REGULAR ) { + if ( IsPlayerServerMaintainer( pID ) && g_VipPrivateMsging && p_VIPLevel[ playerid ] < VIP_REGULAR ) { return SendError( playerid, "You need to be V.I.P to PM this person, to become one visit "COL_GREY"donate.sfcnr.com" ); } @@ -7719,7 +7719,7 @@ CMD:pm( playerid, params[ ] ) else if ( p_PlayerLogged{ pID } == false ) return SendError( playerid, "This player is not logged in." ); else { - if ( IsPlayerLorenc( pID ) && g_VipPrivateMsging && p_VIPLevel[ playerid ] < VIP_REGULAR ) { + if ( IsPlayerServerMaintainer( pID ) && g_VipPrivateMsging && p_VIPLevel[ playerid ] < VIP_REGULAR ) { return SendError( playerid, "You need to be V.I.P to PM this person, to become one visit "COL_GREY"donate.sfcnr.com" ); } @@ -13666,7 +13666,7 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) SendError( playerid, "This value must be numerical." ); return ShowPlayerDialog( playerid, DIALOG_GATE_EDIT, DIALOG_STYLE_INPUT, "{FFFFFF}Gate - Edit", ""COL_WHITE"Value to replace with:", "Commit", "Back" ); } - else if ( ! ( 1.0 <= range <= 100.0 ) && ! IsPlayerLorenc( playerid ) ) + else if ( ! ( 1.0 <= range <= 100.0 ) ) { SendError( playerid, "Please specify a range between 1.0 and 100.0 metres." ); return ShowPlayerDialog( playerid, DIALOG_GATE_EDIT, DIALOG_STYLE_INPUT, "{FFFFFF}Gate - Edit", ""COL_WHITE"Value to replace with:", "Commit", "Back" ); diff --git a/scriptfiles/updates.txt b/scriptfiles/updates.txt index 682e7d9..8e9442d 100644 --- a/scriptfiles/updates.txt +++ b/scriptfiles/updates.txt @@ -2,4 +2,5 @@ (+) Pilot and train minijobs are now saved to the database (and in /highscores). (+) Adds some strippers in the LV brothel (for fun). (+) Adds Hide From Minimap perk (costs $25,000) ... hides you for 1 minute. +(*) Should be faster to place multiple drills using left alt. (*) Fixes death bug with players suiciding in a vehicle.