SQL Issues
#1

I'm attempting to initiate a basic SQL connection on a brand new script, and 'nativechecker' is telling me that these functions aren't registered:

[03:12:12] Error: Function not registered: 'mysql_store_result'
[03:12:12] Error: Function not registered: 'mysql_num_rows'
[03:12:12] Error: Function not registered: 'mysql_fetch_row_format'
[03:12:12] Error: Function not registered: 'mysql_fetch_field_row'
[03:12:12] Script[gamemodes/gm.amx]: Run time error 19: "File or function is not found"

I'm using BlueG's thread as a guide for current functions, etc. to use, and it's returning that they're not registered.

I downloaded the 'R6: Server plugin (VS9)', libmySQL.dll, and a_mysql.inc files and used them, and same issue.

I have even downloaded the test 'user_script' file, and I still get native errors.

Code:
Код:
#include <a_samp>
#include <sscanf2>
#include <a_mysql>

main()
{

	print("GM -> Loaded");

}

enum playerInfo {

	pName[MAX_PLAYER_NAME],
	password[126]

}

new pInfo[MAX_PLAYERS][playerInfo];

public OnGameModeInit()
{

	/* SQL CONNECTION INITIATED */
	mysql_connect( "localhost", "root", "adv-cnr", "" );

	/* SERVER SETUP BEGIN */
	SetGameModeText("GameMode");
	ShowPlayerMarkers(1);
	ShowNameTags(1);

	AddPlayerClass(265,1958.3783,1343.1572,15.3746,270.1425,0,0,0,0,-1,-1);

	return 1;
}

public OnPlayerConnect(playerid)
{
	
	new query[126], playerName[MAX_PLAYER_NAME];

	GetPlayerName( playerid, playerName, sizeof( playerName ) );

	format( query, sizeof( query ), "SELECT * FROM accounts WHERE name = '%s'", playerName );

	mysql_query( query );
	mysql_store_result();

	if ( mysql_num_rows() == 1 ) {

		SendClientMessage( playerid, -1, "That username is registered." );

		ShowPlayerDialog( playerid, 0, DIALOG_STYLE_INPUT, "Login", "Please login with the password you made.", "Login", "Cancel" );

	} else {

		SendClientMessage( playerid, -1, "That username is not registered. You may register it." );

		ShowPlayerDialog( playerid, 1, DIALOG_STYLE_INPUT, "Register", "Please enter a password you will remember for your account.", "Register", "Cancel" );

	}

	return 1;
}

public OnPlayerDisconnect( playerid, reason ) {

	SavePlayer( playerid );

	return 1;

}

public OnPlayerSpawn(playerid)
{

	SetPlayerInterior(playerid,0);
	TogglePlayerClock(playerid,0);
	return 1;

}

public OnPlayerDeath(playerid, killerid, reason)
{

   	return 1;

}

SetupPlayerForClassSelection(playerid)
{

 	SetPlayerInterior(playerid,14);
	SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
	SetPlayerFacingAngle(playerid, 270.0);
	SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
	SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);

}

public OnPlayerRequestClass(playerid, classid)
{

	SetupPlayerForClassSelection(playerid);
	return 1;

}

public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[] ) {

	switch(dialogid) {

		case 0 : {

			if ( response ) {

				new query[126], playerName[MAX_PLAYER_NAME];

				GetPlayerName( playerid, playerName, sizeof( playerName ) );

				format ( query, sizeof( query ), "SELECT * FROM accounts WHERE name = '%' AND password = '%s'", playerName, inputtext );

				mysql_query( query );
				mysql_store_result();

				if ( mysql_num_rows() == 1 ) {

					LoginPlayer( playerid );

					SendClientMessage( playerid, -1, "You have successfully signed in." );

				} else {

					SendClientMessage( playerid, -1, "The password you have entered is not correct." );

					ShowPlayerDialog( playerid, 0, DIALOG_STYLE_INPUT, "Login", "Please login with the password you made.", "Login", "Cancel" );

				}

			}

		}

		case 1 : {

			if ( response ) {

				new query[126], playerName[MAX_PLAYER_NAME];

				GetPlayerName( playerid, playerName, sizeof( playerName ) );

				format ( query, sizeof( query ), "INSERT INTO accounts VALUES ('%s', '%s')", playerName, inputtext );

				mysql_query( query );

				SendClientMessage( playerid, -1, "You have successfully registered your account." );

				SpawnPlayer( playerid );

			}

		}

	}

	return 1;

}

stock LoginPlayer( playerid ) {

	new query[126], playerName[MAX_PLAYER_NAME];

	GetPlayerName( playerid, playerName, sizeof( playerName ) );

	format ( query, sizeof( query ), "SELECT * FROM accounts WHERE playerName = '%s'", playerName );

	mysql_query( query );
	mysql_store_result();

	while( mysql_fetch_row_format( query, "|" ) ) {

		mysql_fetch_field_row( pInfo[playerid][pName], "playerName" );
		mysql_fetch_field_row( pInfo[playerid][password], "password" );

	}

	SpawnPlayer( playerid );

}

stock SavePlayer( playerid ) {

	new query[126], playerName[MAX_PLAYER_NAME];

	GetPlayerName( playerid, playerName, sizeof( playerName ) );

	format ( query, sizeof( query ), "UPDATE accounts SET playerName = '%s', password = '%s' WHERE playerName = '%s'", playerName, pInfo[playerid][password], playerName );

	mysql_query( query );
	
	printf( "Player - %s (%d) has been saved.", playerName, playerid );

}
Any help would be greatly appreciated. I hate the stupid native errors.
Reply
#2

Willing to give my never-ending love to whomever can help.
Reply
#3

show us server log kindly.
Reply
#4

Quote:
Originally Posted by jlalt
Посмотреть сообщение
show us server log kindly.
I wish I was home to do so, but, I’m at work.

I have the server log right at the top, but, that’s it.

I can tell you that the mysql plugin does load along with sscanf.

Those are the only two plugins I have in there besides nativechecker.

If it’s absolutely mandatory, I’ll provide it later.

( I’ve tried searching ****** for two hours already, lol. )

If you have skype and would be willing to talk that way, since it’s quicker and I can guarentee I see your replies instantly, I wouldn’t mind adding you on there.
Reply
#5

well server log is necessary even if you posted these details above.

if skype's more comfortable for you, you can add me there. jalal_amir2137
Reply
#6

Thank you Jlalt for the help via skype.

Very much appreciated. <3 +rep'd
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)