[Help] Making Commands
Featured Replies
Сейчас на странице 0
- Нет пользователей, просматривающих эту страницу
A better way to browse. Learn more.
A full-screen app on your home screen with push notifications, badges and more.
Используя этот сайт, вы соглашаетесь Условия использования.
I'm trying to make a mod which you can do sorts of funny stuff with chat commands.
but i got a problem when i tried to do some commands like norecoil toggle and infinite equipment ammo toggle.
norecoil just goes away after a few shots and inf equip doest work
heres the code:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using InfinityScript; namespace Ammo { public class Ammo : BaseScript { public Ammo() : base() { PlayerConnected += new Action(entity => { Call("setdvar", "motd", "Lol"); }); } public override void OnSay(Entity player, string name, string message) { var offhand = player.Call("getcurrentoffhand"); var norecoil = false; var equipment = false; var loop = 1; // Ressuply if (message.StartsWith("!giveammo")) { var weapon = player.CurrentWeapon; player.Call("giveMaxAmmo", player.CurrentWeapon); } if (message.StartsWith("!giveoffhand")) { var weapon = player.CurrentWeapon; player.Call("giveMaxAmmo", offhand); } // Invisibility if (message.StartsWith("!invon")) { player.Call("iprintlnbold", "Invisibility: ON"); player.Call("hide"); } if (message.StartsWith("!invoff")) { player.Call("iprintlnbold", "Invisibility: OFF"); player.Call("show"); } // No Recoil if (message.StartsWith("!norecoilon")) { player.Call("iprintlnbold", "No Recoil: ON"); norecoil = true; } if (message.StartsWith("!norecoiloff")) { player.Call("iprintlnbold", "No Recoil: OFF"); norecoil = false; } // Infinite Equipment if (message.StartsWith("!equipon")) { player.Call("iprintlnbold", "Equipment: ON"); equipment = true; } if (message.StartsWith("!equipoff")) { player.Call("iprintlnbold", "Equipment: OFF"); equipment = false; } // Statements if (norecoil) { player.Call("recoilscaleon", 0f); } else { player.Call("recoilscaleon", 1f); } if (equipment) { player.Call("giveMaxAmmo", offhand); } } public void createPlayerHud(Entity player) { HudElem text1 = HudElem.CreateFontString(player, "hudSmall", 1f); text1.SetPoint("BOTTOM RIGHT", "BOTTOM RIGHT", -200, 50); text1.HideWhenInMenu = true; OnInterval(100, () => { text1.SetText("Health: " + player.Health); return true; }); } } }