12.03.2014, 04:11
hi all, whenever I /setrank ingame to a certain rank, reload the filterscript and log back in, the players rank is set back to 0.
if anyone is able to give me a hand
Код:
stock SavePlayerOrgInfo(playerid) { if (!dini_Exists(PlayerPath(playerid))) { dini_Create(PlayerPath(playerid)); } //dini_Set(savef,"ContactName1",ContactNames[0][playerid]); dini_Set(PlayerPath(playerid),"Org",Organization[PlayerOrg[playerid]][Name]); dini_Set(PlayerPath(playerid),"Rank",PlayerRank[playerid]); dini_IntSet(PlayerPath(playerid),"CollectedWage",CollectedWage[playerid]); }
Quote:
stock LoadPlayerOrgInfo(playerid) { new string[45]; format(string,sizeof(string),"%s",dini_Get(PlayerP ath(playerid),"Org")); PlayerOrg[playerid] = GetOrgID(string); PlayerRank[playerid] = dini_Int(PlayerPath(playerid),"Rank"); CollectedWage[playerid] = dini_Int(PlayerPath(playerid), "CollectedWage"); if (strcmp(Organization[PlayerOrg[playerid]][Leader], PlayerName(playerid),true) == 0 && PlayerOrg[playerid] != 0) { PlayerLeader[playerid] = 1; } |
Код:
CMD:setrank(playerid, params[]) { if (!IsLeader(playerid)) return SendClientMessage(playerid,COLOR_RED,"You are not the leader of an organization"); new ID, rank; if (sscanf(params, "ui", ID, rank)) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /setrank [playerid] [rank]"); /*if (rank > 6) return SendClientMessage(playerid, COLOR_RED,"The maximum rank is 6"); if (rank < 1) return SendClientMessage(playerid, COLOR_RED,"The minimum rank is 1");*/ if (!IsPlayerConnected(ID)) return 1; new org = PlayerOrg[playerid]; if (PlayerOrg[ID] != org) return SendClientMessage(playerid, COLOR_RED,"That player does not belong to your organization"); new string[120]; format(string,sizeof(string),"[FACTION]%s has given you rank: '%d'!", PlayerName(playerid), rank); SendClientMessage(ID, COLOR_YELLOW, string); format(string,sizeof(string),"You have given rank %d to %s", rank, PlayerName(ID)); SendClientMessage(playerid, COLOR_YELLOW, string); PlayerRank[ID] = rank; SavePlayerOrgInfo(ID); return 1; }