Login Dialog problem
#1

Hi,
I tried to fix this bug ( The dialog shows to everyone the registered and not registered players ) ..
I hope someone will help me in this problem, i am newbie scripter

Player info:

Код:
enum pInfo
{
	name[MAX_PLAYER_NAME],
	bowner,
	bowned,
	pass,
	pcash,
	bank,
	team,
	Jailed,
	vhpb,
	weed,
	gang,
	condoms,
	inalcatraz,

	Registered,
	LoggedIn,
	Level,
	Muted,
	Caps,
	LJailTime,
	Frozen,
	FreezeTime,
	Kills,
	Deaths,
	hours,
	mins,
	secs,
	TotalTime,
	ConnectTime,
 	MuteWarnings,
	Warnings,
	Spawned,
	TimesSpawned,
	God,
	DoorsLocked,
	SpamCount,
	SpamTime,
	PingCount,
	PingTime,
	BotPing,
	pPing[PING_MAX_EXCEEDS],
	blip,
	blipS,
	pColour,
	SpecID,
	SpecType,
	bool:AllowedIn,
	FailLogin,
	vowned,
	vowner,
	vowned2,
	vowner2,
	vowned3,
	vowner3,
	vowned4,
	vowner4,
	vowned5,
	vowner5,
	vowned6,
	vowner6,
	vowned7,
	vowner7,
	vowned8,
	vowner8,
	vowned9,
	vowner9,
	vowned10,
	vowner10,

}

new PlayerInfo[MAX_PLAYERS][pInfo];
public OnPlayerConnect(playerid)

Код:
if(PlayerInfo[playerid][Registered] == 1 && PlayerInfo[playerid][LoggedIn] == 0)
	{
             new string[256];
             format(string,256,"That account '%s 'is Registered!\n\n Login to access your Account:",pName(playerid));
             ShowPlayerDialog(playerid, DIALOGID0+2, DIALOG_STYLE_INPUT,"Login Account",string,"Login","Quit");
             return 1;
         }
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

Код:
if(dialogid == DIALOGID0+2) // Login dialog response
    {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
		    if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,COLOR_RED,"ACCOUNT: You are already logged in.");
		    if (!udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,COLOR_RED,"ACCOUNT: Account doesn't exist, please use '/register [password]'.");
		    if (udb_CheckLogin(PlayerName2(playerid),inputtext))
			{
			   	new file[256], tmp3[100], lname[MAX_PLAYER_NAME];
				GetPlayerName(playerid,lname,sizeof(lname));
			   	format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(lname));
		   		GetPlayerIp(playerid,tmp3,100);
			   	dini_Set(file,"ip",tmp3);
				LoginPlayer(playerid);
				PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
				if(PlayerInfo[playerid][Level] > 0) {
					format(string,sizeof(string),"ACCOUNT: Successfully Logged In. (Level %d)", PlayerInfo[playerid][Level] );
					return SendClientMessage(playerid,green,string);
		       	} else return SendClientMessage(playerid,green,"ACCOUNT: Successfully Logged In");
			}
			return	ShowPlayerDialog(playerid, DIALOGID0+2, DIALOG_STYLE_INPUT,"Password", "WRONG Password, Try Again", "OK", "Cancel");
		    }
		    return 1;
    }
public OnPlayerDisconnect(playerid,reason)

Код:
if(PlayerInfo[playerid][LoggedIn] == 1)	SavePlayer(playerid);
if(udb_Exists(PlayerName2(playerid))) dUserSetINT(PlayerName2(playerid)).("loggedin",0);
+Rep to the one who will help me, thank you.
Reply
#2

Hmm weird, try this

Код:
if(PlayerInfo[playerid][Registered] == 1 && PlayerInfo[playerid][LoggedIn] == 0)
	{
             new string[256];
             format(string,256,"That account '%s 'is Registered!\n\n Login to access your Account:",pName(playerid));
             ShowPlayerDialog(playerid, DIALOGID0+2, DIALOG_STYLE_INPUT,"Login Account",string,"Login","Quit");
             return 1;
         }
else if(PlayerInfo[playerid][Registered] == 0 && PlayerInfo[playerid][LoggedIn] == 0)
	{
//PASTE CODE TO SHOW YOUR REGISTERING DIALOG HERE
             return 1;
         }
Reply
#3

Not working
Please help me guys :/
Reply
#4

Bump, someone help me please, if i removed "if(PlayerInfo[playerid][Registered] == 1 && PlayerInfo[playerid][LoggedIn] == 0)" and i make in public onplayerconnect:
new string[256];
format(string,256,"That account '%s 'is Registered!\n\n Login to access your Account:",pName(playerid));
ShowPlayerDialog(playerid, DIALOGID0+2, DIALOG_STYLE_INPUT,"Login Account",string,"Login","Quit");

It will work but it will shows to everyone the registered not registered players. :/
Reply
#5

+REP TO THE ONE WHO SOLVE THIS PROBLEM!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)