INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
// The rest is dialogs , the other stats load normally , only the admin level is 5
for register:
INI_SetTag(File,"data");
INI_WriteInt(File,"Username",MAX_PLAYER_NAME);
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteString(File, "Ip", IP);
INI_WriteInt(File,"Score",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Banned",0);
INI_WriteInt(File,"BannedBy",0);
INI_WriteInt(File,"BannedName",0);
INI_WriteInt(File,"BannedFor",0);
INI_Close(File);
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
Player[playerid][pAdmin] = 0; // add this Line
INI_SetTag(File,"data");
INI_WriteInt(File,"Username",MAX_PLAYER_NAME);
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteString(File, "Ip", IP);
INI_WriteInt(File,"Score",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Banned",0);
INI_WriteInt(File,"BannedBy",0);
INI_WriteInt(File,"BannedName",0);
INI_WriteInt(File,"BannedFor",0);
INI_Close(File);
The variable are linked to the playerid.
Let me give an example: Let's say there was an admin level 5 with id 0 online, and that player left. The admin variable that is linked to id 0 is still 5. The next player to join and get id 0 will get the admin level that was linked to id 0, which is 5. Just try to reset it under OnPlayerDisconnect, and tell me what happens. |
// Under OnPlayerConnect Callback
pInfo[playerid][pAdmin] = 0;
pInfo[playerid][Score] = 0;
pInfo[playerid][Money] = 0;
pInfo[playerid][Kills] = 0;
pInfo[playerid][Deaths] = 0;
// Blah... Blah... Blah... The Rest of the Codes here.
// The stats/values/integers that have been saved will be loaded using the function called INI_ParseFile...
// You can set it inside the OnPlayerDisconnect Callback too...
Like Stinged said,
You should try to reset it under OnPlayerConnect or OnPlayerDisconnect Callback except the Password, Like for Example :- pawn Код:
|