29.05.2014, 07:03
When a player chats, OnPlayerText is called. So that is the callback we want to use.
We want to apply the chat animation, which is "IDLE_chat" in the "ped" library.
(strlen(text) * 100) + 1000) is used as the 'timer' parameter in ApplyAnimation. This means that the animation will play for a certain amount of time, so with this, the longer the text you typed in the chat, the longer that your player will appear to be 'chatting', adding a more realistic effect to it.
The full code:
References:
ApplyAnimation
OnPlayerText
pawn Код:
public OnPlayerText(playerid, text[])
{
//Code
return 1;
}
pawn Код:
ApplyAnimation(playerid, "ped", "IDLE_chat", 4.1, 1, 1, 1, 0, ((strlen(text) * 100) + 1000), 1);
The full code:
pawn Код:
public OnPlayerText(playerid, text[])
{
ApplyAnimation(playerid, "ped", "IDLE_chat", 4.1, 1, 1, 1, 0, ((strlen(text) * 100) + 1000), 1);
return 1;
}
ApplyAnimation
OnPlayerText