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
#2

Try debug your script.
Reply
#3

You should try this:
pawn Код:
CallLocalFunction("OnPlayerLogin","i",playerid);
Reply
#4

Thanks for answering

@ddnbb: I tried it, it shows me the thing i already expected: The print(); in OnPlayerLogin wont execute.

@Seven_Of_Nine: I changed it, still haves no effect. Is there a difference between the two methods to call a code?

So im still having this problem, any more idea's?
Reply
#5

Bump, this is still not solved.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)