SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 23/01/2014, 04:48 PM   #1
nguyenquynh
Banned
 
Join Date: Sep 2012
Posts: 94
Reputation: 0
Default How to load giftcode from mysql!

Code:
CMD:giftcode(playerid, params[])
{
    if(PlayerInfo[playerid][pLevel] == 3)
    {
		ShowPlayerDialog(playerid, DIALOG_NHAPKEY, DIALOG_STYLE_INPUT, "He thong nhap code","Vui long nhap ma giftcode duoi day:","Thuc hien","Huy bo");
	}
    return 1;
}
Code:
case DANGNHAP_KEY:
		{
		    new titlestring[64];
			new string[512];
			for(new i;i < rows;i++)
			{
				new
				    szMAK[129],
					szResult[129],
					szkey[129];
					
				if(strcmp(szResult, GetPlayerNameExt(extraid), true) != 0)
				{
					//g_mysql_AccountAuthCheck(extraid);
					return 1;
				}

				cache_get_field_content(i, "KEY1", szResult, MainPipeline);
				GetPVarString(extraid, "Passkey", szkey, sizeof(szkey));
				PlayerInfo[extraid][pCash] += 200000;
				PlayerInfo[extraid][pLevel] += 2;
				ShowPlayerDialog(extraid, DIALOG_SHOP, DIALOG_STYLE_LIST,"Cua hang OOC","The Kinh Ngiem [5 - Diem] - Gia 10 Coin\nThe Exp X2 (1 the - 20 Coin)\nThe Giam Han Che Vu Khi (1 the - 5 Coin)\nShop Token{FFFFFF}\nShop Toys\nVIP\nPhuong tien","Mua","Thoat");
				format(szMAK, sizeof(szMAK), szkey);


				if((isnull(szMAK)) || (isnull(szResult)) || (strcmp(szMAK, szResult) != 0))
				{
				    format(titlestring, sizeof(titlestring), "He Thong Nhap Gift Key - %s", GetPlayerNameEx(extraid));
					format(string, sizeof(string), "{FFFFFF}Nhap ma gift code duoi day de duoc nhan qua - %s", GetPlayerNameEx(extraid));
					ShowPlayerDialog(extraid,DIALOG_NHAPKEY,DIALOG_STYLE_INPUT,titlestring,string,"Thuc hien","Thoat");
					if(++gPlayerLogTries[extraid] == 2)
					{
						SendClientMessage(extraid, COLOR_RED, "[He Thong]: Giftcode nay khong ton tai.");
					}
					return 1;
				}
				DeletePVar(extraid, "Passkey");
				break;
			}
			return 1;
		}
Code:
if(dialogid == DIALOG_NHAPKEY)
	{
	    if(!isnull(inputtext) && strlen(inputtext) < 120)
		{
			SetPVarString(playerid, "Passkey", inputtext);
			g_mysql_GiftKey(playerid);
  		}
	}
Code:
stock g_mysql_GiftKey(playerid)
{

	new string[500];
	format(string, sizeof(string), "SELECT * FROM `giftcode` WHERE `id` = '%d'", GetPlayerSQLId(playerid));
	mysql_function_query(MainPipeline, string, true, "OnQueryFinish", "iii", DANGNHAP_KEY, playerid, g_arrQueryHandle{playerid});
	return 1;
}



It dosen't work when player enter the code in dialog....
nguyenquynh is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[MYSQL] does not load hariboo Scripting Help 6 24/09/2013 08:15 AM
Mysql load ComeMe Scripting Help 0 18/02/2013 04:06 PM
Don't load (MYSQL). budelis Scripting Help 2 13/06/2012 09:14 PM
[HELP]MySQL load & set Fico62 Scripting Help 6 30/01/2012 03:44 PM


All times are GMT. The time now is 01:41 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.