SA-MP Forums Archive
Many (Y)CMD or one with strcmp (animations) - 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: Many (Y)CMD or one with strcmp (animations) (/showthread.php?tid=658293)



Many (Y)CMD or one with strcmp (animations) - GospodinX - 31.08.2018

Hi guys,

Just one simple question:
What is better,create 81 commands or one command with strcmp(For animatinos).

For example:
-Many CMD

Код:
YCMD:sit(playerid, params[], help)
{
	if(IsPlayerInAnyVehicle(playerid)) return 1;
	LoopingAnim(playerid,"PED","SEAT_IDLE",4.0, 1, 0, 0, 0, 0);
	return 1;
}

YCMD:crabs(playerid, params[],help)
{
	if(IsPlayerInAnyVehicle(playerid)) return 1;
    LoopingAnim(playerid, "MISC", "Scratchballs_01", 4.0, 1, 0, 0, 0, 0);
    return 1;
}

YCMD:salute(playerid, params[], help)
{
	if(IsPlayerInAnyVehicle(playerid)) return 1;
    LoopingAnim(playerid, "ON_LOOKERS", "Pointup_loop", 4.0, 1, 0, 0, 0, 0);
    return 1;
}

YCMD:jerkoff(playerid, params[], help)
{
	if(IsPlayerInAnyVehicle(playerid)) return 1;
    LoopingAnim(playerid, "PAULNMAC", "wank_out", 4.0, 1, 0, 0, 0, 0);
    return 1;
}
or
-One CMD with strcmp

Код:
YCMD:anim(playerid,params[],help)
{
	if(IsPlayerInAnyVehicle(playerid)) return 1;
	new animname[32];
	if(sscanf(params, "s[32]", animname)) return SendClientMessage(playerid,-1,"Use /anim [ name ]");
	if(!strcmp( animname, "list")) SendClientMessage(playerid,-1,"sit, crabs, salute, jerkoff");
	else if(!strcmp( animname, "sit")) LoopingAnim(playerid,"PED","SEAT_IDLE",4.0, 1, 0, 0, 0, 0);
	else if(!strcmp( animname , "crabs")) LoopingAnim(playerid, "MISC", "Scratchballs_01", 4.0, 1, 0, 0, 0, 0);
	else if(!strcmp( animname , "salute")) LoopingAnim(playerid, "ON_LOOKERS", "Pointup_loop", 4.0, 1, 0, 0, 0, 0);
	else if(!strcmp( animname , "jerkoff"))LoopingAnim(playerid, "PAULNMAC", "wank_out", 4.0, 1, 0, 0, 0, 0);
	else SendClientMessage(playerid,-1,"Wrong name,/anim list for list of animations");
	return 1;
}
In my mode I have 631 commands,so I think it's big number because I need to increase MAX_COMMANDS( #define MAX_COMMANDS 1024 ). So I think that I need to reduce number of commands.


Re: Many (Y)CMD or one with strcmp (animations) - Eoussama - 31.08.2018

I think using one single command for applying all other animations is more user-friendly than having separate commands for each type of animation.