- Регистрация
- 14 Дек 2018
- Сообщения
- 22
- Лучшие ответы
- 0
- Репутация
- 0
Здравствуйте, при промокодах mysql не взаимодействутеся, почему?
Вот что пишет mysql_log
PHP:
publics: mysql_PromoCheck(playerid,code[])
{
new rows,fields;
cache_get_data(rows, fields);
if(!rows) return SCMF(playerid, -1, ""net"Промо-код '%s' не обнаружен",code);
new vipka = cache_get_field_content_int(0, "vip");
new money = cache_get_field_content_int(0, "money");
new ludi = cache_get_field_content_int(0, "ludi");
new rubli = cache_get_field_content_int(0, "rubli");
SCMF(playerid,COLOR_WHITE,""good"Промо-код найден: '%s' и содержит: VIP на %d дней, лицензии, %d$ и %d рублей.",code, vipka, money, rubli),
PlayerInfo[playerid][pLicenses][0] = 1; PlayerInfo[playerid][pLicenses][1] = 1; PlayerInfo[playerid][pLicenses][2] = 1; PlayerInfo[playerid][pLicenses][3] = 1; PlayerInfo[playerid][pDRInections] = vipka, PlayerInfo[playerid][pRub] += rubli; Hook_GivePlayerMoney(playerid, money);
PlayerInfo[playerid][pPromo] = 1; UpdatePlayerData(playerid, "pPromo", 1);
ludi --;
format(stringa,sizeof(stringa),"UPDATE `promo` SET `ludi` = '%d' WHERE `code` = '%s'",ludi,code);
mysql_function_query(connects, stringa, false, "", "");
if(ludi == 0)
{
format(stringa,sizeof(stringa), "DELETE FROM `promo` WHERE `code`='%s'", code);
mysql_function_query(connects, stringa, false, "", "");
}
if(gettime() >= cache_get_field_content_int(0, "data") && ludi == 0)
{
format(stringa,sizeof(stringa), "DELETE FROM `promo` WHERE `code`='%s'", code);
mysql_function_query(connects, stringa, false, "", "");
}
return 1;
}
publics: mysql_PromoCreate(playerid,code[])
{
new rows,fields;
cache_get_data(rows, fields);
if(rows) return SCMF(playerid, COLOR_GRAD1, "[A] Промо-код '%s' уже есть в списке",code);
new licname[12];
new promoday = GetPVarInt(playerid,"PROMODAYS");
new promolud = GetPVarInt(playerid,"PROMOLUD");
new promovip = GetPVarInt(playerid,"PROMOVIP");
new promomoney = GetPVarInt(playerid,"PROMOMONEY");
new promolic = GetPVarInt(playerid,"PROMOLIC");
new promorubli = GetPVarInt(playerid,"PROMORUBLI");
format(stringa,sizeof(stringa),"INSERT INTO `promo` (`code`,`vip`,`money`,`lic`,`rubli`,`days`,`ludi`,`data`) VALUES ('%s','%d','%d','%d','%d','%d','%d','%d')",code,promovip,promomoney,promolic,promorubli,promoday,promolud,gettime()+promoday);
mysql_function_query(connects, stringa, false, "", "");
switch(promolic)
{
case 0: licname = "Нет";
case 1: licname = "Да";
}
format(stringa,sizeof(stringa),"Промо-код '%s' успешно создан\nВыдача VIP"WHITE" на %d дней\nВыдача денег на %d$\n"WHITE"Выдача лицензий: %s\n"WHITE"Выдача рублей: %dруб.\n\nПромо-код действует на %d дн. или %d чел.",code,promovip,promomoney,licname,promorubli,promoday,promolud);
ShowPlayerDialogEx(playerid, 9999, DIALOG_STYLE_MSGBOX, "Создание промо-кода", stringa, "Закрыть", "");
return DeletePVar(playerid,"PROMONAME"),DeletePVar(playerid,"PROMODAYS"),DeletePVar(playerid,"PROMOLUD"),DeletePVar(playerid,"PROMOVIP"),DeletePVar(playerid,"PROMOMONEY"),DeletePVar(playerid,"PROMOLIC"),DeletePVar(playerid,"PROMORUBLI");
}
publics: mysql_PromoCodeShow(playerid)
{
new rows,fields;
cache_get_data(rows, fields);
if(!rows) return SendClientMessage(playerid, COLOR_GRAD1, "[A] Список промо-кодов отсутствует");
new promolist[1256],code[32],licname[12];
for(new i; i<rows; i++)
{
cache_get_field_content(i, "code", code, connects);
new vipka = cache_get_field_content_int(i, "vip");
new money = cache_get_field_content_int(i, "money");
new license = cache_get_field_content_int(i, "lic");
new rubli = cache_get_field_content_int(i, "rubli");
new dayss = cache_get_field_content_int(i, "days");
new ludi = cache_get_field_content_int(i, "ludi");
switch(license)
{
case 0: licname = "Нет";
case 1: licname = "Да";
}
format(promolist,sizeof(promolist),"%s%d. Название: %s | VIP: %d дн. | Деньги: %d$ | Лицензии: %s | Рубли: %dруб. | %d дн. или %d люд\n", promolist, i+1,code,vipka,money,licname,rubli,dayss,ludi);
}
ShowPlayerDialogEx(playerid, 9999, DIALOG_STYLE_LIST,"Список промо-кодов", promolist, "Закрыть", "");
return 1;
}
PHP:
7:45:10] [WARNING] CMySQLResult::GetRowDataByName - field not found ("pPromo")
[17:45:10] [ERROR] cache_get_field_content_int - invalid datatype
[17:45:40] [WARNING] CMySQLResult::GetRowDataByName - field not found ("pPromo")
[17:45:40] [ERROR] cache_get_field_content_int - invalid datatype