How to convert this code into mysql?
#1

Код:
	
	new sendername[MAX_PLAYER_NAME];
	GetPlayerName(playerid, sendername, sizeof(sendername));
	format(string, sizeof(string), "users/%s.ini", sendername);
	new File: hFile = fopen(string, io_read);
if (hFile) {
		gPlayerAccount[playerid] = 1;
		fclose(hFile);
	}
	else {
		gPlayerAccount[playerid] = 0;
 }
How would you convert that to mysql?
Reply
#2

Have you set up your server with a MySQL plugin yet?
Reply
#3

Is this a register script you cant change only the part u posted if u r using ini system you have to change the whole script . So are you using mysql saving system or ini ?
Reply
#4

I am using ini and am converting it myself but I need to know how to convert that bit there.

Mysql is already set up plugin wise
Reply
#5

Take a look.
Reply
#6

So I would do this?
Код:
	new sendername[MAX_PLAYER_NAME];
	GetPlayerName(playerid, sendername, sizeof(sendername));
	format(Query,sizeof(Query),"SELECT `Username` FROM `Users` WHERE `Username` = '%s' LIMIT 1;",sendername);
	mysql_query(Query);
	mysql_store_result();

	if(mysql_num_rows() != 0)//if number of rows is different from 0 then continue
	{
		gPlayerAccount[playerid] = 1;
	}
	else
	{
		gPlayerAccount[playerid] = 0;
 	}
 	mysql_free_result();
	return 1;
Reply
#7

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
This is an old, outdated tutorial. Do not use it.

JessThompson, the newest versions on BlueG's plugin allows you to thread your queries. Check this for a correct way to use the plugin.
Reply
#8

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
This is an old, outdated tutorial. Do not use it.

JessThompson, the newest versions on BlueG's plugin allows you to thread your queries. Check this for a correct way to use the plugin.
Can I use the outdated one I understand it better?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)