roflmuffin / CounterStrikeSharp

CounterStrikeSharp allows you to write server plugins in C# for Counter-Strike 2/Source2/CS2
https://docs.cssharp.dev
Other
757 stars 115 forks source link

SetParent Not Set to Entities #323

Open oppars01 opened 7 months ago

oppars01 commented 7 months ago
var coin = Utilities.CreateEntityByName<CDynamicProp>("prop_dynamic");
coin.SetModel("models/inventory_items/coin_csgo.vmdl");
coin.Teleport(origin, angle, velocity);
coin.DispatchSpawn();
coin.AcceptInput("SetParent", player, coin, "!activator", 0);

In the above figure, I want to set the Parent of the entity as player and I want it to move with the player, but it does not work.

darkerz7 commented 4 months ago

entity.AcceptInput("SetParent", @event.Userid.PlayerPawn.Value, null, "!activator"); This work