From dcdb331583677cf176db1e2cc88060e8df49a9e4 Mon Sep 17 00:00:00 2001 From: OttoRocket-LVP Date: Mon, 15 Jun 2020 00:23:05 +0200 Subject: [PATCH 1/6] enable TP if player is not VIP and disconnects --- pawn/Entities/Players/PlayerSettings.pwn | 2 +- pawn/Interface/functions.pwn | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/pawn/Entities/Players/PlayerSettings.pwn b/pawn/Entities/Players/PlayerSettings.pwn index 727b3b48d..3badb8bec 100644 --- a/pawn/Entities/Players/PlayerSettings.pwn +++ b/pawn/Entities/Players/PlayerSettings.pwn @@ -105,7 +105,7 @@ class PlayerSettings { */ @list(OnPlayerDisconnect) public restoreOnDisconnect() { - if (LegacyIsUserTempAdmin(playerId)) + if (Player(playerId)->isVip() == false) this->toggleSetting(MapTeleportationEnabledSettingKey, false); } diff --git a/pawn/Interface/functions.pwn b/pawn/Interface/functions.pwn index 0a45d07ac..bc4f263b6 100644 --- a/pawn/Interface/functions.pwn +++ b/pawn/Interface/functions.pwn @@ -34,10 +34,6 @@ LegacySetValidKillerVariables(forPlayerId, killerId, reasonId) { validReasonId[forPlayerId] = reasonId; } -bool: LegacyIsUserTempAdmin(playerId) { - return tempLevel[playerId] > 0; -} - RemovePlayerFromAnyGame(playerId) { if (Player(playerId)->isConnected() == false) return 0; From 7ab0227072ecfaece9fac7bffe139ba10d4e5579 Mon Sep 17 00:00:00 2001 From: OttoRocket-LVP Date: Mon, 15 Jun 2020 00:33:13 +0200 Subject: [PATCH 2/6] enable tp and disable maptp upon connect if player is not supposed to have it --- pawn/Entities/Players/PlayerSettings.pwn | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/pawn/Entities/Players/PlayerSettings.pwn b/pawn/Entities/Players/PlayerSettings.pwn index 3badb8bec..db5ba3407 100644 --- a/pawn/Entities/Players/PlayerSettings.pwn +++ b/pawn/Entities/Players/PlayerSettings.pwn @@ -96,16 +96,11 @@ class PlayerSettings { // TODO: Add individual settings which should be enabled by default here. this->toggleSetting(AccountUpdatedForSettingsSettingKey, true); - } - /** - * Restores any settings which were altered at giving tempadmin. Each setting will default to - * what they should be for a normal player. It will automatically be invoked when a player - * disconnects from Las Venturas Playground. - */ - @list(OnPlayerDisconnect) - public restoreOnDisconnect() { - if (Player(playerId)->isVip() == false) + if(Player(playerId)->isVip() == false && Player(playerId)->isAdministrator() == false) + this->setTeleportationDisabled(false); + + if(Player(playerId)->isAdministrator() == false) this->toggleSetting(MapTeleportationEnabledSettingKey, false); } From a5987507c586e3b2bc9963c4920608196eb31f9b Mon Sep 17 00:00:00 2001 From: OttoRocket-LVP Date: Mon, 15 Jun 2020 00:44:53 +0200 Subject: [PATCH 3/6] enable TP toggling for non regulars --- .../Gameplay/Teleportation/TeleportationCommands.pwn | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pawn/Features/Gameplay/Teleportation/TeleportationCommands.pwn b/pawn/Features/Gameplay/Teleportation/TeleportationCommands.pwn index b32ff3edb..a40a690e1 100644 --- a/pawn/Features/Gameplay/Teleportation/TeleportationCommands.pwn +++ b/pawn/Features/Gameplay/Teleportation/TeleportationCommands.pwn @@ -136,12 +136,14 @@ class TeleportationCommands { */ @switch(PlayerCommand, "teleport") public onPlayerTeleportCommand(playerId, subjectId, params[]) { - if (playerId == subjectId && Player(playerId)->isVip() == false && Player(playerId)->isAdministrator() == false) { + if (playerId == subjectId && Player(playerId)->isVip() == false && Player(playerId)->isAdministrator() == false + && (Player(playerId)->isRegular() == true || Player(playerId)->isRegistered() == false)) { SendClientMessage(playerId, Color::Error, "This is a VIP only command. For more information, check out \"/donate\"!"); return 1; } - if (playerId != subjectId && Player(subjectId)->isVip() == false) { + if (playerId != subjectId && Player(subjectId)->isVip() == false + && (Player(playerId)->isRegular() == true || Player(playerId)->isRegistered() == false)) { SendClientMessage(playerId, Color::Error, "Error: This player has no VIP status."); return 1; } @@ -174,6 +176,10 @@ class TeleportationCommands { "{33AA33}enabled")); SendClientMessage(playerId, Color::Success, message); + if(playerId == subjectId && Player(playerId)->isRegular() == false && + Player(playerId)->isVip() == false && Player(playerId)->isAdministrator() == false) + SendClientMessage(playerId, Color::Information, "This is a VIP only command but enabled for new players. check out \"/donate\"!"); + return 1; } From 9e79673a43df8b4cc61d62fcc9d3681ef34abd9e Mon Sep 17 00:00:00 2001 From: OttoRocket-LVP Date: Fri, 19 Jun 2020 22:36:29 +0200 Subject: [PATCH 4/6] simplify the if statements a bit. And screw admin perks. --- .../Teleportation/TeleportationCommands.pwn | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/pawn/Features/Gameplay/Teleportation/TeleportationCommands.pwn b/pawn/Features/Gameplay/Teleportation/TeleportationCommands.pwn index a40a690e1..8bb18d6a4 100644 --- a/pawn/Features/Gameplay/Teleportation/TeleportationCommands.pwn +++ b/pawn/Features/Gameplay/Teleportation/TeleportationCommands.pwn @@ -136,15 +136,14 @@ class TeleportationCommands { */ @switch(PlayerCommand, "teleport") public onPlayerTeleportCommand(playerId, subjectId, params[]) { - if (playerId == subjectId && Player(playerId)->isVip() == false && Player(playerId)->isAdministrator() == false - && (Player(playerId)->isRegular() == true || Player(playerId)->isRegistered() == false)) { - SendClientMessage(playerId, Color::Error, "This is a VIP only command. For more information, check out \"/donate\"!"); - return 1; - } - - if (playerId != subjectId && Player(subjectId)->isVip() == false - && (Player(playerId)->isRegular() == true || Player(playerId)->isRegistered() == false)) { - SendClientMessage(playerId, Color::Error, "Error: This player has no VIP status."); + new const bool: isNoRegularButRegistered = Player(playerId)->isRegular() == false && + Player(playerId)->isRegistered() == true; + + if (Player(playerId)->isVip() == false && isNoRegularButRegistered == false) { + if(playerId == subjectId) + SendClientMessage(playerId, Color::Error, "This is a VIP only command. For more information, check out \"/donate\"!"); + else + SendClientMessage(playerId, Color::Error, "Error: This player has no VIP status."); return 1; } @@ -176,8 +175,7 @@ class TeleportationCommands { "{33AA33}enabled")); SendClientMessage(playerId, Color::Success, message); - if(playerId == subjectId && Player(playerId)->isRegular() == false && - Player(playerId)->isVip() == false && Player(playerId)->isAdministrator() == false) + if(playerId == subjectId && Player(playerId)->isVip() == false && isNoRegularButRegistered == true ) SendClientMessage(playerId, Color::Information, "This is a VIP only command but enabled for new players. check out \"/donate\"!"); return 1; From 03a80cee91e80906395f24b703ca451b1cb92020 Mon Sep 17 00:00:00 2001 From: OttoRocket-LVP Date: Fri, 19 Jun 2020 22:39:50 +0200 Subject: [PATCH 5/6] screw admin perks v2 --- pawn/Entities/Players/PlayerSettings.pwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pawn/Entities/Players/PlayerSettings.pwn b/pawn/Entities/Players/PlayerSettings.pwn index db5ba3407..1430f7615 100644 --- a/pawn/Entities/Players/PlayerSettings.pwn +++ b/pawn/Entities/Players/PlayerSettings.pwn @@ -97,7 +97,7 @@ class PlayerSettings { // TODO: Add individual settings which should be enabled by default here. this->toggleSetting(AccountUpdatedForSettingsSettingKey, true); - if(Player(playerId)->isVip() == false && Player(playerId)->isAdministrator() == false) + if(Player(playerId)->isVip() == false) this->setTeleportationDisabled(false); if(Player(playerId)->isAdministrator() == false) From 21a23b6de84b61523489bd8c252b50be10d6444c Mon Sep 17 00:00:00 2001 From: OttoRocket-LVP Date: Fri, 19 Jun 2020 22:41:45 +0200 Subject: [PATCH 6/6] Go newbie perks --- pawn/Entities/Players/PlayerSettings.pwn | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pawn/Entities/Players/PlayerSettings.pwn b/pawn/Entities/Players/PlayerSettings.pwn index 1430f7615..752fb9ff6 100644 --- a/pawn/Entities/Players/PlayerSettings.pwn +++ b/pawn/Entities/Players/PlayerSettings.pwn @@ -97,7 +97,9 @@ class PlayerSettings { // TODO: Add individual settings which should be enabled by default here. this->toggleSetting(AccountUpdatedForSettingsSettingKey, true); - if(Player(playerId)->isVip() == false) + new const bool: isNoRegularButRegistered = Player(playerId)->isRegular() == false && + Player(playerId)->isRegistered() == true; + if(Player(playerId)->isVip() == false && isNoRegularButRegistered == false) this->setTeleportationDisabled(false); if(Player(playerId)->isAdministrator() == false)