login/register dialogs won't show up
#1

I have previously had mysql cache login/register system, but i converted it to orm. Now i'm not sure what the issue is, but the dialogs won't show when player joins.

Under OnPlayerConnect
Code:
	mysql_race_check[playerid]++;

        static const empty_player[player_info];
	playerdata[playerid] = empty_player;

	GetName(playerid);
	
	new ORM:ormid = playerdata[playerid][orm_id] = orm_create("players", mysql_handle);
	orm_addvar_int(ormid, playerdata[playerid][id], "id");
	orm_addvar_string(ormid, playerdata[playerid][username], MAX_PLAYER_NAME, "username");
	orm_addvar_string(ormid, playerdata[playerid][password], PASSWORD_SIZE, "password");
	orm_addvar_string(ormid, playerdata[playerid][salt], SALT_SIZE, "salt");
	orm_addvar_int(ormid, playerdata[playerid][adminlevel], "adminlevel");
	orm_addvar_int(ormid, playerdata[playerid][playerscore], "score");
	orm_addvar_int(ormid, playerdata[playerid][playermoney], "money");
	orm_addvar_int(ormid, playerdata[playerid][playerskin], "skin");
	orm_addvar_float(ormid, playerdata[playerid][playerhealth], "health");
	orm_addvar_float(ormid, playerdata[playerid][playerarmour], "armour");
	orm_addvar_float(ormid, playerdata[playerid][posx], "posx");
	orm_addvar_float(ormid, playerdata[playerid][posy], "posy");
	orm_addvar_float(ormid, playerdata[playerid][posz], "posz");
	orm_addvar_float(ormid, playerdata[playerid][posa], "posa");
	orm_addvar_int(ormid, playerdata[playerid][playerinterior], "interior");
	orm_addvar_int(ormid, playerdata[playerid][playervirtualworld], "virtualworld");
	orm_setkey(ormid, "username");


	orm_load(ormid, "OnPlayerLoad", "dd", playerid, mysql_race_check[playerid]);
OnPlayerLoad callback
Code:
forward OnPlayerLoad(playerid, race_check);
public OnPlayerLoad(playerid, race_check)
{
	if(race_check != mysql_race_check[playerid]) return Kick(playerid);

	orm_setkey(playerdata[playerid][orm_id], "id");
	
	new string[128];
	switch (orm_errno(playerdata[playerid][orm_id]))
	{
	    case ERROR_OK:
	    {
	    	format(string, sizeof(string), "Welcome back to the server, {FFFFFF}%s.\n{A9C4E4}Type in your password below to log in to your account.", GetName(playerid));
	        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Account Login", string, "Login", "Quit");
	    }
	    case ERROR_NO_DATA:
	    {
	    	format(string, sizeof(string), "Welcome to the server, {FFFFFF}%s.\n{A9C4E4}Type your desired password below to register your account.", GetName(playerid));
		ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Account Register", string, "Register", "Quit");
	     }
	}
	return 1;
}
Reply
#2

Bump
Reply
#3

after
Code:
orm_setkey(ormid, "username");
add the orm_apply_cache function

Code:
orm_apply_cache( ormid, 0 ); // example
i dont know why, but i've changed it to
Code:
orm_setkey( ormid, "ID" );
instead "username"...

i am just trying to help, maybe that solves your problem

edit: https://sampwiki.blast.hk/wiki/MySQL#orm_apply_cache check this and the other functions, not this only one.
you should modify that "0" according to your script
Reply
#4

Quote:
Originally Posted by hopeonxanny
View Post
after
Code:
orm_setkey(ormid, "username");
add the orm_apply_cache function

Code:
orm_apply_cache( ormid, 0 ); // example
i dont know why, but i've changed it to
Code:
orm_setkey( ormid, "ID" );
instead "username"...

i am just trying to help, maybe that solves your problem

edit: https://sampwiki.blast.hk/wiki/MySQL#orm_apply_cache check this and the other functions, not this only one.
you should modify that "0" according to your script
Thanks for your help, but that didn't fix the issue.
Reply
#5

I also have the cache version of my gamemode, because it's short and i recently started it. That version has issues aswell, if no one knows how to help i might switch back to cache because atleast it works more than orm.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)