MySQL problem
#1

When i start my server and try to log in and nothing happens. I checked the script, but i couldn't find anything that could cause it.

Pastebin: http://pawn.pastebin.com/8husMPmD

MySQL part was taken from CWRP
Reply
#2

Bring
Up
My
Post
Reply
#3

It's not good to post code from other scripts.

But have you created the database needed? Have you connected to the database in OnGameModeInit?
Reply
#4

Problem is in OnPlayerLogin, OnPlayerRegister inserts user to database.
Reply
#5

Well does it send you any messages? Does your server crash after logging in?
Reply
#6

It doesn't send anything.. If I press Spawn it says: "You need to log in before spawn" and so on..
Reply
#7

And when you do login (with /login or whatever it is) it just doesn't do anything?

Can I see the /login code?
Reply
#8

Its in dialog.

Код:
if(dialogid == 12346)
	{
		if(response == 1)
		{
		    if(strlen(inputtext))
		    {
				new tmppass[64];
				strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
				OnPlayerLogin(playerid,tmppass);
			}
			else
			{
				format(string,sizeof(string),"Tere tulemast meie serverisse, %s\n\nPalun sisesta oma parool, kui Sa oled registreeritud\nSisesta parool ja vajuta Registreeri, kui Sul pole veel kasutajat",GetPlayerNameEx(playerid));
				ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Sisse logimine",string,"Logi sisse","Registreeri");
			}
		}
		else
		{
		    if(strlen(inputtext) >= 30 && strlen(inputtext) < 3)
	       	{
	           	format(string,sizeof(string),"Tere tulemast meie serverisse, %s\n\nPalun sisesta oma parool, kui Sa oled registreeritud\nSisesta parool ja vajuta Registreeri, kui Sul pole veel kasutajat",GetPlayerNameEx(playerid));
				ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Registreerumine",string,"Logi sisse","Registreeri");
	           	return 1;
	       	}
	       	else
	       	{
				if (gPlayerAccount[playerid])
				{
					SendClientMessage(playerid, COLOR_YELLOW, "See nimi on juba vхetud,palun vali mхni muu!.");
					Kick(playerid);
					return 1;
				}
				new tmppass[64];
				strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
				OnPlayerRegister(playerid,tmppass);
			}
		}
	}
Reply
#9

Well I dont' see 'PlayerInfo[playerid][pKey]' being set anywhere, is it auto-set when they enter the server or what?

If that's not the problem, I'm not sure. Try debugging each line of code, and see where it stops.
Reply
#10

MySQLFetchAcctSingle does it( MySQLFetchAcctSingle(PlayerInfo[playerid][pSQLID], "Password", PlayerInfo[playerid][pKey]); )
Reply
#11

Yeah, I've never heard of that function. Let me see it please.
Reply
#12

Sure
Код:
MySQLFetchAcctSingle(sqlplayerid, sqlvalname[], sqlresult[])
{
	new query[128];
	format(query, sizeof(query), "SELECT %s FROM Players WHERE id = %d LIMIT 1", sqlvalname, sqlplayerid);
	mysql_query(query);
	//if (DEBUG) SQLLog(query);
	mysql_store_result();
	if(mysql_fetch_row(sqlresult)==1)
	{
		mysql_free_result();
		return 1;
	}
	return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)