KRY_
KRY_
CC#
Created by KRY_ on 7/12/2023 in #help
❔ (OXIDE FOR RUST) void issues etc..
Currently trying to merge refrence code from making a bubble and such into my KOTH event plugin im developing but i keep getting issues, can someone help me with integrating this void? I need to post the whole public class as this public void of creating a bubble refrences items inside it, i only need the
public void CreateBubble(Vector3 position, float initialRadius, string grid, int time)
public void CreateBubble(Vector3 position, float initialRadius, string grid, int time)
im attempting to integrate it into this section here
private void SpawnCrate()
{
var crate = GameManager.server.CreateEntity(CratePrefab, cratePosition);
if (crate != null)
{
crate.Spawn();
crateSpawned = true;
Puts($"Koth started at position: {cratePosition}");
}
}
private void SpawnCrate()
{
var crate = GameManager.server.CreateEntity(CratePrefab, cratePosition);
if (crate != null)
{
crate.Spawn();
crateSpawned = true;
Puts($"Koth started at position: {cratePosition}");
}
}
basically when running the private void
SpawnCrate()
SpawnCrate()
it should create the bubble that is listed in the following txt file at the section of which creates the bubble (
CreateBubble
CreateBubble
) when the crate is spawned
6 replies
CC#
Created by KRY_ on 1/11/2023 in #help
❔ hook errors and unexpected }
So I’m working on some code for rust as of now and it’s function so far is to spawn a crate at a players position with a offset of 1.5 for the x, I keep getting errors with it though and I can’t seem to fix the issue anyone got a solution? Code:
using Oxide.Core.Libraries.Covalence;
using System;
using System.Collections.Generic;
using UnityEngine;

namespace Oxide.Plugins
{
[Info("hackable", "KRYPT1KZ", "1.0.1")]
public class hackable : CovalencePlugin
{
private const string hackablePrefab = "assets/prefabs/deployable/hackable_crate.prefab";

[Command("hackable")]
private void CommandHackable(IPlayer player, string cmd, string[] args)
{
var spawnPosition = new Vector3(player.Position().x + 1.5f, player.Position().y, player.Position().z);
var entity = GameManager.server.CreateEntity(hackablePrefab, spawnPosition);

entity.Spawn();

Puts($"{player.Name} spawned a hackable at {spawnPosition}.");
}

private void OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitinfo)
{
if (hitinfo.Initiator != null && hitinfo.Initiator is BasePlayer && entity.ShortPrefabName == "hackable_crate")
{
var player = hitinfo.Initiator as BasePlayer;
Puts($"Player {player.displayName} has opened hackable crate {entity.net.ID}");
}
}

protected override void LoadDefaultConfig()
{
// Subscribe to the entity take damage event
this.HookEvent(Rust.Event.OnEntityTakeDamage, OnEntityTakeDamage);
}
}
}
using Oxide.Core.Libraries.Covalence;
using System;
using System.Collections.Generic;
using UnityEngine;

namespace Oxide.Plugins
{
[Info("hackable", "KRYPT1KZ", "1.0.1")]
public class hackable : CovalencePlugin
{
private const string hackablePrefab = "assets/prefabs/deployable/hackable_crate.prefab";

[Command("hackable")]
private void CommandHackable(IPlayer player, string cmd, string[] args)
{
var spawnPosition = new Vector3(player.Position().x + 1.5f, player.Position().y, player.Position().z);
var entity = GameManager.server.CreateEntity(hackablePrefab, spawnPosition);

entity.Spawn();

Puts($"{player.Name} spawned a hackable at {spawnPosition}.");
}

private void OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitinfo)
{
if (hitinfo.Initiator != null && hitinfo.Initiator is BasePlayer && entity.ShortPrefabName == "hackable_crate")
{
var player = hitinfo.Initiator as BasePlayer;
Puts($"Player {player.displayName} has opened hackable crate {entity.net.ID}");
}
}

protected override void LoadDefaultConfig()
{
// Subscribe to the entity take damage event
this.HookEvent(Rust.Event.OnEntityTakeDamage, OnEntityTakeDamage);
}
}
}
66 replies