Skip to content

Commit 901676a

Browse files
Fix +ophax disabling hacks in MOTD, add +/-thirdperson to MOTD, -ophax disables hacks for staff, -/+ophax only applies when player is staff
1 parent 6ff0e68 commit 901676a

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

fCraft/Player/PlayerHacks.cs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,47 @@ namespace fCraft {
55
public static class PlayerHacks {
66

77
public static Packet MakePacket(Player p, string motd) {
8-
bool canFly = true, canNoClip = true, canSpeed = true, canRespawn = true;
8+
bool canFly = true, canNoClip = true, canSpeed = true, canRespawn = true, canThird = true;
99
short jumpHeight = -1;
1010
bool useMotd = GetHacksFromMotd(p, motd, ref canFly, ref canNoClip,
11-
ref canSpeed, ref canRespawn, ref jumpHeight);
11+
ref canSpeed, ref canRespawn, ref canThird, ref jumpHeight);
1212

1313
if (useMotd)
14-
return Packet.HackControl(canFly, canNoClip, canSpeed, canRespawn, canNoClip, jumpHeight);
14+
return Packet.HackControl(canFly, canNoClip, canSpeed, canRespawn, canThird, jumpHeight);
1515

1616
return Packet.HackControl(p.Info.AllowFlying, p.Info.AllowNoClip, p.Info.AllowSpeedhack,
1717
p.Info.AllowRespawn, p.Info.AllowThirdPerson, p.Info.JumpHeight);
1818
}
1919

2020
static bool GetHacksFromMotd(Player p, string motd, ref bool fly, ref bool noclip,
21-
ref bool speed, ref bool respawn, ref short jumpHeight) {
21+
ref bool speed, ref bool respawn, ref bool third, ref short jumpHeight) {
2222
if (String.IsNullOrEmpty(motd)) return false;
2323
bool useMotd = false;
2424

2525
foreach (string part in motd.ToLower().Split()) {
2626
if (part == "-fly" || part == "+fly") {
27-
fly = part == "+fly";
27+
fly = part == "+fly";
2828
} else if (part == "-noclip" || part == "+noclip") {
29-
noclip = part == "+noclip";
29+
noclip = part == "+noclip";
3030
} else if (part == "-speed" || part == "+speed") {
31-
speed = part == "+speed";
31+
speed = part == "+speed";
3232
} else if (part == "-respawn" || part == "+respawn") {
3333
respawn = part == "+respawn";
34-
} else if (part == "-hax" || part == "+ophax") {
35-
fly = part == "+hax";
36-
noclip = part == "+hax";
37-
speed = part == "+hax";
34+
} else if (part == "-thirdperson" || part == "+thirdperson") {
35+
third = part == "+thirdperson";
36+
} else if (part == "-hax" || part == "+hax") {
37+
fly = part == "+hax";
38+
noclip = part == "+hax";
39+
speed = part == "+hax";
3840
respawn = part == "+hax";
41+
third = part == "+hax";
3942
} else if (part == "-ophax" || part == "+ophax") {
40-
fly = p.IsStaff;
41-
noclip = p.IsStaff;
42-
speed = p.IsStaff;
43-
respawn = p.IsStaff;
43+
if (!p.IsStaff) { useMotd = true; continue; }
44+
fly = part == "+ophax";
45+
noclip = part == "+ophax";
46+
speed = part == "+ophax";
47+
respawn = part == "+ophax";
48+
third = part == "+ophax";
4449
} else if (part.StartsWith("jumpheight=")) {
4550
string heightPart = part.Substring(part.IndexOf('=') + 1);
4651
float value;

0 commit comments

Comments
 (0)