Mysql problem
#1

I've tried to turn on an old script after long time...
but for some reason right when the query runs the server is crushing with no log or any explanation.


Код:
public OnPlayerLogin(playerid)
{
	new name[MAX_PLAYER_NAME];
	new sql[256];
	new string[256];

	GetPlayerName(playerid, name, sizeof(name));

	format(sql, sizeof(sql), "SELECT score, money, admin_level FROM players WHERE LOWER(name)=LOWER('%s')", name);

	if ( ! CheckConnection() ) return 1;

	new row[1024];
	samp_mysql_query(sql);
	samp_mysql_store_result();
	samp_mysql_fetch_row(row);

	new field[128];
	samp_mysql_strtok(field, "|", row);
	SetPlayerScore(playerid,strval(field));

	samp_mysql_strtok(field, "|", "");
	GivePlayerMoney(playerid,strval(field));

	samp_mysql_strtok(field, "|", "");
	Admin[playerid] = strval(field);

	samp_mysql_free_result();

	SendClientMessage(playerid, GREEN, " -- You are now logged in!");

	if ( Admin[playerid] > 0 )
	{
		format(string, sizeof(string), "Admin %s has beed logged in! [ID: %d Level: %d]", name, playerid, Admin[playerid]);
		SendClientMessageToAll(COLOR_SYSTEM, string);

		On‌lineAdmins = 0;
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i) && Admin[i] >= 1)
				OnlineAdmins++;
		}
	}

	LoggedIn[playerid] = 1;
	PlayerML[playerid] = 0;

	return 1;
}
Reply


Messages In This Thread
Mysql problem - by _CHoz - 13.09.2009, 22:25

Forum Jump:


Users browsing this thread: 2 Guest(s)