Хз как у тебя версия MySQL
PHP код:
//Выдаю онлайн и оффлайн игрокам по $250 000
forward AnsW_CallBack(num_id, id_frs);
public AnsW_CallBack(num_id, id_frs)
{
static const
str[] = "UPDATE `accounts` SET `Money` = '%i', WHERE `ID` = '%i'";
new
id,
rows,
fields,
name[MAX_PLAYER_NAME],
playerid,
money,
string[sizeof str + 11*2 -2*2];
cache_get_data(rows, fields, MysqlConnect);
for (new i = 0; i < rows; i++)
{
cache_get_value_name(i, "Name", name, MAX_PLAYER_NAME);
cache_get_value_name_int(i, "Money", money);
cache_get_value_name_int(i, "ID", id);
money += 250000;
playerid = INVALID_PLAYER_ID;
foreach (new j: Player)
{
if(!strcmp(pInfo[j][pName], name)) //pInfo[j][pName] - переменная с именем игрока на сервере
{
playerid = j;
}
}
if (playerid != INVALID_PLAYER_ID)
{
pInfo[playerid][pMoney] = money;
}
else
{
format(string, sizeof string, str, money, id);
mysql_function_query(MysqlConnect, string, false, "", "");
}
}
return 1;
}