This commit is contained in:
2021-04-06 21:19:44 +02:00
parent b993485906
commit be78edd912
5 changed files with 73 additions and 24 deletions

View File

@@ -50,10 +50,15 @@
setInterval(() => { setInterval(() => {
if (mp.players.local.getVariable("AnimationData")) { if (mp.players.local.getVariable("AnimationData")) {
let index = mp.game.joaat(mp.players.local.getVariable("AnimationData"));
let currentAnim = animationSyncData.animations[index];
let { id, name, animDict, animName, duration, loop, flag } = currentAnim;
if (loop) {
blockInput = true; blockInput = true;
} else { } else {
blockInput = false; blockInput = false;
} }
}
mp.players.forEachInStreamRange( mp.players.forEachInStreamRange(
(player) => { (player) => {
@@ -69,13 +74,6 @@
loadAnimDict(animDict, function () { loadAnimDict(animDict, function () {
mp.players.exists(player) && 0 !== player.handle && player.taskPlayAnim(animDict, animName, 1, 0, duration, parseInt(flag), 0, !1, !1, !1) mp.players.exists(player) && 0 !== player.handle && player.taskPlayAnim(animDict, animName, 1, 0, duration, parseInt(flag), 0, !1, !1, !1)
}); });
} else if (!loop) {
let a = setInterval(function () {
if (player == mp.players.local) {
mp.events.callRemote("CLIENT:ClearAnimationData", player);
}
clearInterval(a);
}, duration);
} }
}); });
}, 100); }, 100);

View File

@@ -1,6 +1,5 @@
import { IGame, IEntity } from "../game"; import { IGame, IEntity } from "../game";
export default function attachmentManager(game: IGame) { export default function attachmentManager(game: IGame) {
mp.events.add("SERVER:LoadAttachments", () => { mp.events.add("SERVER:LoadAttachments", () => {
attachmentMngr.register("char_creator_1", "prop_beggers_sign_04", 28422, new mp.Vector3(0, 0, 0), new mp.Vector3(0, 0, 0)); attachmentMngr.register("char_creator_1", "prop_beggers_sign_04", 28422, new mp.Vector3(0, 0, 0), new mp.Vector3(0, 0, 0));
@@ -11,8 +10,6 @@ export default function attachmentManager(game: IGame) {
attachmentMngr.register("weapondeal2", "w_sg_pumpshotgun", "chassis_dummy", new mp.Vector3(0.4, 1.6, 0.62), new mp.Vector3(90, 0, 180)); attachmentMngr.register("weapondeal2", "w_sg_pumpshotgun", "chassis_dummy", new mp.Vector3(0.4, 1.6, 0.62), new mp.Vector3(90, 0, 180));
}); });
const attachmentMngr = const attachmentMngr =
{ {
attachments: {}, attachments: {},
@@ -157,6 +154,17 @@ export default function attachmentManager(game: IGame) {
} }
}); });
mp.events.addDataHandler("attachToPlayer", (player: PlayerMp, attachedPlayer: PlayerMp) => {
if (!attachedPlayer)
return;
let handle = player.handle;
if (player == mp.players.local)
handle = mp.players.local.handle;
attachedPlayer.attachTo(handle, 0, 0, 1, 0, 0, 0, 0, false, true, false, true, 2, true);
});
mp.events.addDataHandler("attachmentsData", (entity, data) => { mp.events.addDataHandler("attachmentsData", (entity, data) => {
let newAttachments = (data.length > 0) ? data.split('|').map(att => parseInt(att, 36)) : []; let newAttachments = (data.length > 0) ? data.split('|').map(att => parseInt(att, 36)) : [];

View File

@@ -1,4 +1,5 @@
export default function weapondamageUtil() { export default function weapondamageUtil() {
let blockInput = false;
mp.players.local.setSuffersCriticalHits(false); mp.players.local.setSuffersCriticalHits(false);
@@ -6,6 +7,13 @@
player.setSuffersCriticalHits(false); player.setSuffersCriticalHits(false);
}); });
mp.events.add("render", () => {
if (blockInput) {
mp.game.controls.disableControlAction(32, 142, true);
mp.game.controls.disableControlAction(32, 263, true);
}
});
mp.events.add('SERVER:WeaponModifier', (player) => { mp.events.add('SERVER:WeaponModifier', (player) => {
//mp.gui.chat.push("Modifier steht jetzt auf" + modifier); //mp.gui.chat.push("Modifier steht jetzt auf" + modifier);
//mp.players.local.setWeaponDamageModifier(modifier); //mp.players.local.setWeaponDamageModifier(modifier);
@@ -16,65 +24,83 @@
case 0x1B06D571: //Pistol case 0x1B06D571: //Pistol
modifier = 0.4; modifier = 0.4;
meelemodifier = 1; meelemodifier = 1;
//mp.gui.chat.push("PistolModifier: " + modifier); blockInput = true;
break; break;
case 0xBFE256D4: //Pistol_MK2 case 0xBFE256D4: //Pistol_MK2
modifier = 0.4; modifier = 0.4;
meelemodifier = 1; meelemodifier = 1;
blockInput = true;
break; break;
case 0x5EF9FEC4: //Combatpistol case 0x5EF9FEC4: //Combatpistol
modifier = 0.5; modifier = 0.5;
meelemodifier = 1; meelemodifier = 1;
blockInput = true;
break; break;
case 0x99AEEB3B: //Pistol50 case 0x99AEEB3B: //Pistol50
modifier = 0.35; modifier = 0.35;
meelemodifier = 1; meelemodifier = 1;
blockInput = true;
break; break;
case 0x2BE6766B: //SMG case 0x2BE6766B: //SMG
modifier = 0.25; modifier = 0.25;
meelemodifier = 1; meelemodifier = 1;
blockInput = true;
break; break;
case 0x1D073A89: //Pumpshotgun case 0x1D073A89: //Pumpshotgun
modifier = 0.2; modifier = 0.2;
meelemodifier = 1; meelemodifier = 1;
blockInput = true;
break; break;
case 0x83BF0278: //Cabinerifle case 0x83BF0278: //Cabinerifle
modifier = 0.2; modifier = 0.2;
meelemodifier = 1; meelemodifier = 1;
blockInput = true;
break; break;
case 0x624FE830: //Compactrifle case 0x624FE830: //Compactrifle
modifier = 0.2; modifier = 0.2;
meelemodifier = 0.1; meelemodifier = 0.1;
blockInput = true;
break; break;
case 0x05FC3C11: //Sniperrifle case 0x05FC3C11: //Sniperrifle
modifier = 0.5; modifier = 0.5;
meelemodifier = 1; meelemodifier = 1;
blockInput = true;
break; break;
case 0xA2719263: //Meele Umarmed Fist case 0xA2719263: //Meele Umarmed Fist
meelemodifier = 0.1; meelemodifier = 0.1;
modifier = 1; modifier = 1;
blockInput = false;
//mp.gui.chat.push("FistModifier: " + meelemodifier); //mp.gui.chat.push("FistModifier: " + meelemodifier);
break; break;
case 0x958A4A8F: //Meele Baseball Bat case 0x958A4A8F: //Meele Baseball Bat
meelemodifier = 0.15; meelemodifier = 0.15;
modifier = 1; modifier = 1;
blockInput = false;
break; break;
case 0x8BB05FD7: //Meele Flashlight case 0x8BB05FD7: //Meele Flashlight
meelemodifier = 0.1; meelemodifier = 0.1;
modifier = 1; modifier = 1;
blockInput = false;
break; break;
case 0xD8DF3C3C: //Meele Knuckle case 0xD8DF3C3C: //Meele Knuckle
meelemodifier = 0.1; meelemodifier = 0.1;
modifier = 1; modifier = 1;
blockInput = false;
//mp.gui.chat.push("KnuckleModifier: " + meelemodifier); //mp.gui.chat.push("KnuckleModifier: " + meelemodifier);
break; break;
case 0x678B81B1: //Meele Nightstick case 0x678B81B1: //Meele Nightstick
meelemodifier = 0.1; meelemodifier = 0.1;
modifier = 1; modifier = 1;
blockInput = false;
break; break;
default: default:
modifier = 1; modifier = 1;
meelemodifier = 1; meelemodifier = 1;
blockInput = false;
break; break;
} }
mp.game.invoke("0xCE07B9F7817AADA3", player, modifier); mp.game.invoke("0xCE07B9F7817AADA3", player, modifier);
@@ -95,7 +121,6 @@
} }
}); });
/*mp.events.add('playerWeaponShot', (targetPosition, targetEntity) => { /*mp.events.add('playerWeaponShot', (targetPosition, targetEntity) => {
for (var x in this.weaponAmmo) { for (var x in this.weaponAmmo) {
if (this.weaponAmmo[x].id != this.currentWeapon) { if (this.weaponAmmo[x].id != this.currentWeapon) {

View File

@@ -47,7 +47,6 @@ namespace ReallifeGamemode.Server.Commands
return; return;
//target.SetInFrontOf(player); //target.SetInFrontOf(player);
//target.Heading = player.Heading; //target.Heading = player.Heading;
player.TriggerEvent("attach to Player", target);
} }
[Command("cuff", "~m~Benutzung: ~s~/cuff [ID]")] [Command("cuff", "~m~Benutzung: ~s~/cuff [ID]")]

View File

@@ -1,5 +1,4 @@
 using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using GTANetworkAPI; using GTANetworkAPI;
@@ -109,6 +108,29 @@ public static class AttachmentSync
{ {
return string.Join('|', attachments.Select(a => Base36Extensions.ToBase36(a)).ToArray()); return string.Join('|', attachments.Select(a => Base36Extensions.ToBase36(a)).ToArray());
} }
public static void AttachPlayer(this Player player, Player attachTo)
{
attachTo.DetachPlayer();
if (!attachTo.HasData("attachedPlayer"))
attachTo.SetData<Player>("attachedPlayer", null);
if (attachTo.GetData<Player>("attachedPlayer") == player)
return;
attachTo.SetData("attachedPlayer", attachTo);
attachTo.SetSharedData("attachToPlayer", player);
}
public static void DetachPlayer(this Player player)
{
if (!player.HasData("attachedPlayer"))
return;
player.ResetData("attachedPlayer");
player.ResetSharedData("attachToPlayer");
}
} }
public class AttachmentSyncExample : Script public class AttachmentSyncExample : Script
@@ -154,7 +176,4 @@ public class AttachmentSyncExample : Script
player.ClearAttachments(); player.ClearAttachments();
} }
} }
} }