30.05.2015, 18:21
I don't see your logic to name functions like "Creategang(...)", it's weird.
Parse "rest" for more arguments.
pawn Код:
#define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
CMD:gang(playerid, params[])
{
new option[128], rest[128];
if(sscanf(params, "s[128]s[128]", option, rest)) return SendClientMessage(playerid, COLOR_GREEN, "Options: create, leave.");
if(strcmp(option, "create", true) == 0)
{
if(isnull(rest)) return SendClientMessage(playerid, COLOR_GREEN, "Usage: /gang create (gang name).");
if(gang[playerid][gid] != -1) return SendClientMessage(playerid, COLOR_GREEN, "[GANG]: {FFFFFF}Leave your gang with /gang leave before creating a new one!");
if(strlen(rest) < 3 || strlen(rest) > 49) return SendClientMessage(playerid, COLOR_GREEN, "[GANG]: {FFFFFF}Gang name must remain in the range of 3 and 49 characters.");
if(IsgangTaken(rest)) return SendClientMessage(playerid, COLOR_GREEN, "[GANG]: {FFFFFF}Gang name is already in use!");
Creategang(rest, playerid);
}
else if(strcmp(option, "leave", true) == 0)
{
if(gang[playerid][gid] == -1) return SendClientMessage(playerid, COLOR_GREEN, "[GANG]: {FFFFFF}You are not in a gang.");
gang[playerid][gid] = -1;
}
else return SendClientMessage(playerid, COLOR_GREEN, "Options: create, leave.");
return 1;
}