10.03.2018, 19:38
It saves vehicles and other stuff, but ranks i save actually save but won't load.
Код:
CMD:addranks(playerid, params[]) { new giveplayerid, rank, string[256], strings[256], tmp[256], giveplayers[256]; if (orgleader[playerid] == 0) return SendClientMessage2(playerid, COLOR_RED, "Error:{FFFFFF} You aren't the (co)leader of an organization."); if(sscanf(params, "d",rank)) return SendClientMessage(playerid, COLOR_WHITE,"USAGE: /addranks [rank]"); if(rank > 12) return SendClientMessage(playerid, COLOR_WHITE,"Error:{FFFFFF} You can add only 12 ranks to your Orginization!"); if(rank < 1) return SendClientMessage(playerid, COLOR_WHITE,"Error:{FFFFFF} Ranks must be greater then 1 rank!"); giveplayerid = GetPVarInt(playerid, "playerorg"); format(string, 10, "org%d", giveplayerid); new temp = dini_Int(AddDirFile(dir_orgfiles, string), "AmountRanks"); if(temp != 0) return SendClientMessage(playerid, COLOR_RED, "Error:{FFFFFF} You have already set ranks to this Orginization!"); for(new i = 1; i<= rank; i++) { format(giveplayers, 12, "rank%d", i); format(tmp, 12, "rankcolor%d", i); dini_Set(AddDirFile(dir_orgfiles, string), giveplayers, "none"); dini_IntSet(AddDirFile(dir_orgfiles, string), "AmountRanks", i); } format(strings, sizeof(strings), "You have created %d ranks for your organization", rank); SendClientMessage(playerid,COLOR_LBLUE, strings); return 1; } CMD:dranks(playerid, params[]) { new giveplayerid, string[256], tmp[256], giveplayers[256], tmps[256], tmp2[256]; if (orgleader[playerid] == 0) return SendClientMessage2(playerid, COLOR_RED, "Error:{FFFFFF} You aren't the (co)leader of an organization."); giveplayerid = GetPVarInt(playerid, "playerorg"); format(string, 10, "org%d", giveplayerid); new temp = dini_Int(AddDirFile(dir_orgfiles, string), "AmountRanks"); if(temp == 0) return SendClientMessage(playerid, COLOR_RED, "Error:{FFFFFF} You have already delete ranks to this Orginization!"); else if(temp != 0) { new temp1 = dini_Int(AddDirFile(dir_orgfiles, string), "maxmembers"); for(new j = 1; j <= temp1; j++) { format(tmps, 12, "member%d", j); tmp2 = dini_Get(AddDirFile(dir_orgfiles, string), tmps); if(strcmp(tmp2, "server", false) != 0) { dini_Unset(AddDirFile(dir_orgfiles, tmp2), "RankName"); dini_Unset(AddDirFile(dir_orgfiles, tmp2), "Rank"); dini_Unset(AddDirFile(dir_orgfiles, tmp2), "RankColor"); } } for(new i = 1; i <= temp; i++) { format(giveplayers, 12, "rank%d", i); format(tmp, 12, "rankcolor%d",i); dini_Unset(AddDirFile(dir_orgfiles, string), giveplayers); dini_Unset(AddDirFile(dir_orgfiles, string), tmp); dini_IntSet(AddDirFile(dir_orgfiles, string), "AmountRanks", 0); } } SendClientMessage(playerid, COLOR_RED, "You have deleted all created ranks from your Organization!"); return 1; } CMD:rankname(playerid, params[]) { new tmp2[256], tmp[20], tmp3[20],number, string[20], str[120], color[128],giveplayer[256],tmp7[256]; if (orgleader[playerid] != 1) return SendClientMessage2(playerid, COLOR_RED, "Error:{FFFFFF} You aren't the leader of an organization."); if (sscanf(params, "ds[128]s[128]", number, color,tmp2)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /rankname [rank number] [rank color] [rank name]"); new giveplayerid = GetPVarInt(playerid, "playerorg"); format(string, 10, "org%d", giveplayerid); new temp4 = dini_Int(AddDirFile(dir_orgfiles, string), "maxmembers"); for (new c = 1; c <= number; c++) { format(tmp, 12, "rank%d", number); format(tmp3, 12, "rankcolor%d", number); if (!dini_Isset(AddDirFile(dir_orgfiles, string), tmp)) { SendClientMessage2(playerid, COLOR_RED, "Rank on this spot is not created yet."); return 1; } dini_Set(AddDirFile(dir_orgfiles, string), tmp, tmp2); dini_Set(AddDirFile(dir_orgfiles, string), tmp3, color); if (temp4 != 0) { for (new i = 1; i <= temp4; i++) { format(giveplayer, 12, "member%d", i); tmp7 = dini_Get(AddDirFile(dir_orgfiles, string), giveplayer); if (dini_Isset(AddDirFile(dir_userfiles, tmp7), "RankName") && dini_Int(AddDirFile(dir_userfiles, tmp7), "Rank") == number) { dini_Set(AddDirFile(dir_userfiles, tmp7), "RankName", tmp2); dini_Set(AddDirFile(dir_userfiles, tmp7), "RankColor", color); } } } } format(str, sizeof(str), "You have set rank %d name to %s with color {%s}%s", number, tmp2, color, color); SendClientMessage(playerid, COLOR_WHITE, str); return 1; } CMD:setrank(playerid, params[]) { new giveplayerid, rank, pname[64], str[150], string[10], tmp[10], tmp2[15], tmp6[256]; new giveplayerids = GetPVarInt(playerid, "playerorg"); if (sscanf(params, "ud", giveplayerid, rank)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /setrank [playerid] [rank]"); if (!IsPlayerConnected2(giveplayerid)) return SendClientMessage2(playerid, COLOR_RED, "Error:{FFFFFF} Inactive player id!"); format(string, 10, "org%d", giveplayerids); GetPlayerName(giveplayerid,pname, MAX_PLAYER_NAME); new maxranks = dini_Int(AddDirFile(dir_orgfiles, string), "Amountranks"); new currrank = dini_Int(AddDirFile(dir_userfiles, pname), "Rank"); if (maxranks == 0) return SendClientMessage2(playerid, COLOR_RED, "There is no ranks created in your organization."); if(rank > maxranks || rank < 1) return SendClientMessage2(playerid, COLOR_RED, "Invalid rank!"); if(rank == currrank) return SendPlayerFormattedText(playerid, COLOR_RED, "%s is already have that rank!", pname, ""); if(rank > maxranks) return SendClientMessage2(playerid, COLOR_RED, "No rank found!"); if (GetPVarInt(giveplayerid, "playerorg") != GetPVarInt(playerid, "playerorg")) return SendPlayerFormattedText(playerid, COLOR_RED, "%s is not in your organization!", pname, ""); for (new c = 1; c <= rank; c++) { format(tmp, 12, "rank%d", rank); format(tmp2, 12, "rankcolor%d", rank); } tmp6 = dini_Get(AddDirFile(dir_orgfiles, string), tmp); if (strcmp(tmp6, "None", false) == 0) return SendClientMessage(playerid,COLOR_RED,"Choose a name for this rank first."); if (giveplayerid != playerid) { format(str,sizeof(str),"You have set %s rank to {%s}%s", pname,dini_Get(AddDirFile(dir_orgfiles, string), tmp2),dini_Get(AddDirFile(dir_orgfiles, string), tmp)); SendClientMessage(playerid, COLOR_YELLOW,str); format(str,sizeof(str),"Your leader has set your to rank {%s}%s", dini_Get(AddDirFile(dir_orgfiles, string), tmp2), dini_Get(AddDirFile(dir_orgfiles, string), tmp)); SendClientMessage(giveplayerid, COLOR_YELLOW,str); } else { format(str,sizeof(str),"You have set your rank to {%s}%s", dini_Get(AddDirFile(dir_orgfiles, string), tmp2), dini_Get(AddDirFile(dir_orgfiles, string), tmp)); SendClientMessage(playerid, COLOR_YELLOW,str); } dini_IntSet(AddDirFile(dir_userfiles, pname), "Rank", rank); dini_Set(AddDirFile(dir_userfiles, pname), "RankName", dini_Get(AddDirFile(dir_orgfiles, string), tmp)); dini_Set(AddDirFile(dir_userfiles, pname), "RankColor", dini_Get(AddDirFile(dir_orgfiles, string), tmp2)); return 1; }