Closed TitaniumLithium closed 3 weeks ago
OriginalControllerOfCurrentPawn
Works
plugin.RegisterEventHandler <EventBulletImpact>(EventBulletImpactHandler = (@event, info) =>
{
if (Enabled == false) return HookResult.Stop;
Vector Position = new Vector(@event.X,@event.Y,@event.Z);
var oringin = @event.Userid!.OriginalControllerOfCurrentPawn.Get()!;
var oringinpawn = oringin.PlayerPawn.Get();
if (oringinpawn is null) return HookResult.Continue;
oringinpawn!.Teleport(Position);
return HookResult.Continue;
});
Bots and players themselves can teleport when shoot normally, But when players controling bots, the pawn won't be teleported. The pawn we get is not null, and it's location is moving when player moving. I have not idea how it could happen.
Some questions: Does playerpawn change to entity of that bot When players taking over of bots?