fixed /aspeed

This commit is contained in:
hydrant
2019-05-09 14:46:26 +02:00
parent 2c63278aa3
commit 2e44024bdd
4 changed files with 14 additions and 3 deletions

View File

@@ -0,0 +1,8 @@
export default function () {
mp.events.addDataHandler("vehicleAdminSpeed", (entity, newValue) => {
mp.gui.chat.push("datahandler event");
if (!entity.isAVehicle()) return;
mp.gui.chat.push("newValue = " + newValue.toString())
entity.setEnginePowerMultiplier(newValue);
});
}

View File

@@ -12,6 +12,9 @@ let globalData: GlobalData = {
LoggedIn: false LoggedIn: false
}; };
import adminSpeed from './admin/aspeed';
adminSpeed();
import voice from './Voice/main'; import voice from './Voice/main';
voice(globalData); voice(globalData);

View File

@@ -2037,7 +2037,7 @@ namespace ReallifeGamemode.Server.Commands
} }
[Command("aspeed", "~m~Benutzung: ~s~/aspeed [Modifier]")] //TODO: Überarbeiten ?? SetPlayerVelocity ?? [Command("aspeed", "~m~Benutzung: ~s~/aspeed [Modifier]")] //TODO: Überarbeiten ?? SetPlayerVelocity ??
public void CmdAdminAspeed(Client player, float modifier) public void CmdAdminAspeed(Client player, int modifier)
{ {
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true) if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
{ {
@@ -2051,7 +2051,7 @@ namespace ReallifeGamemode.Server.Commands
return; return;
} }
player.Vehicle.EnginePowerMultiplier = modifier; player.Vehicle.SetSharedData("vehicleAdminSpeed", modifier);
} }
[Command("setmoney", "~m~Benutzung: ~s~/setmoney [Name] [Menge]")] [Command("setmoney", "~m~Benutzung: ~s~/setmoney [Name] [Menge]")]

View File

@@ -83,7 +83,7 @@ namespace ReallifeGamemode.Server.Managers
Vector3 lastPosition = v.Position; Vector3 lastPosition = v.Position;
if (lastPositions.ContainsKey(v.Handle)) lastPosition = lastPositions[v.Handle]; if (lastPositions.ContainsKey(v.Handle)) lastPosition = lastPositions[v.Handle];
double distanceDriven = v.HasSharedData("drivenDistance") ? v.GetSharedData("drivenDistance") : 0D; double distanceDriven = v.HasSharedData("drivenDistance") ? (double)v.GetSharedData("drivenDistance") : 0D;
distanceDriven += (lastPosition.DistanceTo(v.Position) / 1000.0); distanceDriven += (lastPosition.DistanceTo(v.Position) / 1000.0);