Advertisement
System32

S32_Skins

Nov 7th, 2011
1,024
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.49 KB | None | 0 0
  1. /*
  2.  * S32_Skins - Nice skin selection!
  3.  * Copyright(c)System32
  4.  * This file is provided as is (no warranties)
  5.  * Credits:
  6.      * System32 - Almost everything!
  7.  */
  8.  
  9. #include <a_samp>
  10.  
  11. forward SkinChoosing(playerid);
  12.  
  13. new SkinTimer[MAX_PLAYERS], ChoosingStep[MAX_PLAYERS], SkinChoosed[MAX_PLAYERS], DisabledRight[MAX_PLAYERS], DisabledLeft[MAX_PLAYERS];
  14. new Text: TDSkin, Text: TDBuy, Text: TDExit, Text: TDBackground, Text: TDSkinID;
  15.  
  16. public OnFilterScriptInit()
  17. {
  18.     print("\n");
  19.     print("  \4\4\4\4\4\4\4\4\4\4\4\4\4\4\4");
  20.     print("  \4 S32_Skins    \4");
  21.     print("  \4 by          \4");
  22.     print("  \4 System32    \4");
  23.     print("  \4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\n");
  24.  
  25.     TDSkin = TextDrawCreate(480.000000, 250.000000, "~<~Skin~>~");
  26.     TextDrawBackgroundColor(TDSkin, 255);
  27.     TextDrawFont(TDSkin, 2);
  28.     TextDrawLetterSize(TDSkin, 0.579999, 1.600000);
  29.     TextDrawColor(TDSkin, 568131839);
  30.     TextDrawSetOutline(TDSkin, 0);
  31.     TextDrawSetProportional(TDSkin, 1);
  32.     TextDrawSetShadow(TDSkin, 1);
  33.  
  34.     TDBuy = TextDrawCreate(499.000000, 266.000000, "Buy");
  35.     TextDrawBackgroundColor(TDBuy, 255);
  36.     TextDrawFont(TDBuy, 2);
  37.     TextDrawLetterSize(TDBuy, 0.579999, 1.600000);
  38.     TextDrawColor(TDBuy, 16777215);
  39.     TextDrawSetOutline(TDBuy, 0);
  40.     TextDrawSetProportional(TDBuy, 1);
  41.     TextDrawSetShadow(TDBuy, 1);
  42.  
  43.     TDExit = TextDrawCreate(497.000000, 283.000000, "Exit");
  44.     TextDrawBackgroundColor(TDExit, 255);
  45.     TextDrawFont(TDExit, 2);
  46.     TextDrawLetterSize(TDExit, 0.579999, 1.700000);
  47.     TextDrawColor(TDExit, -16776961);
  48.     TextDrawSetOutline(TDExit, 0);
  49.     TextDrawSetProportional(TDExit, 1);
  50.     TextDrawSetShadow(TDExit, 1);
  51.    
  52.     TDBackground = TextDrawCreate(570.000000, 251.000000, ".");
  53.     TextDrawBackgroundColor(TDBackground, 255);
  54.     TextDrawFont(TDBackground, 1);
  55.     TextDrawLetterSize(TDBackground, 0.000000, 5.399996);
  56.     TextDrawColor(TDBackground, -1);
  57.     TextDrawSetOutline(TDBackground, 0);
  58.     TextDrawSetProportional(TDBackground, 1);
  59.     TextDrawSetShadow(TDBackground, 1);
  60.     TextDrawUseBox(TDBackground, 1);
  61.     TextDrawBoxColor(TDBackground, 50);
  62.     TextDrawTextSize(TDBackground, 475.000000, 1.000000);
  63.    
  64.     TDSkinID = TextDrawCreate(327.000000, 24.000000, "0 - 1 - 2");
  65.     TextDrawAlignment(TDSkinID, 2);
  66.     TextDrawBackgroundColor(TDSkinID, 255);
  67.     TextDrawFont(TDSkinID, 1);
  68.     TextDrawLetterSize(TDSkinID, 0.500000, 1.000000);
  69.     TextDrawColor(TDSkinID, 16711935);
  70.     TextDrawSetOutline(TDSkinID, 0);
  71.     TextDrawSetProportional(TDSkinID, 1);
  72.     TextDrawSetShadow(TDSkinID, 1);
  73.     return 1;
  74. }
  75.  
  76. public OnFilterScriptExit()
  77. {
  78.     TextDrawDestroy(TDSkin);
  79.     TextDrawDestroy(TDBuy);
  80.     TextDrawDestroy(TDExit);
  81.     TextDrawDestroy(TDBackground);
  82.     TextDrawDestroy(TDSkinID);
  83.     return 1;
  84. }
  85.  
  86. public OnPlayerConnect(playerid)
  87. {
  88.     SkinTimer[playerid] = 0;
  89.     ChoosingStep[playerid] = 0;
  90.     SkinChoosed[playerid] = 0;
  91.     DisabledRight[playerid] = 0;
  92.     DisabledLeft[playerid] = 0;
  93. }
  94.  
  95. public OnPlayerDisconnect(playerid, reason)
  96. {
  97.     SkinTimer[playerid] = 0;
  98.     ChoosingStep[playerid] = 0;
  99.     SkinChoosed[playerid] = 0;
  100.     DisabledRight[playerid] = 0;
  101.     DisabledLeft[playerid] = 0;
  102. }
  103.  
  104. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  105. {
  106.     if(newkeys == KEY_SECONDARY_ATTACK)
  107.     {
  108.         if(IsPlayerInRangeOfPoint(playerid, 2.0, 2244.4465,-1665.0327,15.4766))
  109.         {
  110.             TextDrawShowForPlayer(playerid, TDSkin);
  111.             TextDrawShowForPlayer(playerid, TDBuy);
  112.             TextDrawShowForPlayer(playerid, TDExit);
  113.             TextDrawShowForPlayer(playerid, TDBackground);
  114.             TextDrawShowForPlayer(playerid, TDSkinID);
  115.  
  116.             ChoosingStep[playerid] = 1;
  117.             SkinChoosed[playerid] = 0;
  118.             SetPVarInt(playerid, "PlayerSkin", GetPlayerSkin(playerid));
  119.             SetPlayerSkin(playerid, 0);
  120.             TogglePlayerControllable(playerid, 0);
  121.             SetPlayerInterior(playerid, 14);
  122.             SetPlayerPos(playerid, 258.8244,-40.8792,1002.0234);
  123.             SetPlayerFacingAngle(playerid, 120);
  124.             SetPlayerCameraPos(playerid, 256.0334,-42.4937,1003);
  125.             SetPlayerCameraLookAt(playerid, 258.8244,-40.8792,1001.5);
  126.             SetPlayerVirtualWorld(playerid, 9000);
  127.             SkinTimer[playerid] = SetTimerEx("SkinChoosing", 200, 1, "d", playerid);
  128.             SetPlayerCameraPos(playerid, 214.18, -101.81, 1006.05);
  129.             SetPlayerCameraLookAt(playerid, 217.60, -98.28, 1005.12);
  130.             SetPlayerPos(playerid, 217.2540,-99.4348,1005.2578);
  131.             SetPlayerFacingAngle(playerid, 132.2318);
  132.             SetPlayerInterior(playerid, 15);
  133.             SendClientMessage(playerid, 0x10F441AA, "Use arrow key and F for action!");
  134.         }
  135.         else if(IsPlayerInRangeOfPoint(playerid, 2.0, 207.737991,-109.019996,1005.132812))
  136.         {
  137.             SetPlayerPos(playerid, 2244.4465,-1665.0327,15.4766);
  138.             SetPlayerInterior(playerid, 0);
  139.         }
  140.     }
  141.     return 1;
  142. }
  143.  
  144. public SkinChoosing(playerid)
  145. {
  146.     new keys, ud, lr;
  147.     GetPlayerKeys(playerid, keys, ud, lr);
  148.     if(ChoosingStep[playerid] == 1)
  149.     {
  150.         TextDrawSetString(TDSkin, "~w~~<~Skin~>~");
  151.         if(ud > 0)
  152.         {
  153.             ChoosingStep[playerid] = 2;
  154.             TextDrawSetString(TDSkin, "~<~Skin~>~");
  155.         }
  156.         if(lr > 0)
  157.         {
  158.             if(DisabledRight[playerid] == 0)
  159.             {
  160.                 if(DisabledLeft[playerid] == 1) DisabledLeft[playerid] = 0;
  161.                 SetPlayerSkin(playerid, GetPlayerSkin(playerid) + 1);
  162.                 if(GetPlayerSkin(playerid) == 299) return DisabledRight[playerid] = 1;
  163.             }
  164.         }
  165.         else if(lr < 0)
  166.         {
  167.             if(DisabledLeft[playerid] == 0)
  168.             {
  169.                 if(DisabledRight[playerid] == 1) DisabledRight[playerid] = 0;
  170.                 SetPlayerSkin(playerid, GetPlayerSkin(playerid) - 1);
  171.                 if(GetPlayerSkin(playerid) == 0) return DisabledLeft[playerid] = 1;
  172.             }
  173.         }
  174.         new string[128];
  175.         if(GetPlayerSkin(playerid) == 0) format(string, sizeof(string), "~g~0 ~w~- 0 - ~g~1");
  176.         else if(GetPlayerSkin(playerid) == 299) format(string, sizeof(string), "~g~298 ~w~- 299 - ~g~299");
  177.         else format(string, sizeof(string), "~g~%d ~w~- %d - ~g~%d", GetPlayerSkin(playerid) - 1, GetPlayerSkin(playerid), GetPlayerSkin(playerid) + 1);
  178.         TextDrawSetString(TDSkinID, string);
  179.     }
  180.     else if(ChoosingStep[playerid] == 2)
  181.     {
  182.         TextDrawSetString(TDBuy, "~w~Buy");
  183.         if(keys == KEY_SECONDARY_ATTACK)
  184.         {
  185.             SkinChoosed[playerid] = 1;
  186.             GivePlayerMoney(playerid, -1500);
  187.             SendClientMessage(playerid, 0x10F441AA, "You choosed skin!");
  188.         }
  189.         else if(ud > 0)
  190.         {
  191.             ChoosingStep[playerid] = 3;
  192.             TextDrawSetString(TDBuy, "Buy");
  193.         }
  194.         else if(ud < 0)
  195.         {
  196.             ChoosingStep[playerid] = 1;
  197.             TextDrawSetString(TDBuy, "Buy");
  198.         }
  199.     }
  200.     else if(ChoosingStep[playerid] == 3)
  201.     {
  202.         TextDrawSetString(TDExit, "~w~Exit");
  203.         if(keys == KEY_SECONDARY_ATTACK)
  204.         {
  205.             TextDrawSetString(TDExit, "Exit");
  206.             ChoosingStep[playerid] = 0;
  207.             TextDrawHideForPlayer(playerid, TDSkin);
  208.             TextDrawHideForPlayer(playerid, TDBuy);
  209.             TextDrawHideForPlayer(playerid, TDExit);
  210.             TextDrawHideForPlayer(playerid, TDBackground);
  211.             TextDrawHideForPlayer(playerid, TDSkinID);
  212.            
  213.             ChoosingStep[playerid] = 0;
  214.             TogglePlayerControllable(playerid, 1);
  215.             SendClientMessage(playerid, 0x10F441AA, "You exited choosing skin!");
  216.             SetPlayerPos(playerid, 207.737991,-109.019996,1005.132812);
  217.             SetCameraBehindPlayer(playerid);
  218.             if(SkinChoosed[playerid] == 0) SetPlayerSkin(playerid, GetPVarInt(playerid, "PlayerSkin"));
  219.             else SetPlayerSkin(playerid, GetPlayerSkin(playerid));
  220.             SkinChoosed[playerid] = 0;
  221.             KillTimer(SkinTimer[playerid]);
  222.         }
  223.         else if(ud < 0)
  224.         {
  225.             ChoosingStep[playerid] = 2;
  226.             TextDrawSetString(TDExit, "Exit");
  227.         }
  228.     }
  229.     return 1;
  230. }
  231.  
  232.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement