Simple jump/speed/gravity
Featured Replies
Сейчас на странице 0
- Нет пользователей, просматривающих эту страницу
A better way to browse. Learn more.
A full-screen app on your home screen with push notifications, badges and more.
Используя этот сайт, вы соглашаетесь Условия использования.
This is a simple plugin that allow admins to change jump_height, g_speed and g_gravity dvars.
The plugin work only if there is a text file called "jump_plugin_setting.txt" on the same folder.
Edit the file provided with this:
Admins name are separated by a comma (no space!)
The numbers near dvar will be the default value dvar of all matches.
Chat control for admin:
//jump_height [number]
//g_speed[number]
//g_gravity[number]
//all default config //This command will set all dvar to default config value.
//all default game //This command will set all dvar to default game value.
//jump_height default config //This command will set jump_height dvar to default config value.
//jump_height default game //This command will set jump_height dvar to default game value.
//g_speed default config //This command will set g_speed dvar to default config value.
//g_speed default game //This command will set g_speed dvar to default game value.
//g_gravity default config //This command will set g_gravity dvar to default config value.
//g_gravity default game //This command will set g_gravity dvar to default game value.
Source code:
/* ***Settings Plugin*** Based on InstaGib plugin by DaMacc Admin system and chat control by Kiren0494 zxz0000 remove fall damage */ using System; using System.IO; using System.Collections; using System.Runtime.InteropServices; using InfinityScript; namespace InfinityScript.Examples { public class jump_plugin : BaseScript { public string executionPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); public int jump_heightConfig; public int g_speedConfig; public int g_gravityConfig; public int jump_heightDefault = 39; public int g_speedDefault = 190; public int g_gravityDefault = 800; public jump_plugin() { StreamReader objReader = new StreamReader(@executionPath + "\\" + "jump_plugin_setting.txt"); string sLine = ""; ArrayList arrText = new ArrayList(); while (sLine != null) { sLine = objReader.ReadLine(); if (sLine != null) { arrText.Add(sLine); } } objReader.Close(); string[] admins = arrText[0].ToString().Split(','); string[] settings = arrText[1].ToString().Split('='); jump_heightConfig = int.Parse(settings[1]); settings = arrText[2].ToString().Split('='); g_speedConfig = int.Parse(settings[1]); settings = arrText[3].ToString().Split('='); g_gravityConfig = int.Parse(settings[1]); setDefaultConfigValue(); OnNotify("prematch_done", () => { Call("iprintln", "^6Setting plugin loaded with ^2jump_height = ^1" + JumpHeight + "^2, g_speed = ^1" + Speed + "^2, g_gravity = ^1" + Gravity); }); PlayerConnecting += new Action(entity => { entity.SetField("isAdmin", 0); for (int i = 0; i < admins.Length; i++) { if (admins[i].CompareTo(getPlayerName(entity))==0) { entity.SetField("isAdmin", 1); } } }); } public override void OnSay(Entity player, string playerName, string text) { string[] arrChatMsg = text.Split(' '); if (arrChatMsg[0] == "/jump_height") { if (playerIsAdmin(player) == 0) { player.Call("iprintlnbold", "^1SORRY, YOU ARE NOT ADMIN D:"); return; } try { if (arrChatMsg.Length != 1) { if (arrChatMsg[1] == "default") { if (arrChatMsg[2] == "game") { Call("iprintln", "^1jump_height " + JumpHeight + "-----^5Changed^1-^5to^1----->" + jump_heightDefault + " (default game value) ^2by" + playerName); JumpHeight = jump_heightDefault; } if (arrChatMsg[2] == "config") { Call("iprintln", "^1jump_height " + JumpHeight + "-----^5Changed^1-^5to^1----->" + jump_heightConfig + " (default server value) ^2by" + playerName); JumpHeight = jump_heightConfig; } } else { Call("iprintln", "^1jump_height " + JumpHeight + "-----^5Changed^1-^5to^1----->" + arrChatMsg[1] + " ^2by" + playerName); JumpHeight = int.Parse(arrChatMsg[1]); } } else player.Call("iprintlnbold", "^1jump_height is set to ^2:"+JumpHeight); } catch (Exception e) { } } if (arrChatMsg[0] == "/g_speed") { if (playerIsAdmin(player) == 0) { player.Call("iprintlnbold", "^1SORRY, YOU ARE NOT ADMIN D:"); return; } try { if (arrChatMsg.Length != 1) { if (arrChatMsg[1] == "default") { if (arrChatMsg[2] == "game") { Call("iprintln", "^1g_speed " + Speed + "-----^5Changed^1-^5to^1----->" + g_speedDefault + " (default game value) ^2by" + playerName); Speed = g_speedDefault; } if (arrChatMsg[2] == "config") { Call("iprintln", "^1g_speed " + Speed + "-----^5Changed^1-^5to^1----->" + g_speedConfig + " (default server value) ^2by" + playerName); Speed = g_speedConfig; } } else { Call("iprintln", "^1g_speed " + Speed + "-----^5Changed^1-^5to^1----->" + arrChatMsg[1] + " ^2by" + playerName); Speed = int.Parse(arrChatMsg[1]); } } else player.Call("iprintlnbold", "^1g_speed is set to ^2:" + Speed); } catch (Exception e) { } } if (arrChatMsg[0] == "/g_gravity") { if (playerIsAdmin(player) == 0) { player.Call("iprintlnbold", "^1SORRY, YOU ARE NOT ADMIN D:"); return; } try { if (arrChatMsg.Length != 1) { if (arrChatMsg[1] == "default") { if (arrChatMsg[2] == "game") { Call("iprintln", "^1g_gravity " + Gravity + "-----^5Changed^1-^5to^1----->" + g_gravityDefault + " (default game value) ^2by" + playerName); Gravity = g_gravityDefault; } if (arrChatMsg[2] == "config") { Call("iprintln", "^1g_gravity " + Gravity + "-----^5Changed^1-^5to^1----->" + g_gravityConfig + " (default server value) ^2by" + playerName); Gravity = g_gravityConfig; } } else { Call("iprintln", "^1g_gravity " + Gravity + "-----^5Changed^1-^5to^1----->" + arrChatMsg[1] + " ^2by" + playerName); Gravity = int.Parse(arrChatMsg[1]); } } else player.Call("iprintlnbold", "^1g_gravity is set to ^2:" + Gravity); } catch (Exception e) { } } if (arrChatMsg[0] == "/all") { if (playerIsAdmin(player) == 0) { player.Call("iprintlnbold", "^1SORRY, YOU ARE NOT ADMIN D:"); return; } try { if (arrChatMsg[1] == "default") { if (arrChatMsg[2] == "config") { Call("iprintln", "^1jump_height = " + JumpHeight + "g_speed = " + Speed + " g_gravity = " + Gravity + "^2 Changed by " + playerName); setDefaultConfigValue(); } if (arrChatMsg[2] == "game") { Call("iprintln", "^1jump_height, g_speed, g_gravity changed to normal value ^2by " + playerName); setDefaultGameValue(); } } } catch (Exception e) { } } return; } public override void OnPlayerDamage(Entity player, Entity inflictor, Entity attacker, int damage, int dFlags, string mod, string weapon, Vector3 point, Vector3 dir, string hitLoc) { if (mod == "MOD_FALLING" && JumpHeight > 120) { player.Health += damage; } } public void setDefaultConfigValue() { JumpHeight = jump_heightConfig; Speed = g_speedConfig; Gravity = g_gravityConfig; } public void setDefaultGameValue() { JumpHeight = jump_heightDefault; Speed = g_speedDefault; Gravity = g_gravityDefault; } public string getPlayerName(Entity player) { return player.GetField("name"); } public int playerIsAdmin(Entity player) { return player.GetField("isAdmin"); } public static unsafe int Gravity { get { return *((int*)0x4768C6); } set { *((int*)0x4768C6) = value; } } public static unsafe int Speed { get { return *((int*)0x4760ea); } set { *((int*)0x4760ea) = value; } } public static unsafe float JumpHeight { get { return *((float*)0x6da708); } set { *((float*)0x6da708) = value; } } } }Credits:
DaMacc - Offsets
zxz0O0 - Removed fall damage
Me