Not spawning after login.
#1

Hey, first of all thanks for reading this.

I've made a login and register system by a tutorial just a bit modified.

Anyway I've added a part when you login you automatically respawn but it does not work..
But.. when you register it automatically send you the login dialog ( I made it do that ) and then it spawns you right away when putting the correct password. Why?

The dialogs code ( if more information is needed, I will be glad to post it )

http://pastebin.com/rjuFy0Zi

Thank you.
Reply
#2

I noticed that the ClassSelection screen has to show before it will spawn you. Try putting something like this is your script...

At the top of your script
Код:
new bool:Login = false;
Then create a new Function you can use later...
Код:
forward SkipRequestClass(playerid);
public SkipRequestClass(playerid)
{
	new PlayerName[MAX_PLAYER_NAME];
	GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
	Load_Info(playerid);
	SpawnPlayer(playerid);
	return 1;
}
then under Login Dialog
Код:
if(!strcmp(hashpass, PlayerInfo[playerid][Password]))
{
	SendClientMessage(playerid, 0x00FF00FF,"You have succesfully logged in");
	Login = true;
}
Then under OnPlayerReguestClass...
Код:
{
	if(Login == true)
	{
		SetTimerEx("SkipRequestClass", 1, false, "i", playerid);
		Login = false;
	}
	return 1;
}
Try that, it works for me but not sure how good.
Reply
#3

I will check it out, thank you.
Will reply if it works in a second.
Reply
#4

error 017: undefined symbol "Load_Info"

And I did not get where to put it, under the login dialog, would you explain?
Reply
#5

Quote:
Originally Posted by Hyperfire
Посмотреть сообщение
I noticed that the ClassSelection screen has to show before it will spawn you. Try putting something like this is your script...

At the top of your script
Код:
new bool:Login = false;
Then create a new Function you can use later...
Код:
forward SkipRequestClass(playerid);
public SkipRequestClass(playerid)
{
	new PlayerName[MAX_PLAYER_NAME];
	GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
	Load_Info(playerid);
	SpawnPlayer(playerid);
	return 1;
}
then under Login Dialog
Код:
if(!strcmp(hashpass, PlayerInfo[playerid][Password]))
{
	SendClientMessage(playerid, 0x00FF00FF,"You have succesfully logged in");
	Login = true;
}
Then under OnPlayerReguestClass...
Код:
{
	if(Login == true)
	{
		SetTimerEx("SkipRequestClass", 1, false, "i", playerid);
		Login = false;
	}
	return 1;
}
Try that, it works for me but not sure how good.
Looks good just a tip, use a stock instead of a pubic.Use Public's for timers only.
Reply
#6

Quote:
Originally Posted by Denying
Посмотреть сообщение
error 017: undefined symbol "Load_Info"

And I did not get where to put it, under the login dialog, would you explain?
Sorry about that man, took it out of my script directly, that "Load_Info" is a callback from my y_ini Login System, so you have to put your own load command there.
Here is my "Load_Info" Code anyway, maybe it helps.
Код:
stock Load_Info(playerid)
{
    INI_ParseFile(PPath(playerid), "Load_Account_User", .bExtra = true, .extra = playerid);
}
Reply
#7

Explain what does it load?
Then I'll know what to do.

And where to put that last part where you said "put it under the login dialog"

By the way, thank you so much for the help.
Reply
#8

Quote:
Originally Posted by Denying
Посмотреть сообщение
Explain what does it load?
Then I'll know what to do.

And where to put that last part where you said "put it under the login dialog"

By the way, thank you so much for the help.
This Code...
Код:
stock Load_Info(playerid)
{
    INI_ParseFile(PPath(playerid), "Load_Account_User", .bExtra = true, .extra = playerid);
}
Loads the User's ini file by like this...
Код:
stock PPath(playerid)
{
	new PlayerFile[128], Name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, Name, sizeof(Name));
	format(PlayerFile, sizeof(PlayerFile), PPATH, Name);//PPATH is a define at the top of your script that defines the player's file location like this PPATH "Users/%s.ini"
	return PlayerFile;
}
And this part...
Код:
if(!strcmp(hashpass, PlayerInfo[playerid][Password]))
{
	SendClientMessage(playerid, 0x00FF00FF,"You have succesfully logged in");
	Login = true;
}
Should look something like this...
Код:
case(DIALOG_LOGIN):
{
	if(!response)
	{
		Kick(playerid);
	}
	else if(response)
	{
		new hashpass[129], pCarName[64];
		WP_Hash(hashpass, sizeof(hashpass), inputtext);
		if(!strcmp(hashpass, PlayerInfo[playerid][Password]))
		{
			SendClientMessage(playerid, 0x00FF00FF,"You have succesfully logged in.");
			Login = true;
		}
		else
		{
			ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","{FF0000}You have entered an Incorrect password!\n{FFFFFF}Please enter your Correct password to login.","Login","Quit");
			return 1;
		}
		return 1;
	}
	return 1;
}
Hope this helps.
Reply
#9

Wow, I can't understand a thing. ( I just started scripting a week ago :/ )

Thank you for trying! Will give you a reputation point as soon as I can.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)