13.06.2012, 20:55
So i've tried to make a DCMD command that can change an user dini's enum to a certain value.
Example "Setfaction 12 1300" [id] [Factionid]
and in users Faction to be set at 1300
I have made some code,it works,it compiles with no error,but when i type the command the Faction value does not change...Please can you guys give me an advice on how i should code it in order to work?
My code
Example "Setfaction 12 1300" [id] [Factionid]
and in users Faction to be set at 1300
I have made some code,it works,it compiles with no error,but when i type the command the Faction value does not change...Please can you guys give me an advice on how i should code it in order to work?
My code
Код:
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",PlayerInfo[playerid][pFaction]);
}
}
return 1;
}


i think i understand