Skip to content

Instantly share code, notes, and snippets.

View sanyae2439's full-sized avatar
🐈
にゃぁ

sanyae2439

🐈
にゃぁ
View GitHub Profile
public static void SpawnGrenade(Vector3 position, bool isFlash = false, float fusedur = -1, ReferenceHub player = null)
{
if(player == null) player = ReferenceHub.GetHub(PlayerManager.localPlayer);
var gm = player.GetComponent<Grenades.GrenadeManager>();
Grenades.Grenade component = UnityEngine.Object.Instantiate(gm.availableGrenades[isFlash ? (int)GRENADE_ID.FLASH_NADE : (int)GRENADE_ID.FRAG_NADE].grenadeInstance).GetComponent<Grenades.Grenade>();
if(fusedur != -1) component.fuseDuration = fusedur;
component.FullInitData(gm, position, Quaternion.Euler(component.throwStartAngle), Vector3.zero, component.throwAngularVelocity);
NetworkServer.Spawn(component.gameObject);
}
@sanyae2439
sanyae2439 / Example.cs
Last active August 27, 2023 02:59
Send fakevalues to client's SyncVar & target only Rpc
using sanyae2439.SyncVarHackExtensions;
// Example:SyncVar
public static void SetTargetOnlyVisibleBadge(this Player target, string text)
{
target.SendCustomSyncVar(target.ReferenceHub.networkIdentity, typeof(ServerRoles), nameof(ServerRoles.NetworkMyText), text);
}
// Example:TargetRpc
public static void TargetShake(this Player target, bool achieve)