NTNGuyenthanh

[NguyenThanh] Share Code Muabanvatlieu bằng dialog.

Aug 20th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.45 KB | None | 0 0
  1. //By Nguyen Thanh
  2.  
  3.  
  4. //add tren dau gamemode
  5. #define         Muavatlieu                    (5207)
  6. #define         Banvatlieu                     (5204)
  7.  
  8. //add cuoi gamemode
  9. CMD:banvatlieu(playerid, params[])
  10. {
  11.     if(GetPVarInt(playerid, "PinConfirmed"))
  12.             {
  13.                 ShowPlayerDialog(playerid, Banvatlieu, DIALOG_STYLE_INPUT, "Nhap So Vat Lieu Muon Ban","{ff0000}Ban Quy Doi Vat Lieu \n {FCF54C}10k Vat Lieu Thu Mua Gia = 300k ", "Lua chon", "Huy bo");
  14.             }
  15.        else
  16.     {
  17.           PinLogin(playerid);
  18.     }
  19.     return 1;
  20. }
  21.  
  22. CMD:muavatlieu(playerid, params[])
  23. {
  24.     if(GetPVarInt(playerid, "PinConfirmed"))
  25.             {
  26.                 ShowPlayerDialog(playerid, Muavatlieu, DIALOG_STYLE_INPUT, "Nhap So Vat Lieu Muon Mua","{ff0000}Ban Gia Vat Lieu\n {FCF54C}10k Vat Lieu Gia Ban la = 350k   ", "Lua chon", "Huy bo");
  27.             }
  28.          else
  29.     {
  30.           PinLogin(playerid);
  31.     }
  32.     return 1;
  33. }
  34.  
  35. ///add duoi public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  36.     if(dialogid == Muavatlieu)
  37.     {
  38.         if(response)
  39.         {
  40.             new mvl = abs(strval(inputtext));
  41.             new NhanTien = mvl*35;
  42.             if(strval(inputtext))
  43.             {
  44.                 if(PlayerInfo[playerid][pCash] >= NhanTien)
  45.                 {
  46.                     GivePlayerCash(playerid,-NhanTien);
  47.                     PlayerInfo[playerid][pMats] +=mvl ;
  48.                     format(string, sizeof(string), "* {ff0000}(%s) Ban Da Mua %d Vat Lieu Voi Gia %d$ .",GetPlayerNameEx(playerid),mvl, NhanTien);
  49.                     SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  50.                 }
  51.                 else
  52.                 {
  53.                     format(string, sizeof(string), "* {ff0000}Ban Khong Du %d Tien De Mua %d Vat Lieu .",NhanTien);
  54.                     SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  55.                 }
  56.             }
  57.         }
  58.     }
  59.     if(dialogid == Banvatlieu)
  60.     {
  61.         if(response)
  62.         {
  63.             new svl = abs(strval(inputtext));
  64.             new NhanTien = svl*30;
  65.             if(strval(inputtext))
  66.             {
  67.                 if(PlayerInfo[playerid][pMats] >= svl)
  68.                 {
  69.                     GivePlayerCash(playerid,NhanTien);
  70.                     PlayerInfo[playerid][pMats] -=svl ;
  71.                     format(string, sizeof(string), "* {ff0000}(%s) Da Sell %d Vat Lieu Thanh %d SAD .",GetPlayerNameEx(playerid),svl, NhanTien);
  72.                     SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  73.                 }
  74.                 else
  75.                 {
  76.                     format(string, sizeof(string), "* {ff0000}Ban Khong Du %d Vat Lieu De Sell .",svl);
  77.                     SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  78.                 }
  79.             }
  80.         }
  81.     }
Advertisement
Add Comment
Please, Sign In to add comment