06.06.2010, 17:06
Quote:
Originally Posted by Lenny_Carlson
Quote:
Quote:
I'm also joining the game on the same computer, do you think it could have something to do with low performance? |
Originally Posted by Lenny_Carlson
Quote:
Quote:
I'm also joining the game on the same computer, do you think it could have something to do with low performance? |
Cant fetch the field... The MySQL Database has left |
Originally Posted by ludow12
Hello
I have a problem. I install mysql.dll on the plugins directory, and I config my server configuration but when I run the server, my Windows gives me an error: MSVCR100.dll is missing... I install this .dll on the system 32 directory but Windows gives me an other error... What the problem ? How I do ? Thanks Sorry for my bad english. |
Originally Posted by Seif_
No you didn't understand me, I'm using 2 connections, not 1. 2 connections but they're both on the same database but different tables. Because when I tried loading another table while loading a table, it messes up and just stops loading both tables, that's why 2 connections should solve it. And it actually did but now it stopped working.
|
Originally Posted by Seif_
You're still not understanding. I'm not using 2 connections for the same table! I'm using 2 connections for the same database, but not table. I have a table that loads some stuff from another table. And when I try loading it while loading the other table with the SAME connection, it stops. So using 2 connections, each loading different tables, would work. And it did then it stopped working.
EDIT: Nevermind I fixed it... I thought mysql_connect returned 0 if it didn't connect to the database, figured 0 was also a connection ID now and I now used mysql_ping to check if it connected or not. Thanks, I also do stupid mistakes. |
public OnPlayerLogin(playerid,password[]) { new query[256]; new sendername[MAX_PLAYER_NAME]; GetPlayerName(playerid, sendername, sizeof(sendername)); mysql_real_escape_string(password,password); format(query,sizeof(query),"SELECT * FROM %s WHERE Name = '%s' AND Password = md5('%s') LIMIT 1", TABLENAME, sendername, password); mysql_query(query); mysql_store_result(ConnexionBDD); if(mysql_retrieve_row(ConnexionBDD)) { new field[11]; mysql_store_result(ConnexionBDD); mysql_fetch_field_row(field, "Level"); PlayerInfo[playerid][pLevel] = strval(field); mysql_fetch_field_row(field, "AdminLevel"); PlayerInfo[playerid][pAdmin] = strval(field); mysql_fetch_field_row(field, "DonateRank"); PlayerInfo[playerid][pDonateRank] = strval(field); mysql_fetch_field_row(field, "Char"); PlayerInfo[playerid][pChar] = strval(field); mysql_fetch_field_row(field, "Bank"); PlayerInfo[playerid][pAccount] = strval(field); mysql_fetch_field_row(field, "Leader"); PlayerInfo[playerid][pLeader] = strval(field); mysql_fetch_field_row(field, "Member"); PlayerInfo[playerid][pMember] = strval(field); mysql_fetch_field_row(field, "Rank"); PlayerInfo[playerid][pRank] = strval(field); mysql_fetch_field_row(field, "Job"); PlayerInfo[playerid][pJob] = strval(field); mysql_fetch_field_row(field, "Kills"); PlayerInfo[playerid][pKills] = strval(field); mysql_fetch_field_row(field, "Deaths"); PlayerInfo[playerid][pDeaths] = strval(field); mysql_fetch_field_row(field, "PhoneBook"); PlayerInfo[playerid][pPhoneBook] = strval(field); mysql_fetch_field_row(field, "PhoneNr"); PlayerInfo[playerid][pPnumber] = strval(field); mysql_fetch_field_row(field, "Drugs"); PlayerInfo[playerid][pDrugs] = strval(field); mysql_fetch_field_row(field, "Warnings"); PlayerInfo[playerid][pWarns] = strval(field); mysql_fetch_field_row(field, "WarnReason1"); strmid(PlayerInfo[playerid][pWarnReason1], field, 0, strlen(field)-1, 255); mysql_fetch_field_row(field, "WarnReason2"); strmid(PlayerInfo[playerid][pWarnReason2], field, 0, strlen(field)-1, 255); mysql_fetch_field_row(field, "WarnReason3"); strmid(PlayerInfo[playerid][pWarnReason3], field, 0, strlen(field)-1, 255); SendClientMessage(playerid, COLOR_RED, "You are now connected."); gPlayerLogged[playerid] = 1; SpawnPlayer(playerid); } else { SendClientMessage(playerid, COLOR_WHITE, " Wrong password."); } mysql_free_result(ConnexionBDD); return 1; }
Originally Posted by ludow12
I am trying to make an OnPlayerLogin but when I /login, the data not load... but I have the SendClientMessage "You are now connected" correctly.
This is my code, I use R4 VS9 version of this plugin. Код:
public OnPlayerLogin(playerid,password[]) { new query[256]; new sendername[MAX_PLAYER_NAME]; GetPlayerName(playerid, sendername, sizeof(sendername)); mysql_real_escape_string(password,password); format(query,sizeof(query),"SELECT * FROM %s WHERE Name = '%s' AND Password = md5('%s') LIMIT 1", TABLENAME, sendername, password); mysql_query(query); mysql_store_result(ConnexionBDD); if(mysql_retrieve_row(ConnexionBDD)) { new field[11]; mysql_store_result(ConnexionBDD); mysql_fetch_field_row(field, "Level"); PlayerInfo[playerid][pLevel] = strval(field); mysql_fetch_field_row(field, "AdminLevel"); PlayerInfo[playerid][pAdmin] = strval(field); mysql_fetch_field_row(field, "DonateRank"); PlayerInfo[playerid][pDonateRank] = strval(field); mysql_fetch_field_row(field, "Char"); PlayerInfo[playerid][pChar] = strval(field); mysql_fetch_field_row(field, "Bank"); PlayerInfo[playerid][pAccount] = strval(field); mysql_fetch_field_row(field, "Leader"); PlayerInfo[playerid][pLeader] = strval(field); mysql_fetch_field_row(field, "Member"); PlayerInfo[playerid][pMember] = strval(field); mysql_fetch_field_row(field, "Rank"); PlayerInfo[playerid][pRank] = strval(field); mysql_fetch_field_row(field, "Job"); PlayerInfo[playerid][pJob] = strval(field); mysql_fetch_field_row(field, "Kills"); PlayerInfo[playerid][pKills] = strval(field); mysql_fetch_field_row(field, "Deaths"); PlayerInfo[playerid][pDeaths] = strval(field); mysql_fetch_field_row(field, "PhoneBook"); PlayerInfo[playerid][pPhoneBook] = strval(field); mysql_fetch_field_row(field, "PhoneNr"); PlayerInfo[playerid][pPnumber] = strval(field); mysql_fetch_field_row(field, "Drugs"); PlayerInfo[playerid][pDrugs] = strval(field); mysql_fetch_field_row(field, "Warnings"); PlayerInfo[playerid][pWarns] = strval(field); mysql_fetch_field_row(field, "WarnReason1"); strmid(PlayerInfo[playerid][pWarnReason1], field, 0, strlen(field)-1, 255); mysql_fetch_field_row(field, "WarnReason2"); strmid(PlayerInfo[playerid][pWarnReason2], field, 0, strlen(field)-1, 255); mysql_fetch_field_row(field, "WarnReason3"); strmid(PlayerInfo[playerid][pWarnReason3], field, 0, strlen(field)-1, 255); SendClientMessage(playerid, COLOR_RED, "You are now connected."); gPlayerLogged[playerid] = 1; SpawnPlayer(playerid); } else { SendClientMessage(playerid, COLOR_WHITE, " Wrong password."); } mysql_free_result(ConnexionBDD); return 1; } |
mysql_fetch_field_row(field, "Warnings"); PlayerInfo[playerid][pWarns] = strval(field); mysql_fetch_field_row(field, "WarnReason1"); strmid(PlayerInfo[playerid][pWarnReason1], field, 0, strlen(field)-1, 255); mysql_fetch_field_row(field, "WarnReason2"); strmid(PlayerInfo[playerid][pWarnReason2], field, 0, strlen(field)-1, 255); mysql_fetch_field_row(field, "WarnReason3"); strmid(PlayerInfo[playerid][pWarnReason3], field, 0, strlen(field)-1, 255);