[HELP] Chat Animation
#1

Hello,

I don't got a problem but I need some explanation of something:

I've made something that if you talk a animation appears.
Code:
ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,1,1);

Also made a timer for it and forwarded it:

Code:
SetTimerEx("StopTalk", 1000, 0, "i", playerid);
What I want to do next is that my animation stops when you only type for ex: "Hi."
So when you type "Hi." it should appear for like 1 second. And if you type more it should appear for longer.

Do you guys have any idea to make this?

I've allready used the search button but couldn't find anything like what I want. I only finded how to make the animation appear. Like I allready got.

I hope someone of you can help me, thanks anyways.
Reply
#2

Well, you could take the length of the string, then multiply it by, maybe 500 or 1000 (or anything that suits)

Then it becomes 2 seconds for "Hi", 5 seconds for "Hello", and so on
Reply
#3

Yeah that's exacly what I need but how do I make it?
Reply
#4

Just change the timer calling line

pawn Code:
SetTimerEx("StopTalk",floatround(strlen(text)/9)*1000, 0, "i", playerid);
Reply
#5

strlen can't return float lol...

pawn Code:
SetTimerEx("StopTalk", strlen(text)*80, false, "i", playerid);
I found this option to fit the best.
Reply
#6

Quote:
Originally Posted by [HUN
Epsilon ]
Just change the timer calling line

pawn Code:
SetTimerEx("StopTalk",floatround(strlen(text)/9)*1000, 0, "i", playerid);
But if I divide it with 9 it wont be integer... Lol man..

Epsilon
Reply
#7

*nvm*
Reply
#8

Thanks it's working!

But I've got one problem left:
If I talk in a car, my character automaticly gets putted out of the car. How can I fix that?
Reply
#9

Edit the ApplyAnimation function's line;

Code:
if(!IsPlayerInAnyVehicle(playerid)) ApplyAnimation(playerid,...);
Reply
#10

Where do I need to put that?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)