PDA

View Full Version : My command dosent works,i need some help


Mikibey
13/06/2012, 02:21 PM
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))
{
SendClientMessage(playerid, 0xFF0000AA, "The faction has been changed");
dini_IntSet(SERVER_USER_FILE, "Faction",PlayerInfo[playerid][pFaction] = amount);
}
}
return 1;
}


So as u see its easy to understand this code,basically the server is checking if the user has a dini file,if it has,it will change its "pFaction" id to what i type after id(command is /setfaction [id] [ammount].
But for some strange reasons the command works but it does not change the value in the server's user file...what is wrong here?I did something wrong?

Jonny5
13/06/2012, 02:23 PM
try it this way


PlayerInfo[playerid][pFaction] = amount;
dini_IntSet(SERVER_USER_FILE, "Faction",PlayerInfo[playerid][pFaction]);

Mikibey
13/06/2012, 02:33 PM
I tried,still dosent work:(

Mikibey
13/06/2012, 03:07 PM
So anyone can help me?

Mikibey
13/06/2012, 03:44 PM
So anyone pleasee