29.09.2011, 02:36
I'm using zcmd and sscanf, but within a /anim command to save making every single one it's own command..... I use strcmp to check if the params match.
For example:
Now if I use /anim rsmg or any other defined param, it works. If I use /anim followed by any character at all, it tells me how to use it properly (the else statement fires up). BUT if I just use /anim or /anim (with space(s)) it actually in my case used the gun reloading animation.....
I even did a format/SendClientMessage to see exactly what was being compared and it all adds up. How can it possibly say that "" or " " is equal to "rdeagle" or some such.....?
For example:
Код:
CMD:anim(playerid, params[]) { new aStr[32] // All animations in one command. sscanf(params, "s[32] ", aStr); if (strcmp("rsmg", aStr, true) == 0 || strcmp("rm4", aStr, true) == 0 || strcmp("rak", aStr, true) == 0) { OnePlayAnim(playerid, "UZI", "UZI_reload", 4.0, 0, 0, 0, 0, 0); } else if (strcmp("rdeagle", aStr, true) == 0) { OnePlayAnim(playerid, "COLT45", "colt45_reload", 4.0, 0, 0, 0, 0, 1); } else if (strcmp("carjacked1", aStr, true) == 0) { LoopingAnim(playerid, "PED", "CAR_jackedLHS", 4.0, 0, 1, 1, 1, 0); } else if (strcmp("carjacked2", aStr, true) == 0) { LoopingAnim(playerid, "PED", "CAR_jackedRHS", 4.0, 0, 1, 1, 1, 0); } else { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /anim [animation]"); } return 1; }
I even did a format/SendClientMessage to see exactly what was being compared and it all adds up. How can it possibly say that "" or " " is equal to "rdeagle" or some such.....?