PDA

View Full Version : Team ID not saving


arjanforgames
26/07/2013, 09:28 PM
I have these two commands:

CMD:makeleader(playerid, params[])
{
new player;
if(player != INVALID_PLAYER_ID)
{
if(PlayerInfo[playerid][pAdmin] >= 99998)
{
new aName[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME], faction;
new string[128];
GetPlayerName(playerid, aName, MAX_PLAYER_NAME);
GetPlayerName(player, pName, MAX_PLAYER_NAME);
if(sscanf(params, "ud", player, faction)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /makeleader [player id/name] [factionid]");
if(faction >= 1 && faction <= 4)
{
PlayerInfo[player][pFaction] = faction;
PlayerInfo[player][pLeader] = faction;
PlayerInfo[player][pRank] = 6;
PlayerInfo[player][pDivision] = 0;
format(string, sizeof(string), "[ADMIN] Administrator %s has made %s leader of "COL_GREEN"%s!", aName, pName, FactionStatus(player));
SendClientMessageToAll(COLOR_RED, string);
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: Don't go below 1 or higher than 4.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You are not authorized to use that command!");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: That player is not connected!");
}
return 1;
}

CMD:test(playerid, params[])
{
new string[128];
format(string, sizeof(string), "Faction: %d", PlayerInfo[playerid][pFaction]);
SendClientMessage(playerid, -1, string);
return 1;
}


Whenever I /makeleader myself and use /test it shows me everything correctly. So ingame setting the players faction is alright. Now the problem is. When I log out it seems not to be saving which is weird.
Look:


Got it here:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Level",PlayerInfo[playerid][pLevel]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("VIP",PlayerInfo[playerid][pVIP]);
INI_Int("Faction",PlayerInfo[playerid][pFaction]);
INI_Int("Rank",PlayerInfo[playerid][pRank]);
INI_Int("Leader",PlayerInfo[playerid][pLeader]);
INI_Int("Division",PlayerInfo[playerid][pDivision]);
INI_Int("Banned",PlayerInfo[playerid][pBanned]);
INI_Int("Warns",PlayerInfo[playerid][pWarns]);



Here:
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]);
INI_WriteInt(File,"Faction",PlayerInfo[playerid][pFaction]);
INI_WriteInt(File,"Rank",PlayerInfo[playerid][pRank]);
INI_WriteInt(File,"Leader",PlayerInfo[playerid][pLeader]);
INI_WriteInt(File,"Division",PlayerInfo[playerid][pDivision]);
INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
INI_WriteInt(File,"Warns",PlayerInfo[playerid][pWarns]);


And here:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response)
{
Kick(playerid);
}
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Registering",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type a password below to register a new account.","Register","Quit");
}
else
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Level",0);
INI_WriteInt(File,"Cash",10000);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"VIP",0);
INI_WriteInt(File,"Faction",0);
INI_WriteInt(File,"Rank",0);
INI_WriteInt(File,"Leader",0);
INI_WriteInt(File,"Division",0);
INI_WriteInt(File,"Banned",0);
INI_WriteInt(File,"Warns",0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0,1328.2495,-1558.0582,13.5469, 125.9787, 0, 0, 0, 0, 0, 0);
SendClientMessage(playerid, COLOR_GREEN, "* Succesfully registered!");
SpawnPlayer(playerid);
}
}
}

case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
SetSpawnInfo(playerid, 0, 0, 1328.2495,-1558.0582,13.5469, 125.9787, 0, 0, 0, 0, 0, 0);
SendClientMessage(playerid, COLOR_GREEN, "* Succesfully logged in!");
SpawnPlayer(playerid);
new string[128];
format(string, sizeof(string), ""COL_WHITE"You logged in as an: "COL_LIGHTBLUE" Level %d administrator", PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid, 0xFFFFFF, string);
format(string, sizeof(string), ""COL_WHITE"You logged in as an: "COL_LIGHTBLUE" Level %d player", GetPlayerScore(playerid));
SendClientMessage(playerid, 0xFFFFFF, string);
format(string, sizeof(string), ""COL_WHITE"You logged in with: "COL_LIGHTBLUE" %d dollars", GetPlayerMoney(playerid));
SendClientMessage(playerid, 0xFFFFFF, string);
format(string, sizeof(string), ""COL_WHITE"You logged in as a member of: "COL_LIGHTBLUE" %s", FactionStatus(playerid));
SendClientMessage(playerid, 0xFFFFFF, string);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login","Login","Quit");
}
return 1;
}
}
}
return 0;
}


So why is it not saving?

arjanforgames
27/07/2013, 07:15 AM
Help?