Advertisement
Johurt

[FS] jBinco

Feb 20th, 2012
562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 12.75 KB | None | 0 0
  1. /*
  2.      Filterscript jBinco.
  3.      Date: 2011-12-13.
  4.      Author: Johurt(Edgar, ES.^)
  5.      Filterscript created specially for www.gta-online.lt and www.pawno.ru
  6. */
  7.  
  8. #define FILTERSCRIPT
  9. #include <a_samp>
  10.  
  11. forward CheckKeyPress(playerid);
  12. forward ChangingAngle(playerid);
  13.  
  14. new Pickup[2], bPickup,
  15.     Shop[MAX_PLAYERS], Selected[MAX_PLAYERS],
  16.     Last[MAX_PLAYERS], ShopTimer[MAX_PLAYERS][2],
  17.     Text:bText[MAX_PLAYERS][2];
  18.  
  19. // SkinID, SkinCost.
  20. new mSkin[29][2] =
  21. {
  22.      {22, 300},
  23.      {18, 80},
  24.      {19, 150},
  25.      {20, 100},
  26.      {21, 70},
  27.      {28, 100},
  28.      {29, 110},
  29.      {30, 40} ,
  30.      {45, 30},
  31.      {46, 160},
  32.      {59, 200},
  33.      {83, 500},
  34.      {98, 60},
  35.      {96, 70},
  36.      {111, 400},
  37.      {120, 700},
  38.      {124, 20},
  39.      {126, 100},
  40.      {185, 70},
  41.      {184, 80},
  42.      {240, 130},
  43.      {252, 20},
  44.      {254, 180},
  45.      {293, 100},
  46.      {292, 30},
  47.      {294, 300},
  48.      {299, 210},
  49.      {181, 100},
  50.      {171, 100}
  51. };
  52.  
  53. new fSkin[22][2] =
  54. {
  55.      {11, 80},
  56.      {12, 100},
  57.      {13, 100},
  58.      {40, 200},
  59.      {55, 120},
  60.      {64, 150},
  61.      {76, 170},
  62.      {91, 400},
  63.      {140, 60},
  64.      {150, 140},
  65.      {169, 149},
  66.      {172, 119},
  67.      {190, 70},
  68.      {192, 50},
  69.      {193, 70},
  70.      {195, 147},
  71.      {214, 319},
  72.      {216, 297},
  73.      {226, 40},
  74.      {233, 297},
  75.      {237, 600},
  76.      {263, 269}
  77. };
  78.  
  79. public OnFilterScriptInit()
  80. {
  81.      print("\n--------------------------------------------");
  82.      print("[FS]jBinco - Clothes Store by Johurt loaded.");
  83.      print("--------------------------------------------\n");
  84.    
  85.      Pickup[0] = CreatePickup(1318, 1, -2374.3047, 910.1966, 45.4453);
  86.      Pickup[1] = CreatePickup(1318, 1, 207.7075, -110.8018, 1005.1328);
  87.      bPickup = CreatePickup(1275, 2, 208.9108, -100.6917, 1005.2578);
  88.    
  89.      for(new p = 0; p < MAX_PLAYERS; p++)
  90.      {
  91.           Clear(p);
  92.           bText[p][0] = TextDrawCreate(258.000000, 361.000000, "DoNotChange");
  93.           TextDrawBackgroundColor(bText[p][0], 255);
  94.           TextDrawFont(bText[p][0], 1);
  95.           TextDrawLetterSize(bText[p][0], 0.000000, 4.999997);
  96.           TextDrawColor(bText[p][0], 102);
  97.           TextDrawSetOutline(bText[p][0], 0);
  98.           TextDrawSetProportional(bText[p][0], 1);
  99.           TextDrawSetShadow(bText[p][0], 1);
  100.           TextDrawUseBox(bText[p][0], 1);
  101.           TextDrawBoxColor(bText[p][0], 102);
  102.           TextDrawTextSize(bText[p][0], 404.000000, 0.000000);
  103.  
  104.           bText[p][1] = TextDrawCreate(260.000000, 365.000000, " ");
  105.           TextDrawBackgroundColor(bText[p][1], 255);
  106.           TextDrawFont(bText[p][1], 2);
  107.           TextDrawLetterSize(bText[p][1], 0.190000, 1.000000);
  108.           TextDrawColor(bText[p][1], -1);
  109.           TextDrawSetOutline(bText[p][1], 0);
  110.           TextDrawSetProportional(bText[p][1], 1);
  111.           TextDrawSetShadow(bText[p][1], 1);
  112.      }
  113.      return 1;
  114. }
  115.  
  116. public OnFilterScriptExit()
  117. {
  118.      print("\n----------------------------------------------");
  119.      print("[FS]jBinco - Clothes Store by Johurt unloaded.");
  120.      print("----------------------------------------------\n");
  121.      DestroyPickup(Pickup[0]); DestroyPickup(Pickup[1]); DestroyPickup(bPickup);
  122.      for(new p = 0; p < MAX_PLAYERS; p++)
  123.      {
  124.           Clear(p);
  125.           TextDrawHideForPlayer(p, bText[p][0]);
  126.           TextDrawHideForPlayer(p, bText[p][1]);
  127.      }
  128.      return 1;
  129. }
  130.  
  131. public OnPlayerConnect(playerid)
  132. {
  133.      Clear(playerid);
  134.      return 1;
  135. }
  136.  
  137. public OnPlayerDisconnect(playerid, reason)
  138. {
  139.      Clear(playerid);
  140.      return 1;
  141. }
  142.  
  143. public OnPlayerDeath(playerid, killerid, reason)
  144. {
  145.      if(Shop[playerid] > 0) Clear(playerid);
  146.      return 1;
  147. }
  148.  
  149. public OnPlayerPickUpPickup(playerid, pickupid)
  150. {
  151.      if(pickupid == bPickup) ShowPlayerDialog(playerid, 1500, DIALOG_STYLE_LIST, "{e38400}Binco", "{6fa7fb}Male clothes.\n{E01B98}Female clothes.", "Select", "Close");
  152.      return 1;
  153. }
  154.  
  155. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  156. {
  157.      if(oldkeys == KEY_SECONDARY_ATTACK)
  158.      {
  159.           if(IsPlayerInRangeOfPoint(playerid, 2.0, -2374.3047, 910.1966, 45.4453))
  160.           {
  161.                SetPlayerInterior(playerid, 15);
  162.                SetPlayerPos(playerid, 207.7075, -110.8018, 1005.1328);
  163.                SetPlayerFacingAngle(playerid, 0.1588);
  164.           }
  165.           else if(IsPlayerInRangeOfPoint(playerid, 2.0, 207.7075, -110.8018, 1005.1328))
  166.           {
  167.                SetPlayerInterior(playerid, 0);
  168.                SetPlayerPos(playerid, -2374.3047, 910.1966, 45.4453);
  169.                SetPlayerFacingAngle(playerid, 88.0822);
  170.           }
  171.           else if(Shop[playerid] > 0)
  172.           {
  173.                ShowPlayerDialog(playerid, 1501, DIALOG_STYLE_LIST, "{e38400}Binco", "Buy clothes.\nBack.\nExit.", "Select", "Back");
  174.           }
  175.      }
  176.      return 1;
  177. }
  178.  
  179. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  180. {
  181.      if(dialogid == 1500)
  182.      {
  183.           if(response)
  184.           {
  185.                Last[playerid] = GetPlayerSkin(playerid);
  186.                ShopTimer[playerid][0] = SetTimerEx("CheckKeyPress", 200, true, "i", playerid);
  187.                ShopTimer[playerid][1] = SetTimerEx("ChangingAngle", 500, true, "i", playerid);
  188.                SetPlayerPos(playerid, 218.0869, -98.4392, 1005.2578);
  189.                SetPlayerFacingAngle(playerid, 301.0973);
  190.                TogglePlayerControllable(playerid, 0);
  191.                SetPlayerVirtualWorld(playerid, playerid + 500);
  192.                Selected[playerid] = -1;
  193.                SetPlayerCameraPos(playerid, 215.1282, -100.2218, 1006.6323);
  194.                SetPlayerCameraLookAt(playerid, 218.0869, -98.4392, 1005.2578);
  195.                SendClientMessage(playerid, 0x1586c850, "Hi buyer, choose the clothes.");
  196.                switch(listitem)
  197.                {
  198.                     switch(listitem)
  199.             {
  200.                          case 0: Shop[playerid] = 1;
  201.                          case 1: Shop[playerid] = 2;
  202.                     }
  203.                }
  204.           }
  205.           return 1;
  206.      }
  207.    
  208.      if(dialogid == 1501)
  209.      {
  210.           if(response)
  211.           {
  212.                if(Shop[playerid] > 0)
  213.                {
  214.                     switch(listitem)
  215.                     {
  216.                          case 0:
  217.                          {
  218.                               new id, cost;
  219.                               switch(Shop[playerid])
  220.                               {
  221.                                    case 1:id = mSkin[Selected[playerid]][0], cost = mSkin[Selected[playerid]][1];
  222.                                    case 2:id = fSkin[Selected[playerid]][0], cost = fSkin[Selected[playerid]][1];
  223.                               }
  224.                               if(cost > GetPlayerMoney(playerid)) return SendClientMessage(playerid, 0xfe930450, "You don't have not enough money to pay for clothes.");
  225.                               GivePlayerMoney(playerid, - cost);
  226.                               SetCameraBehindPlayer(playerid);
  227.                               SetPlayerInterior(playerid, 15);
  228.                               SetPlayerVirtualWorld(playerid, 0);
  229.                               SetPlayerPos(playerid, 208.9334, -102.3423, 1005.2578);
  230.                               SetPlayerFacingAngle(playerid, 180.4720);
  231.                               SetPlayerSkin(playerid, id);
  232.                               Clear(playerid);
  233.                               SendClientMessage(playerid, 0x8fcf2650, "Thanks for purchase.");
  234.                               return 1;
  235.                          }
  236.                          case 2:
  237.                          {
  238.                               if(Shop[playerid] >= 1)
  239.                               {
  240.                                    SetCameraBehindPlayer(playerid);
  241.                                    SetPlayerInterior(playerid, 15);
  242.                                    SetPlayerVirtualWorld(playerid, 0);
  243.                                    SetPlayerPos(playerid, 208.9334, -102.3423, 1005.2578);
  244.                                    SetPlayerFacingAngle(playerid, 180.4720);
  245.                                    SetPlayerSkin(playerid, Last[playerid]);
  246.                                    Clear(playerid);
  247.                                    return 1;
  248.                               }
  249.                          }
  250.                     }
  251.                }
  252.           }
  253.           return 1;
  254.      }
  255.      return 1;
  256. }
  257.  
  258. public CheckKeyPress(playerid)
  259. {
  260.      if(Shop[playerid] != 0)
  261.      {
  262.           TogglePlayerControllable(playerid, 0);
  263.           new keys, updown, leftright, string[105];
  264.           if(Shop[playerid] == 1)
  265.           {
  266.                TextDrawShowForPlayer(playerid, bText[playerid][0]);
  267.                TextDrawShowForPlayer(playerid, bText[playerid][1]);
  268.                if(Selected[playerid] < 0)
  269.                {
  270.                     Selected[playerid] = 0;
  271.                     SetPlayerSkin(playerid, mSkin[Selected[playerid]][0]);
  272.                     format(string, sizeof(string),"~w~Clothes ID: ~g~%d~n~~w~Price: ~g~%d~n~~w~Buy/Exit: ~g~ENTER~n~~w~To change clothes: ~g~~<~  ~>~", mSkin[Selected[playerid]][0], mSkin[Selected[playerid]][1]);
  273.                     TextDrawSetString(bText[playerid][1], string);
  274.                }
  275.                GetPlayerKeys(playerid, keys, updown, leftright);
  276.                if(leftright > 0)
  277.                {
  278.                     Selected[playerid] ++;
  279.                     if(Selected[playerid] >= sizeof(mSkin)) Selected[playerid] = 0;
  280.                     SetPlayerSkin(playerid, mSkin[Selected[playerid]][0]);
  281.                     format(string, sizeof(string),"~w~Clothes ID: ~g~%d~n~~w~Price: ~g~%d~n~~w~Buy/Exit: ~g~ENTER~n~~w~To change clothes: ~g~~<~  ~>~", mSkin[Selected[playerid]][0], mSkin[Selected[playerid]][1]);
  282.                     TextDrawSetString(bText[playerid][1], string);
  283.                }
  284.                else if(leftright < 0)
  285.                {
  286.                     Selected[playerid] --;
  287.                     if(Selected[playerid] < 0) Selected[playerid] = sizeof(mSkin) - 1;
  288.                     SetPlayerSkin(playerid, mSkin[Selected[playerid]][0]);
  289.                     format(string, sizeof(string),"~w~Clothes ID: ~g~%d~n~~w~Price: ~g~%d~n~~w~Buy/Exit: ~g~ENTER~n~~w~To change clothes: ~g~~<~  ~>~", mSkin[Selected[playerid]][0], mSkin[Selected[playerid]][1]);
  290.                     TextDrawSetString(bText[playerid][1], string);
  291.                }
  292.           }
  293.           else if(Shop[playerid] == 2)
  294.           {
  295.                TextDrawShowForPlayer(playerid, bText[playerid][0]);
  296.                TextDrawShowForPlayer(playerid, bText[playerid][1]);
  297.                if(Selected[playerid] < 0)
  298.                {
  299.                     Selected[playerid] = 0;
  300.                     SetPlayerSkin(playerid, fSkin[Selected[playerid]][0]);
  301.                     format(string, sizeof(string),"~w~Clothes ID: ~g~%d~n~~w~Price: ~g~%d~n~~w~Buy/Exit: ~g~ENTER~n~~w~To change clothes: ~g~~<~  ~>~", fSkin[Selected[playerid]][0], fSkin[Selected[playerid]][1]);
  302.                     TextDrawSetString(bText[playerid][1], string);
  303.                }
  304.                GetPlayerKeys(playerid, keys,updown, leftright);
  305.                if(leftright > 0)
  306.                {
  307.                     Selected[playerid] ++;
  308.                     if(Selected[playerid] >= sizeof(fSkin)) Selected[playerid] = 0;
  309.                     SetPlayerSkin(playerid, fSkin[Selected[playerid]][0]);
  310.                     format(string, sizeof(string),"~w~Clothes ID: ~g~%d~n~~w~Price: ~g~%d~n~~w~Buy/Exit: ~g~ENTER~n~~w~To change clothes: ~g~~<~  ~>~", fSkin[Selected[playerid]][0], fSkin[Selected[playerid]][1]);
  311.                     TextDrawSetString(bText[playerid][1], string);
  312.                }
  313.                else if(leftright < 0)
  314.                {
  315.                     Selected[playerid] --;
  316.                     if(Selected[playerid] < 0) Selected[playerid] = sizeof(fSkin) - 1;
  317.                     SetPlayerSkin(playerid, fSkin[Selected[playerid]][0]);
  318.                     format(string, sizeof(string),"~w~Clothes ID: ~g~%d~n~~w~Price: ~g~%d~n~~w~Buy/Exit: ~g~ENTER~n~~w~To change clothes: ~g~~<~  ~>~", fSkin[Selected[playerid]][0], fSkin[Selected[playerid]][1]);
  319.                     TextDrawSetString(bText[playerid][1], string);
  320.                }
  321.           }
  322.      }
  323.      else
  324.      {
  325.           Clear(playerid);
  326.      }
  327.      return 1;
  328. }
  329.  
  330. public ChangingAngle(playerid)
  331. {
  332.      if(Shop[playerid] >= 1)
  333.      {
  334.           new Float:A;
  335.           GetPlayerFacingAngle(playerid, A);
  336.           SetPlayerFacingAngle(playerid, A + 5.0);
  337.      }
  338.      return 1;
  339. }
  340.  
  341. stock Clear(playerid)
  342. {
  343.      Shop[playerid] = 0;
  344.      Selected[playerid] = -1;
  345.      Last[playerid] = 0;
  346.      KillTimer(ShopTimer[playerid][0]);
  347.      KillTimer(ShopTimer[playerid][1]);
  348.      TextDrawHideForPlayer(playerid, bText[playerid][0]);
  349.      TextDrawHideForPlayer(playerid, bText[playerid][1]);
  350. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement