COMMAND:gang(playerid,params[],option[]) { if(!strcmp(params, "create", true)) { if(gang[playerid][gid] != -1) return SendClientMessage(playerid,COLOR_GREEN, "[GANG]:{FFFFFF}Leave your gang with /gangleave before creating a new one!"); if(strlen(option) > 49 || strlen(option) < 3) return SendClientMessage(playerid, COLOR_GREEN, "[GANG]:{FFFFFF} /gangcreate (GANG NAME)"); if(IsgangTaken(option)) return SendClientMessage(playerid, COLOR_GREEN, "[GANG]:{FFFFFF}gang name is already in use!"); Creategang(option, playerid); return 1; } return 1; }
#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;
}
COMMAND:gang(playerid,option[])
{
if(!strcmp(option, "create", true))
{
if(sscanf(option, "s[128]", rest))return SendClientMessage(playerid, COLOR_GREEN, "[GANG]:{FFFFFF} /gang create [GANG NAME]");
if(gang[playerid][gid] != -1) return SendClientMessage(playerid,COLOR_GREEN, "[GANG]:{FFFFFF}Leave your gang with /gangleave before creating a new one!");
if(IsgangTaken(rest)) return SendClientMessage(playerid, COLOR_GREEN, "[GANG]:{FFFFFF}gang name is already in use!");
Creategang(rest, playerid);
return 1;
}
return 1;
}
COMMAND:gang(playerid, params[])
{
new i[7];
if (sscanf(params, "s[7]", i)) return SendClientMessage(playerid, COLOR_GREEN, "[GANG]:{FFFFFF} /gang create [GANG NAME]");
if (!strcmp(i, "create", true, 6))
{
if(sscanf(params, "s[128]", rest)) return SendClientMessage(playerid, COLOR_GREEN, "[GANG]:{FFFFFF} /gang create [GANG NAME]");
if(gang[playerid][gid] != -1) return SendClientMessage(playerid,COLOR_GREEN, "[GANG]:{FFFFFF}Leave your gang with /gangleave before creating a new one!");
if(IsgangTaken(rest)) return SendClientMessage(playerid, COLOR_GREEN, "[GANG]:{FFFFFF}gang name is already in use!");
Creategang(rest, playerid);
}
return 1;
}
i try this
PHP код:
|
#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;
}
CMD:gang(playerid, params[])
{
new
tmp_name[50];
if (!sscanf(params, "'create's[50]", tmp_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(!(3 <= strlen(tmp_name) <= 49)) return SendClientMessage(playerid, COLOR_GREEN, "[GANG]:{FFFFFF} /gang create (GANG NAME)");
if(IsgangTaken(tmp_name)) return SendClientMessage(playerid, COLOR_GREEN, "[GANG]:{FFFFFF}gang name is already in use!");
Creategang(tmp_name, playerid);
}
else if (!strcmp(params, "leave", true))
{
// code for "/gang leave"
}
else SendClientMessage(playerid, COLOR_GREEN, "[GANG]:{FFFFFF} /gang <create (GANG NAME)/leave>");
return 1;
}
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;
}