28.07.2016, 08:22
Why should i type the this command two times for loading offline player's data?
First Time: Money: Sends Message with 0
Second Time: Sends Message with the correct amount (15000 'for example')
First Time: Money: Sends Message with 0
Second Time: Sends Message with the correct amount (15000 'for example')
PHP код:
new Variable[MAX_PLAYERS];
CMD:test(playerid, params[])
{
new string[128];
mysql_tquery(ConnectionHandle, "SELECT money FROM accounts WHERE username = 'Someone'", "LoadOtherPlayerData", "i", playerid);
format(string, sizeof(string), "Money: %i", Variable[playerid]); SendClientMessage(playerid, -1, string);
return 1;
}
forward LoadOtherPlayerData(playerid);
public LoadOtherPlayerData(playerid)
{
new rows, fields; cache_get_data(rows, fields, ConnectionHandle);
if(!rows) return 1;
Variable[playerid] = cache_get_field_content_int(0, "money");
return 1;
}