Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class HealthBuffer
- {
- public static int slapAmount = -50; //default value
- //ID's that we care about. By default just ID "6", will want to make this changable by config.
- public static List<int> spawnSectionsForSlap = new List<int>(){6};
- //call this from your IHoldfastSharedMethods implementation
- public static void OnPlayerSpawned(int playerId, int spawnSectionId, FactionCountry playerFaction, PlayerClass playerClass, int uniformId, GameObject playerObject)
- {
- //is the spawn section one we care about?
- if (!spawnSectionForSlap.Contains(spawnSectionId)){return;}
- //player spawned on the ID, so lets slap them.
- ConsoleController.SlapPlayer(playerId,slapAmount);
- }
- //method for you to write
- //normally use "Wrex notation" for mod variables these will be of the form:
- // MOD_ID:MOD_VARIABLE:NEW_VALUE
- //eg: 2666645553:slapAmount:-100
- //would change "slapAmount" to -100
- //eg: 2666645553:spawnSectionsForSlap:6,7,8,10,12
- //would change "spawnSectionsForSlap" to be the list [6,7,8,10,12]
- public static void PassConfigVariables(string[] value)
- {
- string modID = "2531692643";
- for (int i = 0; i < value.Length; i++)
- {
- string[] splitData = value[i].Split(':');
- if (splitData.Length != 3)
- {
- Debug.LogError("invalid number of variables");
- continue;
- }
- if (splitData[0] != modID) { continue; }
- //your code goes here to change the variable's value.
- //splitData[1] is the "variable name"
- //splitData[2] is the "new value"
- //consider how you can determine + change the variable from this
- }
- }
- }
- public static clas ConsoleController
- {
- //this is a reference to the "Console" panel where commands will be input to.
- private static InputField f1menu;
- //Call this when OnServer is ran.
- public static void GetConsole()
- {
- //Assign f1menu using code from Wrex's line former
- //https://github.com/CM2Walki/HoldfastMods/blob/master/LineFormer/LineFormer.cs
- }
- //holdfast only allows int to be used for slap.
- public static SlapPlayer(int playerID, int damage)
- {
- //maybe need some validation incase f1 is null?
- //dont need "rc" since this will run server side.
- f1menu.onEndEdit.Invoke($"serverAdmin slap {playerID} {damage}");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment