SA-MP Forums Archive
If the player disconnected. - 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: If the player disconnected. (/showthread.php?tid=432457)



If the player disconnected. - dorperez - 22.04.2013

Hello

I stuck with my roleplay registration system.
When I registering to my server and exit in the middle of the questionnaire and get back to the game,it tells me to log in and I didn't finish the registration..
In the player log it was like this when I logout the server:
[pawm]
Registed = 0
[/pawn]
and its great but when I enter my server it ask me to log in and not to register..

Here is my registration code:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
       if (RegistrationStep[playerid] == 0)
       {
        new plname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, plname, sizeof(plname));
        new string[256];
        format(string, sizeof(string), "Database/%s.ini", plname);
        if(!fexist(string))
        {
            PlayerInfo[playerid][pRegisted] = 0;
        }
        else if(fexist(string))
        {
            PlayerInfo[playerid][pRegisted] = 1;
        }
        if(fexist(string))//gPlayerAccount[playerid] != 0)
        {
        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 if(!fexist(string))
        {
        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");
        }
    }
    else SpawnPlayer(playerid);
    return 1;
}
Thank you guys <3


Re: If the player disconnected. - RaZzZzoR - 22.04.2013

At OnPlayerdisconnect:
Код:
if (RegistrationStep[playerid] >= 0)
{
PlayerInfo[playerid][pRegisted] = 0;
}



Re: If the player disconnected. - dorperez - 22.04.2013

Quote:
Originally Posted by RaZzZzoR
Посмотреть сообщение
At OnPlayerdisconnect:
Код:
if (RegistrationStep[playerid] >= 0)
{
PlayerInfo[playerid][pRegisted] = 0;
}
Its the same thing bro ..


AW: If the player disconnected. - HurtLocker - 22.04.2013

There's no need to use those registered[playerid]=0/1 Use only fexist and thats all.


Re: AW: If the player disconnected. - dorperez - 22.04.2013

Quote:
Originally Posted by HurtLocker
Посмотреть сообщение
There's no need to use those registered[playerid]=0/1 Use only fexist and thats all.
I can't bro because I have a RP questionnaire and I want them to finish it before start playing,even if I use fexist,when the player exit the game in the middle of the registration it tells him to login and not to register..


AW: If the player disconnected. - HurtLocker - 22.04.2013

Still, don't use registered[playerid]. But when a player tries to get rid of the dialog, make it reappear until the player answers it. with if (!response)-->show the same dialog.


Re: AW: If the player disconnected. - dorperez - 22.04.2013

Quote:
Originally Posted by HurtLocker
Посмотреть сообщение
Still, don't use registered[playerid]. But when a player tries to get rid of the dialog, make it reappear until the player answers it. with if (!response)-->show the same dialog.
But if the player answer the wrong answer in the RP questionnaire it kick him and then the player need to relog.