30.05.2015, 20:52
Here is my version ;p
pawn Код:
CMD:gang(playerid, params[])
{
if(isnull(params)) SendClientMessage(playerid, COLOR_GREEN, "Usage: /gang [create / leave]");
else
{
if(strcmp(params, "create", true, 6) == 0)
{
strdel(params,0,6); // removing 'create' from params
if(isnull(params)) SendClientMessage(playerid, COLOR_GREEN, "Usage: /gang create (gang name).");
else if(gang[playerid][gid] != -1) SendClientMessage(playerid, COLOR_GREEN, "[GANG]: {FFFFFF}Leave your gang with /gang leave before creating a new one!");
else if(!(2 < strlen(params[1]) < 50)) SendClientMessage(playerid, COLOR_GREEN, "[GANG]: {FFFFFF}Gang name must remain in the range of 3 and 49 characters.");
else if(IsgangTaken(params[1])) SendClientMessage(playerid, COLOR_GREEN, "[GANG]: {FFFFFF}Gang name is already in use!");
else Creategang(params[1], playerid);
}
else if(strcmp(params, "leave", true, 5) == 0)
{
if(gang[playerid][gid] == -1) SendClientMessage(playerid, COLOR_GREEN, "[GANG]: {FFFFFF}You are not in a gang.");
else
{
gang[playerid][gid] = -1;
SendClientMessage(playerid, COLOR_GREEN, "[GANG]: {FFFFFF}You are not in any gang now :>");
}
}
else SendClientMessage(playerid, COLOR_GREEN, "Usage: /gang [create / leave]");
}
return 1;
}