CMD:gcreate(playerid,params[])
{
if(playerGang[playerid]>0)
return SendClientMessage(playerid, -1, ""COL_RED"ERROR:{FFFFFF} You are already in a gang.");
if(sscanf(params,"s[16]",params[0]))
return SendClientMessage(playerid, -1, ""COL_LIGHTBLUE"Usage:{FFFFFF} /gcreate <gangname> (Max 16 char)");
new string[128];
for(new i = 1; i < MAX_GANGS; i++)
{
if(gangInfo[i][0]==0)
{
//name gang
format(gangNames[i], MAX_GANG_NAME, "%s", params[0]);
//Gang exists
gangInfo[i][0]=1;
//There is one member
gangInfo[i][1]=1;
//Gang color is player's color
gangInfo[i][2]=PlayerColors[playerid];
//Player is the first gang member
gangMembers[i][0] = playerid;
format(string, sizeof(string),"You have created the gang '%s' (id: %d)", gangNames[i], i);
SendClientMessage(playerid, COLOR_GREEN, string);
playerGang[playerid]=i;
}
}
return 1;
}
CMD:gcreate(playerid,params[])
{
if(playerGang[playerid]>0)
return SendClientMessage(playerid, -1, ""COL_RED"ERROR:{FFFFFF} You are already in a gang.");
if(!strlen(params[0]))
return SendClientMessage(playerid, -1, ""COL_LIGHTBLUE"Usage:{FFFFFF} /gcreate <gangname> (Max 16 char)");
new string[128];
for(new i = 1; i < MAX_GANGS; i++)
{
if(gangInfo[i][0]==0)
{
//name gang
format(gangNames[i], MAX_GANG_NAME, "%s", params[0]);
//Gang exists
gangInfo[i][0]=1;
//There is one member
gangInfo[i][1]=1;
//Gang color is player's color
gangInfo[i][2]=PlayerColors[playerid];
//Player is the first gang member
gangMembers[i][0] = playerid;
format(string, sizeof(string),"You have created the gang '%s' (id: %d)", gangNames[i], i);
SendClientMessage(playerid, COLOR_GREEN, string);
playerGang[playerid]=i;
return 1;
}
}
return 1;
}
I dont think so that the problem would be sscanf since it works perfect and returns
the exact command usage without warnings in the logs, therefore, ******'s foreach will fix the problem? |