Jump to content

Recommended Posts

Posted

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');

})

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...