28.02.2013, 18:01
This is for BlueG's plugin, R7 and above:
pawn Code:
// Somewhere
new
mysqlquery[80];
format(mysqlquery, sizeof(mysqlquery), "SELECT id, money FROM players WHERE name = '%s'", playername);
mysql_function_query(1, mysqlquery, true, "OnPlayerDataLoad", "d", playerid);
// Somewhere else
forward OnPlayerDataLoad(playerid);
public OnPlayerDataLoad(playerid)
{
new
rows,
fields;
cache_get_data(1, rows, fields);
if(rows)
{
new temp[12];
cache_get_row(0, 0, temp); PlayerInfo[playerid][pSQLID] = strval(temp);
cache_get_row(0, 1, temp); PlayerInfo[playerid][pMoney] = strval(temp);
}
return;
}