SA-MP Forums Archive
After shutting down the server. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: After shutting down the server. (/showthread.php?tid=432656)



After shutting down the server. - dorperez - 23.04.2013

Hey,

After I shutting down the server and turn it on again and enter the server I need to register again..

Here are my lines:

pawn Code:
if(PlayerInfo[playerid][pRegisted] == 1)
        {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"You are already registered, write your chosen password to log in! ","Login","Quit");
        }
        else
        {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Welcome to CHANGEME, Our database tell us your new here, chose your password to register!","Register","Quit");
        }
Can someone help me please ?


Re: After shutting down the server. - Avi Raj - 23.04.2013

ur not already using this :
pawn Code:
if(PlayerInfo[playerid][pRegisted] == 1)
Then why you are using it :-
pawn Code:
else
        {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Welcome to CHANGEME, Our database tell us your new here, chose your password to register!","Register","Quit");
        }



Re: After shutting down the server. - Yashas - 23.04.2013

The problem is not in that code ,the problem is in the code where the PlayerInfo[playerid][pRegistered] is set.
Could you please give that snippet of code??


Re: After shutting down the server. - Glad2BeHere - 23.04.2013

pawn Code:
if(PlayerInfo[playerid][pRegisted] == 1 && fexist(UserPath(playerid)))
        {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"You are already registered, write your chosen password to log in! ","Login","Quit");
        }
        else
        {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Welcome to CHANGEME, Our database tell us your new here, chose your password to register!","Register","Quit");
        }
also where is the saving function ?
try this or u can remove the "PlayerInfo[playerid][pRegisted] == 1 &&"


Re: After shutting down the server. - Yashas - 23.04.2013

Quote:
Originally Posted by Glad2BeHere
View Post
pawn Code:
if(PlayerInfo[playerid][pRegisted] == 1 && fexist(UserPath(playerid)))
        {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"You are already registered, write your chosen password to log in! ","Login","Quit");
        }
        else
        {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Welcome to CHANGEME, Our database tell us your new here, chose your password to register!","Register","Quit");
        }
try this
How would that help??He says that he is getting a register dialog.That tells is that the INI_PraseFile is not reached.The statements in the else is executed.Hence there is the problem in the pRegistered Variable(Setting it wrong or something)


Re: After shutting down the server. - Glad2BeHere - 23.04.2013

try
pawn Code:
if(fexist(UserPath(playerid)))
        {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"You are already registered, write your chosen password to log in! ","Login","Quit");
        }
        else
        {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Welcome to CHANGEME, Our database tell us your new here, chose your password to register!","Register","Quit");
        }



Re: After shutting down the server. - dorperez - 23.04.2013

Quote:
Originally Posted by Avi Raj
View Post
ur not already using this :
pawn Code:
if(PlayerInfo[playerid][pRegisted] == 1)
Then why you are using it :-
pawn Code:
else
        {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Welcome to CHANGEME, Our database tell us your new here, chose your password to register!","Register","Quit");
        }
Quote:
Originally Posted by Yashas
View Post
The problem is not in that code ,the problem is in the code where the PlayerInfo[playerid][pRegistered] is set.
Could you please give that snippet of code??
Quote:
Originally Posted by Glad2BeHere
View Post
try
pawn Code:
if(fexist(UserPath(playerid)))
        {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"You are already registered, write your chosen password to log in! ","Login","Quit");
        }
        else
        {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Welcome to CHANGEME, Our database tell us your new here, chose your password to register!","Register","Quit");
        }
Can't bro,I have an RP questionnaire so I need the player to answer them and agter he finished it he is fully registered,that is why I am using it..

Here are the codes where pRegisted defined:

in the Pinfo:
[pawn]
pRegisted
[pawn]
Load user Data:
pawn Code:
INI_Int("Registed", PlayerInfo[playerid][pRegisted]);
Login and registration code:
pawn Code:
if(PlayerInfo[playerid][pRegisted] == 1)
        {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"You are already registered, write your chosen password to log in! ","Login","Quit");
        }
        if(PlayerInfo[playerid][pRegisted] == 0)
        {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Welcome to CHANGEME, Our database tell us your new here, chose your password to register!","Register","Quit");
        }
onplayerdisconnect
pawn Code:
new INI:File = INI_Open(UserPath(playerid));
        INI_WriteInt(File,"Registed", PlayerInfo[playerid][pRegisted]);
    INI_Close(File);
At the end of the questionnaire
pawn Code:
PlayerInfo[playerid][pRegisted] = 1;



Re: After shutting down the server. - dorperez - 25.04.2013

UP..


Re: After shutting down the server. - Revo - 25.04.2013

In addition to Y_Less's post, put a simple
pawn Code:
print("Server is shutting down now");
in OnGameModeExit to confirm it gets called. You can do the same for OnPlayerDisconnect.

If it doesn't, you're doing something wrong with shutting it down.


Re: After shutting down the server. - dorperez - 26.04.2013

Quote:
Originally Posted by Y_Less
View Post
HOW do you shut down the server?
I am just pressing the "X" buttom on the dos,its a private server no Linux.. :\

Quote:
Originally Posted by Revo
View Post
In addition to Y_Less's post, put a simple
pawn Code:
print("Server is shutting down now");
in OnGameModeExit to confirm it gets called. You can do the same for OnPlayerDisconnect.

If it doesn't, you're doing something wrong with shutting it down.
I putted that line on those publics but its the same .. :\