15.05.2010, 16:40
Код:
if(strcmp(cmd, "/makefaction", true) == 0) { if(gAdminOnDuty[playerid] != 1) { SendClientMessage(playerid, COLOR_GRAD2, "You must be on duty to use this command!"); return 1; } if (PlayerInfo[playerid][pAdmin] < 8) { SendClientMessage(playerid, COLOR_RED, "Invalid admin level, you cannot use this command"); return 1; } new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[256]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_WHITE, "[ ! ] USAGE: /makefaction (Faction name) (Faction ID)"); return 1; } tmp = strtok(cmdtext,idx); if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "[ ! ] USAGE: /makefaction (Faction name) (Faction ID)"); new factionid; factionid = strval(tmp); format(string, sizeof(string), "/settings/factions.cfg", playername); new File: file = fopen(string, io_read); new File:hFile; hFile = fopen(string, io_append); new var[32];// format(var, 32, "%s fName\n",result);fwrite(hFile,var); format(var, 32, "%s fLeader\n", FactionInfo[factionid][fLeader]);fwrite(hFile, var); format(var, 32, "%d fID\n", FactionInfo[factionid][fID]);fwrite(hFile, var); format(var, 32, "%s fRank1\n", FactionInfo[factionid][fRank1]);fwrite(hFile, var); format(var, 32, "%s fRank2\n", FactionInfo[factionid][fRank2]);fwrite(hFile, var); format(var, 32, "%s fRank3\n", FactionInfo[factionid][fRank3]);fwrite(hFile, var); format(var, 32, "%s fRank4\n", FactionInfo[factionid][fRank4]);fwrite(hFile, var); format(var, 32, "%s fRank5\n", FactionInfo[factionid][fRank5]);fwrite(hFile, var); fclose(hFile); return 1; }