26.02.2018, 19:02
This is an example of the OnDialogResponce
for one of the dialogs. Which links up to a mysql.pwn and uploads content into the mysql server. Can you post screenshots please.
PHP код:
if(dialogid == DIALOG_PURCHASEVIP)
{
if(response)
{
if(PlayerInfo[playerid][pCredits] < GetPVarInt(playerid, "VIPPrice"))
return SendClientMessageEx(playerid, COLOR_GREY, "You don't have enough credits to purchase this item. Visit shop.origin-gaming.net to purchase credits.");
if(PlayerInfo[playerid][pDonateRank] != 0)
return SendClientMessageEx(playerid, COLOR_GREY, "You already have VIP, please wait for it to expire.");
if(GetPVarType(playerid, "VIPType") != 1)
return SendClientMessageEx(playerid, COLOR_GREY, "An error has occured, please try again.");
PlayerInfo[playerid][pDonateRank] = GetPVarInt(playerid, "VIPType");
PlayerInfo[playerid][pTempVIP] = 0;
PlayerInfo[playerid][pBuddyInvited] = 0;
PlayerInfo[playerid][pVIPSellable] = 0;
if(PlayerInfo[playerid][pVIPM] == 0)
{
PlayerInfo[playerid][pVIPM] = VIPM;
VIPM++;
}
if(GetPVarType(playerid, "VIPMonths"))
{
PlayerInfo[playerid][pVIPExpire] = (2592000*GetPVarInt(playerid, "VIPMonths"))+gettime();
}
else
{
PlayerInfo[playerid][pVIPExpire] = 2592000+gettime();
}
GivePlayerCredits(playerid, -GetPVarInt(playerid, "VIPPrice"), 1);
if(GetPVarInt(playerid, "VIPType") == 3)
PlayerInfo[playerid][pGVip] = 1;
new VIPType[7];
new szQuery[128];
if(GetPVarType(playerid, "GoldRenewal"))
{
AmountSold[1]++;
AmountMade[1] += GetPVarInt(playerid, "VIPPrice");
VIPType = "Gold";
//ShopItems[1][sMade] += GetPVarInt(playerid, "VIPPrice");
format(szQuery, sizeof(szQuery), "UPDATE `sales` SET `TotalSold1` = '%d', `AmountMade1` = '%d' WHERE `Month` > NOW() - INTERVAL 1 MONTH", AmountSold[1], AmountMade[1]);
DeletePVar(playerid, "GoldRenewal");
}
else
{
switch(GetPVarInt(playerid, "VIPType")) {
case 1:
{
VIPType = "Bronze";
AmountSold[3]++;
AmountMade[3] += GetPVarInt(playerid, "VIPPrice");
//ShopItems[3][sSold]++;
//ShopItems[3][sMade] += GetPVarInt(playerid, "VIPPrice");
format(szQuery, sizeof(szQuery), "UPDATE `sales` SET `TotalSold3` = '%d', `AmountMade3` = '%d' WHERE `Month` > NOW() - INTERVAL 1 MONTH", AmountSold[3], AmountMade[3]);
}
case 2:
{
VIPType = "Silver";
AmountSold[2]++;
AmountMade[2] += GetPVarInt(playerid, "VIPPrice");
//ShopItems[2][sSold]++;
//ShopItems[2][sMade] += GetPVarInt(playerid, "VIPPrice");
format(szQuery, sizeof(szQuery), "UPDATE `sales` SET `TotalSold2` = '%d', `AmountMade2` = '%d' WHERE `Month` > NOW() - INTERVAL 1 MONTH", AmountSold[2], AmountMade[2]);
}
case 3:
{
VIPType = "Gold";
AmountSold[0]++;
AmountMade[0] += GetPVarInt(playerid, "VIPPrice");
//ShopItems[0][sSold]++;
//ShopItems[0][sMade] += GetPVarInt(playerid, "VIPPrice");
format(szQuery, sizeof(szQuery), "UPDATE `sales` SET `TotalSold0` = '%d', `AmountMade0` = '%d' WHERE `Month` > NOW() - INTERVAL 1 MONTH", AmountSold[0], AmountMade[0]);
}
}
}
mysql_function_query(MainPipeline, szQuery, false, "OnQueryFinish", "i", SENDDATA_THREAD);
format(string, sizeof(string), "You have purchased %s VIP (%d Month(s)) for %s credits.", VIPType,GetPVarInt(playerid, "VIPMonths"), number_format(GetPVarInt(playerid, "VIPPrice")));
SendClientMessageEx(playerid, COLOR_CYAN, string);
format(string, sizeof(string), "[VIP %i] [User: %s(%i)] [IP: %s] [Credits: %s] [VIP: %s(%d)] [Price: %s]", PlayerInfo[playerid][pVIPM], GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerIpEx(playerid), number_format(PlayerInfo[playerid][pCredits]), VIPType,GetPVarInt(playerid, "VIPMonths"), number_format(GetPVarInt(playerid, "VIPPrice")));
Log("logs/credits.log", string), Log("logs/setvip.log", string), print(string);
}
DeletePVar(playerid, "VIPPrice");
DeletePVar(playerid, "VIPMonths");
DeletePVar(playerid, "VIPType");
}