Jump to content

Voice Chat Mouth Animation


Codeyn

Recommended Posts

Hello, I was wondering if it's possible in RAGEMP, to add to player's face an animation (mouth moving) while he's talking to voice chat. I've seen it in online, on FiveM so I'm curious if it can work somehow on RAGEMP. Thanks.

Edited by Codeyn
Link to comment
Share on other sites

  • 11 months later...
  • 2 months later...

It is possible. When they start talking, call this on server-side (it's from facials@gen_male@base but gender is irrelevant, the animation is the same for both - you can try changing facials@gen_female@base to check):

player.playAnimation('facials@gen_male@base', 'mood_talking_1', 1, 45);

When they stop, call this on server-side as well (change mood_normal_1 to the player's current mood, if you use a mood system or something like this):

player.playAnimation('facials@gen_male@base', 'mood_normal_1', 1, 45);

I'm using something like this to simulate this on text chat (the function is NOT evaluating if the player is currently playing another animation, that might stop all animations if they are):

// when the player speaks on chat and it's not a command, call this function
function playSpeakingAnim(player, message) {
  const secondsSpeaking = Math.ceil(message.split(" ").length / 2.5);
  player.playAnimation("facials@gen_male@base", "mood_talking_1", 1, 45);
  setTimeout(() => {
    mp.events.call("cancelAnimation", player);
  }, secondsSpeaking * 1000);
}

 

Edited by Madesoui
  • Like 2
Link to comment
Share on other sites

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...