SA-MP Forums Archive
Random Animation and SA:MP crashes - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Random Animation and SA:MP crashes (/showthread.php?tid=192769)



Random Animation and SA:MP crashes - sekol - 23.11.2010

So, i want to make player perform random animation...
PHP код:
new RandomMove[][] =
{
    {
"Library""Anim Name"},
    {
"Library""Anim Name"},
    {
"Library""Anim Name"},
    {
"Library""Anim Name"},
    {
"Library""Anim Name"}
}; 
And now
PHP код:
Bla Bla Bla
ApplyAnimation
(playeridRandomMove[Random][0], RandomMove[Random][1], 4.101111); 
What's wrong? Maybe it won't work this way?


Re: Random Animation and SA:MP crashes - Zh3r0 - 23.11.2010

pawn Код:
new RandomMove[5][1] =
{
    {"Library", "Anim Name"},
    {"Library", "Anim Name"},
    {"Library", "Anim Name"},
    {"Library", "Anim Name"},
    {"Library", "Anim Name"}
};

pawn Код:
new rAnim = random( sizeof ( RandomMoves ) );
ApplyAnimation(playerid, RandomMove[rAnim][0], RandomMove[rAnim][1], 4.1, 0, 1, 1, 1, 1);
Here.

I think this might work.


Re: Random Animation and SA:MP crashes - sekol - 23.11.2010

I did like you said but instead of RandomMove[5][1] i did RandomMove[5][2] 'cause yours gave me error about array or somethin Now i get this error
PHP код:
(10) : error 018initialization data exceeds declared size
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
1 Error




Re: Random Animation and SA:MP crashes - Zh3r0 - 23.11.2010

Quote:
Originally Posted by sekol
Посмотреть сообщение
I did like you said but instead of RandomMove[5][1] i did RandomMove[5][2] 'cause yours gave me error about array or somethin Now i get this error
PHP код:
(10) : error 018initialization data exceeds declared size
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
1 Error

Ah damn, i made a mistake. It's 4 not 5, because 0 is counted too.
so
0,1,2,3,4 = 5 numbers.


Re: Random Animation and SA:MP crashes - Mauzen - 23.11.2010

5 is correct, it is just the size when you create an array, and so starts with 1

Strings are arrays themself, so you need a 3d array:

pawn Код:
new RandomMove[5][2][24] =
{
    {"Library", "Anim Name"},
    {"Library", "Anim Name"},
    {"Library", "Anim Name"},
    {"Library", "Anim Name"},
    {"Library", "Anim Name"}
};
Edit: You can use the same ApplyAnimation code you used before.


Re: Random Animation and SA:MP crashes - sekol - 23.11.2010

Ehh, unfortunatelly it still crashes There's no hope for me


Re: Random Animation and SA:MP crashes - Zh3r0 - 23.11.2010

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
5 is correct, it is just the size when you create an array, and so starts with 1

Strings are arrays themself, so you need a 3d array:

pawn Код:
new RandomMove[5][2][24] =
{
    {"Library", "Anim Name"},
    {"Library", "Anim Name"},
    {"Library", "Anim Name"},
    {"Library", "Anim Name"},
    {"Library", "Anim Name"}
};
Edit: You can use the same ApplyAnimation code you used before.
There is always something new you learn every day!

By the way, Seko, you might wanna try and study this function.

https://sampwiki.blast.hk/wiki/ApplyAnimation


Re: Random Animation and SA:MP crashes - WillyP - 23.11.2010

Ugh, people using PHP tags pisses me off. :/


Re: Random Animation and SA:MP crashes - sekol - 23.11.2010

pawn Код:
Sorry -.-
PHP код:
Offtop? :
Anyway i think there's nothing wrong with my ApplyAnimation... I'll think about it tommorow...