OnPlayerLogin isn't called - why?
#1

Hi,
I have a problem. Since a day of two, my custom 'callback' OnPlayerLogin doesn't get called anymore if you log in.
So, the code in it isn't executed. I got no idea why. Can anyone help me?
Little detail: OnPlayerLogin works fine at register, but not at login.

Код:
if(dialogid == DIALOG+2)
	{
		if(response == 1)
		{
		    mysql_real_escape_string(pname[playerid],EscapeName[playerid]);
			mysql_real_escape_string(inputtext,EscapePass[playerid]);
			format(query, sizeof(query), "SELECT * FROM `%s` WHERE `username` = '%s' AND `password` = MD5('%s')",USERTABLE,EscapeName[playerid],EscapePass[playerid]);
			mysql_query(query);
			mysql_store_result();
			if(mysql_num_rows() == 0)
			{
			    SendErrorMessage(playerid, "You have entered a wrong password. Try again.");
			    format(str, sizeof str,"Welcome %s at %s.\nThat name exists, please login on your account.",pname[playerid],SCRIPTNAME);
				ShowPlayerDialog(playerid, DIALOG+2, DIALOG_STYLE_INPUT,"- Login your account -",str,"Login!","Quit");
			}
			else
			{
			    OnPlayerLogin(playerid);
		 	}
		 	return 1;
		}
	}
	else if(dialogid == DIALOG+1)
	{
		if(response == 1)
		{
		    mysql_real_escape_string(pname[playerid],EscapeName[playerid]);
			RegisterAccount(EscapeName[playerid], inputtext);
			OnPlayerLogin(playerid);
			SendSuccesMessage(playerid, "You have sucesfully registered your account, you are automatically logged in.");
			return 1;
		}
	}
The callback:

Код:
// So, those things doesn't work at login, but it works fine at register.
public OnPlayerLogin(playerid)
{
	SpawnPlayer(playerid);
	LoadPlayer(playerid);
	TextDrawHideForPlayer(playerid, BB1);
	TextDrawHideForPlayer(playerid, BB2);
	TextDrawHideForPlayer(playerid, welcometext);
	if(IsPlayerAdminEx(playerid, 1))
	{
		format(str, sizeof str,"* %s has logged in on %s [Administrator]",pname[playerid],SCRIPTNAME);
		SendClientMessageToAll(COLOR_GREEN,str);
   		return 1;
	}
   	switch(GetPVarInt(playerid,"Level"))
    {
    	case 0..5: { format(str, sizeof str,"* %s has logged in on %s [Newbie]",pname[playerid],SCRIPTNAME); }
     	case 6..11: { format(str, sizeof str,"* %s has logged in on %s [Rookie]",pname[playerid],SCRIPTNAME); }
      	case 12..17: { format(str, sizeof str,"* %s has logged in on %s [Junior Member]",pname[playerid],SCRIPTNAME); }
       	case 18..23: { format(str, sizeof str,"* %s has logged in on %s [Allround Player]",pname[playerid],SCRIPTNAME); }
        case 24..29: { format(str, sizeof str,"* %s has logged in on %s [Senior Member]",pname[playerid],SCRIPTNAME); }
        case 30..35: { format(str, sizeof str,"* %s has logged in on %s [Supah Player]",pname[playerid],SCRIPTNAME); }
        case 36..5000: { format(str, sizeof str,"* %s has logged in on %s [PRO]",pname[playerid],SCRIPTNAME); }
 	}
 	SendClientMessageToAll(COLOR_GREEN,str);
   	return 1;
}
Greetz,
Danny
Reply


Messages In This Thread
OnPlayerLogin isn't called - why? - by Danny - 20.05.2011, 10:58
Re: OnPlayerLogin isn't called - why? - by ddnbb - 20.05.2011, 11:24
Re: OnPlayerLogin isn't called - why? - by Seven_of_Nine - 20.05.2011, 12:06
Re: OnPlayerLogin isn't called - why? - by Danny - 20.05.2011, 13:21
Re: OnPlayerLogin isn't called - why? - by Danny - 21.05.2011, 10:06

Forum Jump:


Users browsing this thread: 1 Guest(s)