SA-MP Forums Archive
Animation on Player Text - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Animation on Player Text (/showthread.php?tid=516001)



Animation on Player Text - cedizon - 29.05.2014

How to put the Chat Animation when the Player Chats.

Like at LS-RP , PR-RP for example i typed "Hey, I'm the new Worker here" then my player animates the chat

Help please


Re: Animation on Player Text - NaClchemistryK - 29.05.2014

https://sampwiki.blast.hk/wiki/ApplyAnimation
use this function in your script. this function applies an animation.
and please, ask minor questions in the stickied thead above.


Re: Animation on Player Text - BroZeus - 29.05.2014

could you explain in more details what do you wants exactly


Re: Animation on Player Text - Threshold - 29.05.2014

When a player chats, OnPlayerText is called. So that is the callback we want to use.
pawn Код:
public OnPlayerText(playerid, text[])
{
    //Code
    return 1;
}
We want to apply the chat animation, which is "IDLE_chat" in the "ped" library.
pawn Код:
ApplyAnimation(playerid, "ped", "IDLE_chat", 4.1, 1, 1, 1, 0, ((strlen(text) * 100) + 1000), 1);
(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:
pawn Код:
public OnPlayerText(playerid, text[])
{
    ApplyAnimation(playerid, "ped", "IDLE_chat", 4.1, 1, 1, 1, 0, ((strlen(text) * 100) + 1000), 1);
    return 1;
}
References:
ApplyAnimation
OnPlayerText


Re: Animation on Player Text - cedizon - 29.05.2014

@Brozeus , For example a players talks ICly in RP servers , their Characters will animate the CHAT Animation without Command


Re: Animation on Player Text - cedizon - 29.05.2014

@Benzo , Help , when i put that to my OnPlayerText at the Beginning , my PAWNO Crashed i need help please


Re: Animation on Player Text - Threshold - 29.05.2014

Show me your OnPlayerText.


Re: Animation on Player Text - Guest4390857394857 - 29.05.2014

use it under onplayertext .. Use Applyanimation function.


Re: Animation on Player Text - Parallex - 29.05.2014

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
When a player chats, OnPlayerText is called. So that is the callback we want to use.
pawn Код:
public OnPlayerText(playerid, text[])
{
    //Code
    return 1;
}
We want to apply the chat animation, which is "IDLE_chat" in the "ped" library.
pawn Код:
ApplyAnimation(playerid, "ped", "IDLE_chat", 4.1, 1, 1, 1, 0, ((strlen(text) * 100) + 1000), 1);
(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:
pawn Код:
public OnPlayerText(playerid, text[])
{
    ApplyAnimation(playerid, "ped", "IDLE_chat", 4.1, 1, 1, 1, 0, ((strlen(text) * 100) + 1000), 1);
    return 1;
}
References:
ApplyAnimation
OnPlayerText
Benzo has just explained everything here.


Re: Animation on Player Text - cedizon - 29.05.2014

my Onplayertext
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(gPlayerLogged[playerid] != 1)
    {
        SendClientMessage(playerid, COLOR_RED, "You're not logged in.");
        return 0;
    }
    if(AntiAdv(playerid, text)) return 0;
    if(PlayerInfo[playerid][pTut] == 0)
    {
        return 0;
    }

    new sendername[MAX_PLAYER_NAME];
    new giveplayer[MAX_PLAYER_NAME];
    new string[128];
    playerLastTyped[playerid] = 0;

    if(TextSpamUnmute[playerid] != 0)
    {
        if(PlayerInfo[playerid][pAdmin] < 6)
        {
            SendClientMessage(playerid, COLOR_WHITE, "You're muted from submitting text right now.");
            return 0;
        }
    }

    if(PlayerInfo[playerid][pAdmin] < 6)
    {
        TextSpamTimes[playerid]++;

        if(TextSpamTimes[playerid] == 5)
        {
            TextSpamTimes[playerid] = 0;
            TextSpamUnmute[playerid] = 10;
            SendClientMessage(playerid, COLOR_YELLOW, "You have been muted automatically for spamming. Please wait 10 seconds and try again.");
            SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_FLOODPROTECTION);
            return 0;
        }
    }

    if(strfind(text, "|", true) != -1)
    {
        SendClientMessage(playerid, COLOR_RED, "You can't use the '|' character in text.");
        return 0;
    }

    if(PlayerInfo[playerid][pAdmin] < 4)
    {
        if(strfind(text, ":", true) != -1)
        {
            new
                i_numcount,
                i_period,
                i_pos;

            while(text[i_pos]) {
                if('0' <= text[i_pos] <= '9') i_numcount++;
                else if(text[i_pos] == '.') i_period++;
                i_pos++;
            }
            if(i_numcount >= 8 && i_period >= 3) {
                format(string,sizeof(string),"Warning: %s may be server advertising: '%s'.", GetPlayerNameEx(playerid),text);
                ABroadCast(COLOR_RED, string, 2);
                Log("logs/hack.log", string);
                return 0;
            }
        }
    }