Command Not Working
#1

pawn Код:
CMD:factioninfo(playerid, params[])
{
    new
    string[128], string2[256], id;
   
    if(sscanf(params, "d", id)) return SendClientMessage(playerid, COLOR_GREY, "[Usage]: /factioninfo [factionID]");
    if(id < 1 || id > 10 ) return SCM(playerid, COLOR_LIGHTRED, "Invalid faction ID.");
   
    for(new f = 1;f < sizeof(FactionInfo);f++)
    {
        if(f == id)
        {
            SCM(playerid, COLOR_GREEN, "_______________________________"COL_WHITE"[FACTION INFO]"COL_GREEN"_______________________________");
            format(string, sizeof(string), "Name: %s", FactionInfo[id][fName]);
            SendClientMessage(playerid, COLOR_WHITE, string);
            format(string, sizeof(string), "Members: %d", FactionInfo[id][fMembers]);
            SendClientMessage(playerid, COLOR_WHITE, string);
            format(string2, sizeof(string2), "Information: %s", FactionInfo[id][fInformation]);
            SendClientMessage(playerid, COLOR_WHITE, string2);
            break;
        }
    }
    return 1;
}
Doesn't load real information. I suspect something is wrong with this line.
pawn Код:
if(f == id)
I want to loop through the 10 static factions and pick the one that matches the id I wrote in the command.
Reply
#2

What's the point on using a loop? You already got id as index.
Reply
#3

I don't know... Still not working.

pawn Код:
CMD:factioninfo(playerid, params[])
{
    new
    string[128], string2[256], id;
   
    if(sscanf(params, "d", id)) return SendClientMessage(playerid, COLOR_GREY, "[Usage]: /factioninfo [factionID]");
    if(id < 1 || id > 10 ) return SCM(playerid, COLOR_LIGHTRED, "Invalid faction ID.");
   
    SCM(playerid, COLOR_GREEN, "_______________________________"COL_WHITE"[FACTION INFO]"COL_GREEN"_______________________________");
    format(string, sizeof(string), "Name: %s", FactionInfo[id][fName]);
    SendClientMessage(playerid, COLOR_WHITE, string);
    format(string, sizeof(string), "Members: %d", FactionInfo[id][fMembers]);
    SendClientMessage(playerid, COLOR_WHITE, string);
    format(string2, sizeof(string2), "Information: %s", FactionInfo[id][fInformation]);
    SendClientMessage(playerid, COLOR_WHITE, string2);
    return 1;
}
It saves in scriptfiles correctly. And I load it in the script. I haven't learned everything about y_ini yet.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)