03.10.2018, 17:18
PHP код:
forward OnPlayerDataLoaded(playerid);
public OnPlayerConnect(playerid)
{
new query[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
mysql_format(MySQL, query, sizeof(query), "SELECT * FROM `players` WHERE `Name` = '%e' LIMIT 1", pname);
mysql_pquery(MySQL, query, "OnPlayerDataLoaded", "d", playerid);
return 1;
}
public OnPlayerDataLoaded(playerid)
{
//Query processed, you can now execute cache functions (like cache_get_row) here.
new NumRows = cache_num_rows();
printf("There are %d players with the same name.", NumRows);
return 1;
}
https://sampwiki.blast.hk/wiki/MySQL/R33#mysql_pquery