Advertisement
Jasit_Legandary

buyFood

Sep 8th, 2021
605
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CMD:buyfood(playerid, params[]){
  2.  
  3.     Dialog_Show(playerid, buy_Food, DIALOG_STYLE_TABLIST_HEADERS, "ร้านอาหาร", "รายการ\tราคา\nPizza\t199\ncora\t50", "BUY", "NO");
  4.     return 1;
  5. }
  6.  
  7. Dialog:buy_Food(playerid, response, listitem, inputtext[]){
  8.  
  9.     if(!response) return 1;
  10.     if(listitem == 0){// Pizza
  11.  
  12.         Dialog_Show(playerid, buy_pizza,DIALOG_STYLE_INPUT, "Pizza", "ระบุจำนวนที่ต้องการซื้อ\n", "BUY", "NO");
  13.     }
  14.     if(listitem == 1){// cora
  15.  
  16.         Dialog_Show(playerid, buy_cora, DIALOG_STYLE_INPUT, "cora", "ระบุจำนวนที่ต้องการซื้อ\n", "BUY", "NO");
  17.     }
  18.     return 1;
  19. }
  20. Dialog:buy_pizza(playerid, response, listitem, inputtext[]){
  21.  
  22.     new query[256];
  23.     if(!response) return 1;
  24.     new amont = strval(inputtext);
  25.     new sell = 199 * amont;
  26.     SafeGivePlayerMoney(playerid, -sell);
  27.     Player[playerid][Pizza] += amont;
  28.     SendClientMessageEx(playerid, YELLOW, "[ + ]: คุณได้ซื้อ Pizza จำนวน %d ราคา %d", amont , sell);
  29.     format(query, sizeof(query), "UPDATE `players` SET `Pizza` = '%d' WHERE `id` = '%d' LIMIT 1", Player[playerid][Pizza],Player[playerid][ID]);
  30.     mysql_tquery(g_SQL, query);
  31.     return 1;
  32. }
  33.  
  34. Dialog:buy_cora(playerid, response, listitem, inputtext[]){
  35.  
  36.     new query[256];
  37.     if(!response) return 1;
  38.     new amont = strval(inputtext);
  39.     new sell = 50 * amont;
  40.     SafeGivePlayerMoney(playerid, -sell);
  41.     Player[playerid][cora] += amont;
  42.     SendClientMessageEx(playerid, YELLOW, "[ + ]: คุณได้ซื้อ cora จำนวน %d ราคา %d", amont , sell);
  43.     format(query, sizeof(query), "UPDATE `players` SET `cora` = '%d' WHERE `id` = '%d' LIMIT 1", Player[playerid][cora],Player[playerid][ID]);
  44.     mysql_tquery(g_SQL, query);
  45.     return 1;
  46. }
Advertisement
RAW Paste Data Copied
Advertisement