15.05.2016, 08:26
Ok im making a dm server but when ever i set my admin rank it saves until the user leaves the server and reconnect the user is no longer an admin. And only the admin level will reset, all other statistics or saved, but admin level keep resetting when ever the player leaves the server. For example i set my self to level 7 serverowner and when i reconnect to the server and check /admins command or try to use an admin command it says im not allowed, And when i check /admins my name not on list.
N.B i taught the problem was with my resetvarieble code but i have move the admin level from it and it still giving an issue can someone help me please.
by the way i used this tutorial to make my login system all the time ,which this is a first im getting this problem
tutorial link: https://sampforum.blast.hk/showthread.php?tid=273088
pawn Код:
//onplayerdisconnect
public OnPlayerDisconnect(playerid, reason)
{
new INI:ACCOUNT = INI_Open(UserPath(playerid));
INI_SetTag(ACCOUNT,"data");
INI_WriteInt(ACCOUNT,"Level",pInfo[playerid][aAdmin]);
INI_WriteInt(ACCOUNT,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(ACCOUNT,"Kills",pInfo[playerid][Kills]);
INI_WriteInt(ACCOUNT,"Deaths",pInfo[playerid][Deaths]);
INI_WriteInt(ACCOUNT, "Banned",pInfo[playerid][Banned]);
INI_WriteInt(ACCOUNT, "Donator",pInfo[playerid][Donator]);
INI_WriteInt(ACCOUNT, "Score", pInfo[playerid][Score]);
INI_WriteInt(ACCOUNT, "Skin", pInfo[playerid][Skin]);
INI_WriteInt(ACCOUNT, "Muted",pInfo[playerid][Muted]);
INI_Close(ACCOUNT);
return 1;
}
pawn Код:
//onplayerdialogresponse
//my login dialog
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == pInfo[playerid][Pass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in to your Account!","Ok","");
SetPlayerScore(playerid, pInfo[playerid][Score]);
GivePlayerMoney(playerid, pInfo[playerid][Cash]);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
pInfo[playerid][LoginAttempts]++;
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Account Login error",astring, "Login", "Quit");
if(pInfo[playerid][LoginAttempts] >= MAX_LOGIN_ATTEMPTS)
{
format(astring, sizeof(astring),"%s has been automatically kicked | Reason: 'Incorrect password login attempts [3/3]'", GetName(playerid));
SendToAdmins(orange,astring);
ShowPlayerDialog(playerid,ACCKICK, DIALOG_STYLE_MSGBOX, "Kicked","You have been automatically kicked | Reason: 'Incorrect password login attempts [3/3]. \n Take a screen shot of this message and post on our forums if you think this in a mistake.\nOur forums: ******.com'", "Ok", "");
SetTimerEx("KickPlayer",100,false,"d",playerid);
return 1;
}
format(astring, sizeof(astring),"Account \"%s\"\nEnter your password to login\n{FF0000}*Incorrect password", GetName(playerid));
}
}
return 1;
}
}
return 1;
}
pawn Код:
//my register dialog
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");
new INI:ACCOUNT = INI_Open(UserPath(playerid));
INI_SetTag(ACCOUNT,"data");
INI_WriteInt(ACCOUNT,"Password",udb_hash(inputtext));
INI_WriteInt(ACCOUNT, "Level", 0);
INI_WriteInt(ACCOUNT, "Banned", 0);
INI_WriteInt(ACCOUNT, "Donator", 0);
INI_WriteInt(ACCOUNT, "Score", SCORE);
INI_WriteInt(ACCOUNT, "Cash", CASH);
INI_WriteInt(ACCOUNT, "Kills", 0);
INI_WriteInt(ACCOUNT, "Deaths", 0);
INI_WriteInt(ACCOUNT, "Skin", 0);
INI_WriteInt(ACCOUNT, "Muted", 0);
INI_Close(ACCOUNT);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your Account has been Successfully Created in our Database. Enjoy your stay","Ok","");
}
}
by the way i used this tutorial to make my login system all the time ,which this is a first im getting this problem
tutorial link: https://sampforum.blast.hk/showthread.php?tid=273088