How to make a Ped attack a Player in C#
-
Hello,
So im very new to C# scripting, but you need to start somewhere.My Code so far
if (item == Test)
{
Ped player = Game.Player.Character;
Model Test = new Model(PedHash.Golfer01AMM);
World.CreatePed(Test, Game.Player.Character.Position + (Player.ForwardVector * 5));
Function.Call(Hash.TASK_STEALTH_KILL, Test, Player, AR_stealth_kill_a, true);
}Btw i am using NativeUI.
If someone could tell me how to give a ped a Golf Club or something it would be nice, because every time i tried to do it, the ped did not get anything or the game crashed.
And whats with the KillType (AR_stealth_kill_a), it gives me an error.I know i am a very bad in C# scripting and if a did something very dumb, it would be nice if you could say it.
Thank you for reading,- Kolopsel
-
BTW yes i do know this is 2 years ago but i am attempting to up my c# skills.
var Pedestrian = World.CreateRandomPed(Game.Player.WantedCenterPosition);
bool equipNow = true;
bool isAmmoLoaded = true;
Pedestrian.Weapons.Give(WeaponHash.GolfClub , 1, equipNow, isAmmoLoaded);