22.12.2009, 21:41
Код:
if (strcmp(cmd, "/makegang", true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /makegang [4 digit number]"); new id; id = strval(tmp); if(id >= 9999 || id <= 1000) { SendClientMessage(playerid, COLOR_GRAD1, "The gang you are creating must be between 1000-9999"); } else { gChat[playerid] = id; PlayerInfo[playerid][pGChat] = id; } return 1; } if (strcmp(cmd, "/joingang", true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /joingang [gangid 1000-9999]"); new id; id = strval(tmp); if(id >= 9999 || id <= 1000) { SendClientMessage(playerid, COLOR_GRAD1, "The gang you are creating must be between 1000-9999"); } else { gChat[playerid] = id; PlayerInfo[playerid][pGChat] = id; } return 1; } if (strcmp(cmd, "/quitgang", true) == 0) { gChat[playerid] = 0; PlayerInfo[playerid][pGChat] = 0; return 1; } if(strcmp(cmd, "/gang", true) == 0 || strcmp(cmd, "/g", true) == 0) { if(IsPlayerConnected(playerid)) { if(gChat[playerid] != 0) { GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/g)ang [gang chat]"); return 1; } format(string, sizeof(string), "%s: %s ", sendername, result); GangChat(COLOR_GCHAT,string); printf("%s", string); } else { SendClientMessage(playerid, COLOR_GRAD2, " you arn't in a gang!"); return 1; } }//not connected return 1; }
Код:
public GangChat(color,const string[]) { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(!gChat[i]) { SendClientMessage(i, color, string); } } } }