Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/enable tp on dc non vip #725

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions pawn/Entities/Players/PlayerSettings.pwn
Original file line number Diff line number Diff line change
@@ -96,16 +96,13 @@ class PlayerSettings <playerId (MAX_PLAYERS)> {

// 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 (LegacyIsUserTempAdmin(playerId))
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)
this->toggleSetting(MapTeleportationEnabledSettingKey, false);
}

18 changes: 11 additions & 7 deletions pawn/Features/Gameplay/Teleportation/TeleportationCommands.pwn
Original file line number Diff line number Diff line change
@@ -136,13 +136,14 @@ class TeleportationCommands {
*/
@switch(PlayerCommand, "teleport")
public onPlayerTeleportCommand(playerId, subjectId, params[]) {
if (playerId == subjectId && Player(playerId)->isVip() == false && Player(playerId)->isAdministrator() == 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) {
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;
}

@@ -174,6 +175,9 @@ class TeleportationCommands {
"{33AA33}enabled"));
SendClientMessage(playerId, Color::Success, message);

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;
}

4 changes: 0 additions & 4 deletions pawn/Interface/functions.pwn
Original file line number Diff line number Diff line change
@@ -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;