Hello Community,
I am currently coding with C# and i have a problem. I dont know how i can play an animaiton to a ped when a player comes close, so the Ped is playing an interaction Animaiton if the player comes close. I dont know how to do this and i would really appreciate it if i could get some help.
Server Side
[RemoteEvent("OnPlayerPressF")]
public void OnPlayerPressFNPC1(Player player)
{
if (!Accounts.IsPlayerLoggedIn(player)) return;
Vector3 npcPosition = new Vector3(-1288.5276, 301.5308, 64.92535);
if (player.Position.DistanceTo(npcPosition) < 1.5f)
{
player.SendNotification("~g~Test");
}
}
Client Side
mp.peds.new
(
mp.game.joaat("cs_barry"),
new mp.Vector3(-1288, 301, 64),
-88.5,
0);
mp.keys.bind(0x46, true, function()
{
if(mp.player.local.isTypingInTextChat) return;
mp.events.callRemote('OnPlayerPressF');
})