SA-MP Forums Archive
applyanimation crashing the game? - 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: applyanimation crashing the game? (/showthread.php?tid=311968)



applyanimation crashing the game? - the.et - 19.01.2012

Hi ,
i'm trying to make a command which i can test out each animations in-game.

(i'm using SSCANF and ZCMD)

Код:
CMD:tryanim( playerid,params[])
{
	    
   	if ( sscanf( params, "sssi", params[ 0 ], params[ 1 ], params[ 2 ], params[ 3 ] ) )
	    return SendClientMessage( playerid, COLOR_LIGHTBLUE , "Usage:{FFFFFF} /tryanim <library> <name> <speed 1.0-10.0> <loop 0/1>");


    ApplyAnimation(playerid, params[ 0 ], params[ 1 ], params[ 2 ], params[ 3 ], 0, 0, 0, 0); // Sit
    return 1;
}
But when i click enter for the command , for example , /tryanim BD_FIRE BE_Fire1 4.0 1 , my game just crashes.

I hope someone can help me point out my mistake.

Thankss


Re: applyanimation crashing the game? - MP2 - 19.01.2012

You're using sscanf wrong.


Re: applyanimation crashing the game? - the.et - 19.01.2012

how to correct it?


Re: applyanimation crashing the game? - [ABK]Antonio - 19.01.2012

pawn Код:
new lib[30], name[30], //these would be the max sizes
    Float:speed, loop;
if (sscanf(params, "s[30]s[30]fi", lib, name, speed, loop)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage:{FFFFFF} /tryanim <library> <name> <speed 1.0-10.0> <loop 0/1>");
if(loop > 1 || loop < 0) return SendClientMessage(playerid, COLOR_RED, "Loop must be either 0 or 1");
if(speed < 1.0 || speed > 10.0) return SendClientMessage(playerid, COLOR_RED, "Speed can be no less than 1.0 and no greater than 10.0");
//some checks for lib/name..
ApplyAnimation(playerid, lib, name, speed, loop, 0, 0, 0, 0); // Sit



Re: applyanimation crashing the game? - the.et - 19.01.2012

Thanks Antonio