16.10.2013, 22:04
Hey. My cash works with the saving system I have (Kush's tutorial) but everything else doesn't. Here's the problem.
I tried registering a new account with no other accounts in the users folder. Then I went to buy 10 grams of marijuana and I gave myself admin level 4, then I quit the server.
Then I registered a new account and I checked my stats, and I had 10 grams of marijuana and admin level 4.
Does anyone know why this is happening?
Here's two examples on how I give myself the stats.
My LoadUser data:
UserPath
OnPlayerDisconnect
When registering a new account.
I tried registering a new account with no other accounts in the users folder. Then I went to buy 10 grams of marijuana and I gave myself admin level 4, then I quit the server.
Then I registered a new account and I checked my stats, and I had 10 grams of marijuana and admin level 4.
Does anyone know why this is happening?
Here's two examples on how I give myself the stats.
pawn Code:
CMD:makeadmin(playerid, params[])
{
new pID, value, id, string[124];
if(PlayerInfo[playerid][pAdmin] < 4 && !IsPlayerAdmin(playerid)) return SCM( playerid, COLOR_GREY, "[Error]: You're not authorized to use this command.");
else if (sscanf(params, "ui", pID, value)) return SCM(playerid, COLOR_GREY, "[Usage]: /makeadmin [playerid/partofname] [level 1-4].");
else if (value < 0 || value > 4) return SCM(playerid, COLOR_LIGHTRED, "[Error]: Invalid administrator level, 0-4.");
else if(!IsPlayerConnected(id)) return SCM(playerid, COLOR_LIGHTRED, "[Error]: That player is not connected.");
format(string, sizeof(string), "AdmCmd: %s has set %s's admin-level to %d.", GetName(playerid), GetName(id), value);
SendClientMessageToAll(COLOR_LIGHTRED,string);
PlayerInfo[pID][pAdmin] = value;
return 1;
}
pawn Code:
CMD:knock(playerid, params[])
{
PlayerInfo[playerid][dMarijuana] += 10;
return 1;
}
pawn Code:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("LSD",PlayerInfo[playerid][dLSD]);
INI_Int("Cocaine",PlayerInfo[playerid][dCocaine]);
INI_Int("Marijuana",PlayerInfo[playerid][dMarijuana]);
INI_Int("Respect",PlayerInfo[playerid][pRespect]);
INI_Int("Cigarettes",PlayerInfo[playerid][pCigarettes]);
return 1;
}
pawn Code:
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
pawn Code:
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"LSD",PlayerInfo[playerid][dLSD]);
INI_WriteInt(File,"Cocaine",PlayerInfo[playerid][dCocaine]);
INI_WriteInt(File,"Marijuana",PlayerInfo[playerid][dMarijuana]);
INI_WriteInt(File,"Respect",PlayerInfo[playerid][pRespect]);
INI_WriteInt(File,"Cigarettes",PlayerInfo[playerid][pCigarettes]);
INI_Close(File);
pawn Code:
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"LSD",0);
INI_WriteInt(File,"Cocaine",0);
INI_WriteInt(File,"Marijuana",0);
INI_WriteInt(File,"Respect",0);
INI_WriteInt(File,"Cigarettes",0);
INI_Close(File);