Creating New Player Class
All Player Classes must be placed under namespace Plugin.Classes
Class Functions
Init() - [OPTIONAL] class initialization.
Update() - [OPTIONAL] called every frame.
OnStop() - [OPTIONAL] called on class destroy.
OnEscape() - [OPTIONAL] called when players escapes(Trigger on surface at Exit B).
GetHand() - [REQUIRED] return hand material ID(required only for classes that can pickup items).
GetName() - [REQUIRED] displayed class name.
GetTeamID() - [REQUIRED] class team.
GetClassColor() - [REQUIRED] class color in HEX.
GetPlayerInfo(HitBox) - [OPTIONAL] additional information when player looks at someone, return string [DEFAULT: ""].
GetDeadInfo(DeadBox) - [OPTIONAL] additional information when player looks at dead body, return string [DEFAULT: ""].
OnOpenInventory() - [OPTIONAL] can this class open inventory, return boolean [DEFAULT: false].
IgnoreSCP() - [OPTIONAL] is this class ignore all scp mechanics, return boolean [DEFAULT: false].
CheckpointPass() - [OPTIONAL] can this class open checkpoints without key card, return boolean [DEFAULT: false].
CanTakeDamage() - [OPTIONAL] can this class take damage, return boolean [DEFAULT: true].
OnTakeDamage(DamageHandler) - [OPTIONAL] called when player takes damage.
Local Properties
player - return current Player class.
playerModel - shared property, that must be assigned from player class.
Local Functions
SendToEveryone(string FunctionName, params object[] arguments) - send command to every player to call function with arguments.
SendToClient(string FunctionName, NetworkConnection connection, params object[] arguments) - send command to player with connection to call function with arguments.
SendToServer(string FunctionName, params object[] arguments) - send command to server to call function with arguments.
Invoke(Function, float seconds) - same logic as UnityEngine.Object.Invoke, call function after time.
Example
using System.Collections.Generic;
using UnityEngine;
namespace Plugin.Classes
{
public class ExampleClass : Akequ.Base.PlayerClass
{
public override void Init()
{
player.InitHealth(100, new Color(1f, 0f, 0f, 1f));
if (player.isLocalPlayer)
{
player.PlayBellSound(1);
UIManager.SetMobileButtons(new List<string>() { "Move", "Rotate", "Pause", "PlayerList", "Interact", "Jump", "Run",
"Inventory", "Voice" });
TransitionManager.ShowClass("#FF8E00", "Test Class Name", "Test Class Decription");
player.SetSpeed(3.25f, 8.5f);
player.SetJumpPower(2.5f);
player.SetFootsteps(ResourcesManager.GetClips("Step1", "Step2", "Step3", "Step4", "Step5", "Step6",
"Step7", "Step8"));
PlayerUtilities.SetVoiceChat("3D", "", false);
}
else
{
playerModel = GameObject.Instantiate(ResourcesManager.GetObject("ply_classD")) as GameObject;
playerModel.transform.parent = player.transform;
playerModel.transform.localPosition = new Vector3(0f, -1.075f, 0f);
playerModel.transform.localRotation = Quaternion.identity;
playerModel.transform.localScale = new Vector3(1.45f, 1.45f, 1.45f);
PlayerUtilities.SpawnHitboxes(player, playerModel);
}
if (player.isServer)
{
if (player.isClient)
{
Transform[] points = player.GetSpawnPoints("Zone1", "classDSpawn");
Vector3 point = points[Random.Range(0, points.Length)].position;
player.Teleport(new Vector3(point.x,point.y+1.25f, point.z));
}
else
{
GameObject[] points = GameObject.FindGameObjectsWithTag("classDSpawn");
Vector3 point = points[Random.Range(0, points.Length)].transform.position;
player.Teleport(new Vector3(point.x,point.y+1.25f, point.z));
}
player.SetSpeed(3.25f, 8.5f);
}
}
public override void OnStop()
{
if (playerModel != null)
{
PlayerUtilities.SpawnRagdoll(player, playerModel);
GameObject.Destroy(playerModel);
}
else
{
PlayerUtilities.SpawnRagdoll(player, "ply_classD_ragdoll").transform.localScale =
new Vector3(1.45f, 1.45f, 1.45f);
}
}
public override string GetHand()
{
return "ClassDHand";
}
public override bool OnOpenInventory()
{
return true;
}
public override string GetName()
{
return "Test Class Name";
}
public override string GetTeamID()
{
return "ClassD";
}
public override string GetClassColor()
{
return "FF8E00";
}
}
}
Example Solution can be downloaded here: Link to archive
Testing
Now we can compile this plugin and move library to server plugins folder according to Folder Structure Now we can force class:

Last updated