13.06.2012, 21:05
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;
}
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".