02.04.2019, 19:21
I do not know if this is it
Old code
Code:
CMD:saveranks(playerid, params[]) { for(new i=0;i<MAX_FRAC;i++) { if(RANG_ApplyChanges[0][i]) EDIT_SaveRanks(0, i); } for(new i=0;i<MAX_ORG;i++) { if(RANG_ApplyChanges[1][i]) EDIT_SaveRanks(1, i); } SendClientMessage(playerid, -1, "Save ranks!"); return 1; } stock EDIT_SaveRanks(typ, uid) { new lStr[256], query[512]; for(new i = 0; i < MAX_RANG; i++) { if(strlen((typ == 0) ? (FracRang[uid][i]) : (FamRang[uid][i])) < 2) { format(lStr, 256, "%s-, ", lStr); } else { format(lStr, 256, "%s%s, ", lStr, (typ == 0) ? (FracRang[uid][i]) : (FamRang[uid][i])); } } strdel(lStr, strlen(lStr)-2, strlen(lStr)); format(query, 512, "SELECT `ID` FROM namerank WHERE `ID` = '%d' AND `type` = '%d'", uid, type+1); mysql_query(g_SQL, query); if(cache_num_rows() > 0) { format(query, 512, "UPDATE namerank SET ranks = '%s' WHERE `ID` = '%d' AND `type` = '%d'", lStr, uid, type+1); } else { format(query, 512, "INSERT INTO namerank (ranks, ID, type) VALUES ('%s', '%d', '%d')", lStr, uid, type+1); } mysql_query(g_SQL, query); RANG_ApplyChanges[type][uid] = false; return 1; }
Code:
new query[512], id, type, ranks[256], rank[MAX_RANG][MAX_RANG_LEN];