12.04.2013, 01:59
hello, i have a problem here...
evertime i do /makeleader between 11-17 he resets mt faction.cfg, how i do stop reset, just change
Quote:
if(strcmp(cmd, "/makeleader", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makeleader [playerid/PartOfName] [number]"); return 1; } new para1; para1 = ReturnUser(tmp); if(IsPlayerNPC(para1)) return 1; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makeleader [playerid/PartOfName] [number]"); return 1; } new faction; faction = strvalEx(tmp); if(faction < 0 || faction > 20 && faction != 666) { SendClientMessage(playerid, COLOR_GREY, " Dont go below number 0, or above number 11 !"); return 1; } if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pFactionMod] > 0) { if(IsPlayerConnected(para1)) { if(para1 != INVALID_PLAYER_ID) { new ftext[20]; GetPlayerName(playerid, sendername, sizeof(sendername)); GetPlayerName(para1, giveplayer, sizeof(giveplayer)); if(faction == 0) { PlayerInfo[para1][pModel] = 299; PlayerInfo[para1][pRank] = 0; ftext = "None"; } else if(faction == 1) { PlayerInfo[para1][pModel] = 265; PlayerInfo[para1][pRank] = 6; ftext = "Police Force"; } else if(faction == 2) { PlayerInfo[para1][pModel] = 286; PlayerInfo[para1][pRank] = 6; ftext = "FBI"; } else if(faction == 3) { PlayerInfo[para1][pModel] = 288; PlayerInfo[para1][pRank] = 6; ftext = "State Troopers"; } else if(faction == 4) { PlayerInfo[para1][pModel] = 274; PlayerInfo[para1][pRank] = 6; ftext = "Firemen/Ambulance"; } else if(faction == 5) { PlayerInfo[para1][pModel] = 287; PlayerInfo[para1][pRank] = 6; ftext = "Prison Guards"; } else if(faction == 6) { PlayerInfo[para1][pModel] = 147; PlayerInfo[para1][pRank] = 6; ftext = "Senate"; } else if(faction == 7) { return 1; } else if(faction == 8 ) { PlayerInfo[para1][pModel] = 294; PlayerInfo[para1][pRank] = 6; ftext = "Hitman Agency"; } else if(faction == 9) { PlayerInfo[para1][pModel] = 227; PlayerInfo[para1][pRank] = 8; ftext = "News Agency"; } else if(faction == 10) { PlayerInfo[para1][pModel] = 61; PlayerInfo[para1][pRank] = 6; ftext = "Taxi Cab Company"; } else if(faction == 11) { PlayerInfo[para1][pModel] = 106; PlayerInfo[para1][pRank] = 6; ftext = "Grove Street";strmid(facInfo[0][factionName], ftext, 0, strlen(ftext), 255); PlayerInfo[para1][pfac] = 0; } else if(faction == 12) { PlayerInfo[para1][pModel] = 115; PlayerInfo[para1][pRank] = 6; ftext = "Aztecas";strmid(facInfo[1][factionName], ftext, 0, strlen(ftext), 255); PlayerInfo[para1][pfac] = 1; } else if(faction == 13) { PlayerInfo[para1][pModel] = 109; PlayerInfo[para1][pRank] = 6; ftext = "Vagos";strmid(facInfo[2][factionName], ftext, 0, strlen(ftext), 255); PlayerInfo[para1][pfac] = 2; } else if(faction == 14) { PlayerInfo[para1][pModel] = 120; PlayerInfo[para1][pRank] = 6; ftext = "Triads";strmid(facInfo[3][factionName], ftext, 0, strlen(ftext), 255); PlayerInfo[para1][pfac] = 3; } else if(faction == 15) { PlayerInfo[para1][pModel] = 112; PlayerInfo[para1][pRank] = 6; ftext = "Saji Yakuza";strmid(facInfo[4][factionName], ftext, 0, strlen(ftext), 255); PlayerInfo[para1][pfac] = 4; } else if(faction == 16) { PlayerInfo[para1][pModel] = 123; PlayerInfo[para1][pRank] = 6; ftext = "Outlaws";strmid(facInfo[5][factionName], ftext, 0, strlen(ftext), 255); PlayerInfo[para1][pfac] = 5; } else if(faction == 17) { PlayerInfo[para1][pModel] = 104; PlayerInfo[para1][pRank] = 6; ftext = "Ballas"; strmid(facInfo[6][factionName], ftext, 0, strlen(ftext), 255); PlayerInfo[para1][pfac] = 6; } else if(faction == 666) { PlayerInfo[para1][pModel] = 165; PlayerInfo[para1][pRank] = 6; ftext = "Sector 9"; } format(string, sizeof(string), "* You have given %s leadership of the %s.", giveplayer,ftext); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "* %s has given you leadership of the %s.",sendername,ftext); SendClientMessage(para1, COLOR_LIGHTBLUE, string); PlayerInfo[para1][pLeader] = faction; PlayerInfo[para1][pMember] = faction; SetPlayerSkin(para1, PlayerInfo[para1][pModel]); SetPlayerToTeamColor(playerid); OnPlayerSave(para1); Savefaction(); } } } else { SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !"); } } return 1; } |
Quote:
public Savefaction() { new idx; new File: file2; while (idx < sizeof(facInfo)) { new coordsstring[512]; format(coordsstring, sizeof(coordsstring), "%s|%d|%d|%d|%d|%d\n", facInfo[idx][factionName], facInfo[idx][factionBank], facInfo[idx][factionCash], facInfo[idx][factionPot], facInfo[idx][factionCrack], facInfo[idx][factionMats]); if(idx == 0) { file2 = fopen("faction.cfg", io_write); } else { file2 = fopen("faction.cfg", io_append); } fwrite(file2, coordsstring); idx++; fclose(file2); } return 1; } |