DCMD need help
#2

pawn Код:
dcmd_setfaction(playerid, params[])
{
    new giveplayerid, amount;
    if(sscanf(params, "ud", giveplayerid, amount)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /setfaction [playerid] [factionid]");
    else if(giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
    else
    {
        new name[MAX_PLAYER_NAME], file[256];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!dini_Exists(file))
        {
            SendClientMessage(playerid, 0xFF0000AA, "Player is not registred");
        }
        if(fexist(file))
        {
            PlayerInfo[playerid][pFaction] = amount;
            dini_IntSet(SERVER_USER_FILE, "Faction",amount);
        }
    }
    return 1;
}
First off, just wanted to indent your code. Made it look a bit neater.

Second, could it be because in "dini_IntSet" your setting the "faction" part of the file your pFaction? I'm not sure if that would work, because it may take a certain amount of time for it to process (such as when you use GetPlayerPos after SetPlayerPos, or whatever) so I just set it to the new variable "amount".
Reply


Messages In This Thread
DCMD need help - by Mikibey - 13.06.2012, 20:55
Re: DCMD need help - by Kindred - 13.06.2012, 21:05
Re: DCMD need help - by Mikibey - 13.06.2012, 21:09
Re: DCMD need help - by Mikibey - 13.06.2012, 21:13
Re: DCMD need help - by Kindred - 13.06.2012, 21:18
Re: DCMD need help - by Mikibey - 13.06.2012, 21:27
Re: DCMD need help - by Mikibey - 13.06.2012, 21:29
Re: DCMD need help - by Kindred - 13.06.2012, 21:33
Re: DCMD need help - by Mikibey - 13.06.2012, 21:37

Forum Jump:


Users browsing this thread: 2 Guest(s)