Handsup: Nur noch möglich, wenn man still steht

This commit is contained in:
hydrant
2021-04-22 13:52:05 +02:00
parent be5dc8c8ca
commit e669425dd8
6 changed files with 32 additions and 5 deletions

View File

@@ -0,0 +1,13 @@
export default function handsup() {
mp.events.add("SERVER:Handsup_CheckIfPlayerCanHandsup", () => {
var player = mp.players.local;
var isStopped = player.isStopped();
mp.gui.chat.push("isStopped = " + isStopped);
if (isStopped) {
mp.events.callRemote("CLIENT:Handsup_TogglePlayerHup");
}
});
}

View File

@@ -265,6 +265,9 @@ antiAfk(globalData);
import ammunation from './Interaction/ammunation/ammunation';
ammunation(globalData);
import handsup from './Player/handsup';
handsup();
require('./Gui/policedepartment');
require('./Gui/helptext');
require('./admin/spectate');

View File

@@ -135,7 +135,7 @@ namespace ReallifeGamemode.Server.Commands
[Command("hup")]
public void CmdUserHup(Player player)
{
player.ToggleSurrender();
player.CheckToggleSurrender();
}
[Command("event", "~m~Benutzung: ~s~/event [Nachricht]", GreedyArg = true)]

View File

@@ -904,7 +904,7 @@ namespace ReallifeGamemode.Server.Events
[RemoteEvent("keyPress:ControllH")]
public void KeyPressControllH(Player player)
{
player.ToggleSurrender();
player.CheckToggleSurrender();
}
#endregion User Key

View File

@@ -24,5 +24,11 @@ namespace ReallifeGamemode.Server.Events
player.SendNotification("Du wurdest ~b~AFK~s~ gesetzt", true);
}
}
[RemoteEvent("CLIENT:Handsup_TogglePlayerHup")]
public void PlayerToggleHandsupEvent(Player player)
{
player.ToggleSurrender();
}
}
}

View File

@@ -138,7 +138,7 @@ namespace ReallifeGamemode.Server.Extensions
public static bool IsAfk(this Player player)
{
if(!player.HasSharedData("isAfk"))
if (!player.HasSharedData("isAfk"))
{
return false;
}
@@ -339,7 +339,7 @@ namespace ReallifeGamemode.Server.Extensions
int nameTagColor = 0;
Player player = user.Player;
if(player == null || !player.IsLoggedIn())
if (player == null || !player.IsLoggedIn())
{
return;
}
@@ -347,7 +347,7 @@ namespace ReallifeGamemode.Server.Extensions
bool duty = user.GetData<bool>("duty");
bool adminUnshow = user.GetData<bool>("adminUnshow");
if(adminUnshow)
if (adminUnshow)
{
blipColor = -1;
nameTagColor = -3;
@@ -437,6 +437,11 @@ namespace ReallifeGamemode.Server.Extensions
}
}
public static void CheckToggleSurrender(this Player player)
{
player.TriggerEvent("SERVER:Handsup_CheckIfPlayerCanHandsup");
}
public static void ToggleSurrender(this Player player)
{
if (player.HasAnimation("hup"))