Testserver push

This commit is contained in:
2021-04-07 01:08:22 +02:00
parent e34cd3bd01
commit 52bb80a70a
9 changed files with 70 additions and 61 deletions

View File

@@ -1,7 +1,6 @@
import { IGame, IEntity } from "../game";
import game from "..";
const maxDistance = 40 * 40;
const width = 0.03;
const height = 0.0065;
@@ -27,9 +26,7 @@ const colors = [
{ id: 9, color: [0, 166, 133, alpha] }, //news
];
export default function customNametags() {
mp.nametags.enabled = false;
mp.events.add('render', (nametags) => {
@@ -67,19 +64,19 @@ export default function customNametags() {
let y2 = y + 0.042;
if (armour > 0) {
graphics.drawRect(x, y2, width + border * 2, height + border * 2, 0 , 0, 0, 200);
graphics.drawRect(x, y2, width, height, 150, 150, 150, 255);
graphics.drawRect(x, y2, width + border * 2, height + border * 2, 0, 0, 0, 200);
graphics.drawRect(x, y2, width, height, 50, 0, 0, 255);
graphics.drawRect(x - width / 2 * (1 - health), y2, width * health, height, 200, 0, 0, 200);
var x2 = x + width / 2 + border / 2;
graphics.drawRect(x, y2 + height, width + border * 2, height + border * 2, 0, 0, 0, 200);
graphics.drawRect(x, y2 + height, width, height, 200, 200, 200, 255);
graphics.drawRect(x, y2 + height, width, height, 80, 80, 80, 255);
graphics.drawRect(x - width / 2 * (1 - armour), y2 + height, width * armour, height, 255, 255, 255, 200);
}
else {
graphics.drawRect(x, y2, width + border * 2, height + border * 2, 0, 0, 0, 200);
graphics.drawRect(x, y2, width, height, 150, 150, 150, 255);
graphics.drawRect(x, y2, width, height, 50, 0, 0, 255);
graphics.drawRect(x - width / 2 * (1 - health), y2, width * health, height, 200, 0, 0, 200);
}
}

View File

@@ -6,11 +6,9 @@
//https://docs.microsoft.com/de-de/windows/desktop/inputdev/virtual-key-codes
const player = mp.players.local;
export default function keys(globalData: IGlobalData) {
var showGui = true;
//ENTER
@@ -73,7 +71,6 @@ export default function keys(globalData: IGlobalData) {
}
});
//I //Inventar
mp.keys.bind(0x49, false, function () {
if (!globalData.InChat && !globalData.InTuning) {
@@ -83,7 +80,7 @@ export default function keys(globalData: IGlobalData) {
//O //Spielerliste
mp.keys.bind(0x4F, true, function () {
if (!globalData.InChat && !globalData.InTuning ) {
if (!globalData.InChat && !globalData.InTuning) {
mp.events.callRemote("keyPress:O");
//mp.events.call("showPlayerlist");
}
@@ -143,9 +140,16 @@ export default function keys(globalData: IGlobalData) {
mp.gui.takeScreenshot(new Date().toLocaleDateString(), 1, 100, 80);
});
//H
mp.keys.bind(0x48, false, function () {
if (mp.keys.isDown(0x11)) { //CTRL
mp.events.call("keyPress:ControllH"); //hup
return;
}
});
//F2 //Noclip
mp.keys.bind(0x71, false, () => {
mp.events.callRemote("Noclip");
mp.events.callRemote("Noclip");
});
}

View File

@@ -7,6 +7,8 @@
animationSyncData.register("getArrest", "mp_arrest_paired", "crook_p2_back_right", 3760, false, 0);
animationSyncData.register("doUncuff", "mp_arresting", "a_uncuff", 5500, false, 0);
animationSyncData.register("getUncuff", "mp_arresting", "b_uncuff", 5500, false, 0);
animationSyncData.register("hup", "mp_am_hold_up", "handsup_base", -1, true, 50);
animationSyncData.register("carryBox", "anim@heists@box_carry@", "idle", -1, true, 50);
});
const animationSyncData =

View File

@@ -16,14 +16,12 @@ namespace ReallifeGamemode.Server.Commands
{
internal class UserCommands : Script
{
[Command("skill")]
public void CmdUserSkill(Player player)
{
User user = player.GetUser(new DatabaseContext());
player.SendChatMessage($"~c~BusSkill = {user.BusSkill}/800, PilotSkill = {user.PilotSkill}/300.");
}
[Command("id", "~m~Benutzung: ~s~/id [Name]")]
@@ -34,7 +32,8 @@ namespace ReallifeGamemode.Server.Commands
if (target == null)
{
player.SendChatMessage("~c~Spieler ist nicht online.");
} else
}
else
{
player.SendChatMessage("~c~ID: (" + target.Id + ") " + target.Name);
}
@@ -90,6 +89,7 @@ namespace ReallifeGamemode.Server.Commands
ChatService.SendMessage(player, "~m~" + ((VehicleHash)pVeh.Model) + " | Farbe 1: " + pVeh.PrimaryColor + " | Farbe 2: " + pVeh.SecondaryColor + " | ID: " + pVeh.Handle.Value);
}
}
[Command("help", "~m~Benutzung: ~s~/help")]
public void CmdHelp(Player player)
{
@@ -106,8 +106,10 @@ namespace ReallifeGamemode.Server.Commands
[Command("hup")]
public void CmdAnim(Player player)
{
player.StopAnimation();
player.PlayAnimation("mp_am_hold_up", "handsup_base", (int)(AnimationFlags.Loop | AnimationFlags.OnlyAnimateUpperBody | AnimationFlags.AllowPlayerControl | AnimationFlags.Cancellable));
if (player.HasAnimation())
return;
player.SyncAnimation("hup");
ChatService.SendInRange(player.Position, 20, $"~m~{player.Name} stellt sich...");
}
@@ -119,9 +121,7 @@ namespace ReallifeGamemode.Server.Commands
ChatService.NotAuthorized(player);
return;
}
ChatService.BroadcastFaction("~b~[Event] " + player.Name + ": " + msg, new List<int>() { 9 }) ;
ChatService.BroadcastFaction("~b~[Event] " + player.Name + ": " + msg, new List<int>() { 9 });
}
}
}

View File

@@ -30,6 +30,7 @@ namespace ReallifeGamemode.Server.Events
public class Key : Script
{
#region User Key
[RemoteEvent("keyPress:NUM2")]
public void KeyPressNUM2(Player player)
{
@@ -60,6 +61,7 @@ namespace ReallifeGamemode.Server.Events
GroundItem.PickUpGroundItem(player);
}
/*
[RemoteEvent("keyPress:LEFT_ARROW")]
public void KeyPressLeftArrow(Player player)
@@ -85,6 +87,7 @@ namespace ReallifeGamemode.Server.Events
}
}
*/
[RemoteEvent("keyPress:RIGHT_ARROW")]
public void KeyPressRightArrow(Player player)
{
@@ -169,7 +172,7 @@ namespace ReallifeGamemode.Server.Events
int pay_amount = 0;
bool house = false;
if(u.House != null)
if (u.House != null)
{
house = true;
}
@@ -185,7 +188,6 @@ namespace ReallifeGamemode.Server.Events
}
player.TriggerEvent("SERVER:InteractionMenu_OpenMenu", JsonConvert.SerializeObject(accountData), factionleader, faction, group, factionInvite, groupInvite, ticket_boolean, ticket_amount, pay_amount, house);
}
[RemoteEvent("keyPress:E")]
@@ -194,16 +196,15 @@ namespace ReallifeGamemode.Server.Events
if (!player.IsLoggedIn()) return;
var user = player.GetUser();
if (player.HasData("nearATM"))
{
ATMManager.ShowAtmUi(player, player.GetData<int>("nearATM"));
return;
}
if(!player.IsInVehicle)
if (!player.IsInVehicle)
{
if(GroundItem.PickUpGroundItem(player))
if (GroundItem.PickUpGroundItem(player))
{
return;
}
@@ -229,7 +230,6 @@ namespace ReallifeGamemode.Server.Events
List<VehicleItem> vehicleItems = dbContext.VehicleItems.ToList().Where(f => f.GetVehicle().GetVehicle() == nearestBehindVehiclePoint.vehicle && InventoryManager.GetItemById(f.ItemId) is IWeaponDealItem).ToList();
if (vehicleItems.Count == 0)
{
GTANetworkAPI.Vehicle vehicle = nearestBehindVehiclePoint.vehicle;
if (vehicle.HasAttachment("weapondeal"))
@@ -367,7 +367,7 @@ namespace ReallifeGamemode.Server.Events
if (player.HasAttachment("ammobox"))
{
player.AddAttachment("ammobox", true);
player.StopAnimation();
player.ClearAnimation();
}
bool unloadedWeaponPackage = false;
@@ -430,13 +430,12 @@ namespace ReallifeGamemode.Server.Events
if (user.FactionRank.Order >= weapon.Rank)
specials.Add(weapon.WeaponModel.ToString());
break;
case 5:
if (user.FactionRank.Order >= weapon.Rank)
armor.Add(weapon.WeaponModel.ToString());
break;
}
}
foreach (var weapon in weapons)
{
@@ -496,7 +495,7 @@ namespace ReallifeGamemode.Server.Events
foreach (Player target in NAPI.Pools.GetAllPlayers())
{
User c = target.GetUser();
if(c == null)
if (c == null)
{
continue;
}
@@ -679,7 +678,6 @@ namespace ReallifeGamemode.Server.Events
player.TriggerEvent("SERVER:Job_ShowJobMenu", job.Name, json);
}
[RemoteEvent("keyPress:O")]
public void KeyPressO(Player player)
{
@@ -688,13 +686,13 @@ namespace ReallifeGamemode.Server.Events
List<Player> players = NAPI.Pools.GetAllPlayers().Where(p => p.IsLoggedIn() == true).OrderBy(o => o.Handle.Value).ToList();
var listPlayers = players.Select(p => new
{
Id = p.Handle.Value,
p.Name,
p.Ping,
FactionName = p.GetUser()?.Faction?.Name ?? "Zivilist",
});
player.TriggerEvent("showPlayerlist", JsonConvert.SerializeObject(listPlayers));
{
Id = p.Handle.Value,
p.Name,
p.Ping,
FactionName = p.GetUser()?.Faction?.Name ?? "Zivilist",
});
player.TriggerEvent("showPlayerlist", JsonConvert.SerializeObject(listPlayers));
}
[RemoteEvent("keyPress:K")]
@@ -801,7 +799,7 @@ namespace ReallifeGamemode.Server.Events
}
else if (sV is FactionVehicle fV)
{
if(fV.Model == VehicleHash.Burrito3 && u.FactionId == 1
if (fV.Model == VehicleHash.Burrito3 && u.FactionId == 1
|| fV.Model == VehicleHash.Burrito3 && u.FactionId == 3
|| fV.Model == VehicleHash.Burrito3 && u.FactionId == 7
|| fV.Model == VehicleHash.Burrito3 && u.FactionId == 8
@@ -967,8 +965,17 @@ namespace ReallifeGamemode.Server.Events
player.TriggerEvent("ToggleVehicleMenu");
}
}
#endregion
#region Faction Key
#endregion
[RemoteEvent("keyPress:ControllH")]
public void KeyPressControllH(Player player)
{
if (player.HasAnimation())
return;
player.SyncAnimation("hup");
ChatService.SendInRange(player.Position, 20, $"~m~{player.Name} stellt sich...");
}
#endregion User Key
}
}

View File

@@ -6,6 +6,7 @@ using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Inventory.Interfaces;
using ReallifeGamemode.Server.Managers;
using ReallifeGamemode.Server.Util;
namespace ReallifeGamemode.Server.Inventory
{
@@ -99,9 +100,9 @@ namespace ReallifeGamemode.Server.Inventory
}
if (nearestItem is IWeaponDealItem obj)
{
if (!player.HasAttachment("ammobox"))
if (!player.HasAttachment("ammobox") && !player.HasAnimation())
{
player.PlayAnimation("anim@heists@box_carry@", "idle", 49);
player.SyncAnimation("carryBox");
player.AddAttachment("ammobox", false);
NAPI.Player.SetPlayerCurrentWeapon(player, WeaponHash.Unarmed);
}

View File

@@ -4,6 +4,7 @@ using GTANetworkAPI;
using ReallifeGamemode.Server.Shop.Clothing;
using ReallifeGamemode.Server.Shop.SevenEleven;
using ReallifeGamemode.Server.Shop.Friseur;
using ReallifeGamemode.Server.Util;
namespace ReallifeGamemode.Server.Managers
{
@@ -19,7 +20,7 @@ namespace ReallifeGamemode.Server.Managers
public static List<ClotheshopPoint> clotheshopPoints = new List<ClotheshopPoint>();
public static List<FriseurPoint> friseurPoints = new List<FriseurPoint>();
public static List<FriseurPoint> friseurPoints = new List<FriseurPoint>();
public static List<ItemshopPoint> itemshopPoints = new List<ItemshopPoint>();
@@ -213,6 +214,7 @@ namespace ReallifeGamemode.Server.Managers
NAPI.Blip.CreateBlip(513, p.Position, 1f, 16, "Busfahrer", 255, 0, true);
}
}
#endregion JobPoints
#region Shops
@@ -285,7 +287,6 @@ namespace ReallifeGamemode.Server.Managers
return;
}
player.Position = ElevatorPoints.Where(e => e.Stage == level).First().Position;
}
}
@@ -347,7 +348,7 @@ public class BehindVehiclePoint
{
if (!player.HasAttachment("ammobox"))
{
player.PlayAnimation("anim@heists@box_carry@", "idle", 49);
player.SyncAnimation("carryBox");
player.AddAttachment("ammobox", false);
NAPI.Player.SetPlayerCurrentWeapon(player, WeaponHash.Unarmed);
}
@@ -389,7 +390,6 @@ public class JobPoint
public Vector3 Position { get; set; }
public int jobId { get; set; }
public int Skill { get; set; }
}
public class ElevatorPoint

View File

@@ -30,8 +30,6 @@ namespace ReallifeGamemode.Server.Util
{
string animationName = animations.ElementAt(0);
List<string> nextAnimations = animations.Skip(1).ToList();
nextAnimations.ForEach(s => player.SendChatMessage(s));
player.SyncAnimation(animationName);
if (nextAnimations.Count != 0)

View File

@@ -142,13 +142,13 @@ public class AttachmentSyncExample : Script
if (!player.HasAttachment("ammobox"))
{
player.AddAttachment("ammobox", false);
player.PlayAnimation("anim@heists@box_carry@", "idle", 49);
//player.SyncAnimation("carryBox");
//veh.AddAttachment("weapondeal1", false);
//veh.AddAttachment("weapondeal2", false);
}
else
{
player.StopAnimation();
player.ClearAnimation();
player.ClearAttachments();
}