Y INI Problem!
#1

I have this command:
pawn Код:
CMD:createfaction(playerid, params[]) {
    if(PlayerInfo[playerid][pAdmin] >= 4) {

        new
            iFac = getFreeFaction(), amount, weapons, string[128];

        if(iFac == -1) {
            return SendClientMessage(playerid, -1, "There is too many factions.");
        }

        if(sscanf(params, "s[64]d", arrFaction[iFac][g_szFactionName], amount, weapons)) {
            return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /createfaction [name] [type(/factypes)]");
        }

        format(string, sizeof(string), "You have created a faction called %s, faction ID %i & type %d has been assigned to it!", arrFaction[iFac][g_szFactionName], iFac, amount);

        arrFaction[iFac][g_iFactionType] = amount;
        SendClientMessageEx(playerid, COLOR_WHITE, string);
        CreateDynamicFaction(iFac);
        SaveDynamicFaction();
    }
    return 1;
}
It creates the faction and adds the name in etc
But then when I add in a rank via /frankname it resets the faction name and the type and everything else to 0 so how can i make it fetch anything that is above 0 and then if it is save with the ranks and anything else??



pastebin link to saving, creating and loading code: http://pastebin.com/2R19fkTN

thanks
Reply
#2

It now just returns the USAGE: / blah blah blah thing

The problem is whenever I set a different rank or anything like that all the data resets to nothin
Reply
#3

remove the brackets and just eg[code]

if(sscanf(params, "s[64]d", arrFaction[iFac][g_szFactionName], amount, weapons))
return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /createfaction [name] [type(/factypes)]");

[code]

u dont need to bracket it
Reply
#4

What
Reply
#5

@T-Raw, look at ****** why you should use brackets.

@RL_Gaming,
pawn Код:
if(sscanf(params, "s[64]d", arrFaction[iFac][g_szFactionName], amount, weapons))
Check your "" (quote) and things what you have after comma (multi-dimension array, variable, variable) you should see what the problem is in sscanf.
Reply
#6

change d and add ii (because s[32]ii) 3 varriables after before u only had 2 watch amount weapons + arrfaction && u only had 2 which iz "s[64]d"
Reply
#7

There's no difference between "i" specifier and "d" specifier. Why did you written to him to change "d" specifer to "i"? There's no point of that and i've already told him what he need to do. Stop spamming then.
Reply
#8

I dont think you get it guys, sorry if i wrote it the wrong way

Theres nothing wrong my createfaction CMD it creates it etc already but for eg..
I create a faction, make myself the leader etc etc change the rank names, and then do /savedfs(saves dynamic factions) it saves the rank names but it changes all the other information I.E. faction name, type, vault money all back to default(0)
Reply
#9

Then post a /frankname code so we can help you
Reply
#10

pawn Код:
CMD:frankname(playerid, params[])
{
    if(arrFaction[playerid][p_iMember] < 0)
    {
        SendClientMessageEx(playerid, COLOR_WHITE, "You aren't in a faction.");
        return 1;
    }
    new factionid = arrFaction[playerid][g_iFactionID];
    new string[128], rank, rankname[32];
    if(sscanf(params, "ds[32]", rank, rankname)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /frankname [rank number 1-12] [rank name]");

    if(arrFaction[playerid][p_iMember] == 12)
    {
        if(rank < 1 || rank > 12)
        {
            SendClientMessageEx(playerid, COLOR_GREY, "Rank number must be from 1 to 12.");
            return 1;
        }
        if(strfind(rankname, "|", true) != -1)
        {
            SendClientMessageEx(playerid, COLOR_GRAD2,  "You can't use '|' in a rank name.");
            return 1;
        }
        if(strlen(rankname) >= 19 )
        {
            SendClientMessageEx( playerid, COLOR_GRAD1, "That rank name is too long, please refrain from using more than 19 characters." );
            return 1;
        }
        if(rank == 1)
        {
            strmid(arrFaction[factionid][p_iRank1], rankname, 0, strlen(rankname), 32);
            format(string, sizeof(string), "* You have changed Rank 1 to %s.",rankname);
            SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        }
        if(rank == 2)
        {
            strmid(arrFaction[factionid][p_iRank2], rankname, 0, strlen(rankname), 32);
            format(string, sizeof(string), "* You have changed Rank 2 to %s.",rankname);
            SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        }
        if(rank == 3)
        {
            strmid(arrFaction[factionid][p_iRank3], rankname, 0, strlen(rankname), 32);
            format(string, sizeof(string), "* You have changed Rank 3 to %s.",rankname);
            SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        }
        if(rank == 4)
        {
            strmid(arrFaction[factionid][p_iRank4], rankname, 0, strlen(rankname), 32);
            format(string, sizeof(string), "* You have changed Rank 4 to %s.",rankname);
            SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        }
        if(rank == 5)
        {
            strmid(arrFaction[factionid][p_iRank5], rankname, 0, strlen(rankname), 32);
            format(string, sizeof(string), "* You have changed Rank 5 to %s.",rankname);
            SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        }
        if(rank == 6)
        {
            strmid(arrFaction[factionid][p_iRank6], rankname, 0, strlen(rankname), 32);
            format(string, sizeof(string), "* You have changed Rank 6 to %s.",rankname);
            SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        }
        if(rank == 7)
        {
            strmid(arrFaction[factionid][p_iRank7], rankname, 0, strlen(rankname), 32);
            format(string, sizeof(string), "* You have changed Rank 7 to %s.",rankname);
            SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        }
        if(rank == 8)
        {
            strmid(arrFaction[factionid][p_iRank8], rankname, 0, strlen(rankname), 32);
            format(string, sizeof(string), "* You have changed Rank 8 to %s.",rankname);
            SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        }
        if(rank == 9)
        {
            strmid(arrFaction[factionid][p_iRank9], rankname, 0, strlen(rankname), 32);
            format(string, sizeof(string), "* You have changed Rank 9 to %s.",rankname);
            SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        }
        if(rank == 10)
        {
            strmid(arrFaction[factionid][p_iRank10], rankname, 0, strlen(rankname), 32);
            format(string, sizeof(string), "* You have changed Rank 10 to %s.",rankname);
            SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        }
        if(rank == 11)
        {
            strmid(arrFaction[factionid][p_iRank11], rankname, 0, strlen(rankname), 32);
            format(string, sizeof(string), "* You have changed Rank 11 to %s.",rankname);
            SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        }
        if(rank == 12)
        {
            strmid(arrFaction[factionid][p_iRank12], rankname, 0, strlen(rankname), 32);
            format(string, sizeof(string), "* You have changed Rank 12 to %s.",rankname);
            SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        }

        format(string, sizeof(string), "%s adjusted faction %d's rank %d to %s", GetPlayerNameEx(playerid), factionid+1, rank, rankname);
        Log("logs/factions.log", string);
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GREY, "   You are not high rank enough to use this command!");
        return 1;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)