SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 04/05/2020, 07:42 AM   #1
Mike861
Huge Clucker
 
Join Date: Feb 2018
Posts: 233
Reputation: 16
Default login/register dialogs won't show up

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;
}
Mike861 is offline   Reply With Quote
Old 05/05/2020, 07:49 AM   #2
Mike861
Huge Clucker
 
Join Date: Feb 2018
Posts: 233
Reputation: 16
Default Re: login/register dialogs won't show up

Bump
Mike861 is offline   Reply With Quote
Old 05/05/2020, 08:27 AM   #3
hopeonxanny
Huge Clucker
 
hopeonxanny's Avatar
 
Join Date: Apr 2020
Location: SA-MP Awesomeness: 1998
Posts: 238
Reputation: 4
Default Re: login/register dialogs won't show up

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://wiki.sa-mp.com/wiki/MySQL#orm_apply_cache check this and the other functions, not this only one.
you should modify that "0" according to your script
__________________
hopeonxanny is offline   Reply With Quote
Old 05/05/2020, 08:33 AM   #4
Mike861
Huge Clucker
 
Join Date: Feb 2018
Posts: 233
Reputation: 16
Default Re: login/register dialogs won't show up

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://wiki.sa-mp.com/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.
Mike861 is offline   Reply With Quote
Old 05/05/2020, 08:46 AM   #5
Mike861
Huge Clucker
 
Join Date: Feb 2018
Posts: 233
Reputation: 16
Default Re: login/register dialogs won't show up

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.
Mike861 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
login/register dialogs don't show Extraordinariness Scripting Help 14 04/04/2014 06:54 AM
Dialogs wont show upon login Mitchy Scripting Help 2 24/07/2013 01:19 PM
Register & Login Dialogs.. Sky4D Help Archive 12 02/09/2010 08:43 PM
/register /login dialogs geerdinho8 Help Archive 23 01/05/2010 02:31 PM
[Help] Register/Login Dialogs andershh Help Archive 0 20/04/2010 07:09 PM


All times are GMT. The time now is 12:20 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.