Problem rank
#6

I do not know if this is it
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;
}
Old code
Code:
new query[512], id, type, ranks[256], rank[MAX_RANG][MAX_RANG_LEN];
Reply


Messages In This Thread
Problem rank - by KamilPolska - 01.04.2019, 15:46
Re: Problem rank - by YenTy - 02.04.2019, 12:07
Re: Problem rank - by KamilPolska - 02.04.2019, 17:00
Re: Problem rank - by KamilPolska - 02.04.2019, 18:25
Re: Problem rank - by YenTy - 02.04.2019, 18:48
Re: Problem rank - by KamilPolska - 02.04.2019, 19:21
Re: Problem rank - by KamilPolska - 02.04.2019, 21:12
Re: Problem rank - by YenTy - 02.04.2019, 21:41
Re: Problem rank - by KamilPolska - 02.04.2019, 22:56
Re: Problem rank - by KamilPolska - 03.04.2019, 16:46
Re: Problem rank - by Logic_ - 03.04.2019, 18:04
Re: Problem rank - by KamilPolska - 03.04.2019, 18:36
Re: Problem rank - by KamilPolska - 04.04.2019, 14:46
Re: Problem rank - by KamilPolska - 04.04.2019, 18:10
Re: Problem rank - by Logic_ - 04.04.2019, 18:43
Re: Problem rank - by KamilPolska - 05.04.2019, 16:26

Forum Jump:


Users browsing this thread: 1 Guest(s)