mysql r33 checking is player in DB - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: mysql r33 checking is player in DB (
/showthread.php?tid=586811)
mysql r33 checking is player in DB -
bogushas - 25.08.2015
PHP код:
mysql_format(dbHandle, g_szBuffer, 120, "SELECT * FROM `"MySQL_PLAYERS_TABLE"` WHERE `pName` = '%s'", getPlayerName(playerid));
new rows, fields;
cache_get_data(rows, fields, dbHandle);
if(rows)
{
cache_get_field_content(0, "pPw", player[playerid][pPw], dbHandle, 130);
loginPlayer(playerid);
}
else
{
registerPlayer(playerid);
}
I think the code should work good but when I connect with the exsisting account I still get register dialog, not login.
Re: mysql r33 checking is player in DB -
CodeStyle175 - 25.08.2015
PHP код:
mysql_format(dbHandle,query,sizeof(query),"SELECT pPw FROM "MySQL_PLAYERS_TABLE" WHERE pName='%e' LIMIT 0,1",
GetPlayerName(playerid));
new Cache:cquery=mysql_query(dbHandle,query);
if(cache_num_rows()){
cache_get_field_content(0, "pPw", player[playerid][pPw], dbHandle, 130);
loginPlayer(playerid);
}else{
registerPlayer(playerid);
}
cache_delete(cquery);