OKStyle

Chinatown Wars Teleport

Oct 14th, 2011
463
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <a_samp>
  2. // Teleport Fade Screen like GTA CW 1.3 by O.K.Style
  3. new Iter[MAX_PLAYERS], Text:BlackScreen[6], Text:R[2], Text:Star;
  4. public OnFilterScriptInit()
  5. {
  6.     BlackScreen[0] = TextDrawCreate(642.0, 1.0, "~n~");
  7.     TextDrawLetterSize(BlackScreen[0], 0.5, 49.5);
  8.     TextDrawUseBox(BlackScreen[0], 1);
  9.     TextDrawBoxColor(BlackScreen[0], 0x000000AA);
  10.     TextDrawTextSize(BlackScreen[0], -2.0, 0.0);
  11.  
  12.     BlackScreen[1] = TextDrawCreate(642.0, 1.0, "~n~");
  13.     TextDrawLetterSize(BlackScreen[1], 0.5, 49.5);
  14.     TextDrawUseBox(BlackScreen[1], 1);
  15.     TextDrawBoxColor(BlackScreen[1], 0x000000BB);
  16.     TextDrawTextSize(BlackScreen[1], -2.0, 0.0);
  17.  
  18.     BlackScreen[2] = TextDrawCreate(642.0, 1.0, "~n~");
  19.     TextDrawLetterSize(BlackScreen[2], 0.5, 49.5);
  20.     TextDrawUseBox(BlackScreen[2], 1);
  21.     TextDrawBoxColor(BlackScreen[2], 0x000000CC);
  22.     TextDrawTextSize(BlackScreen[2], -2.0, 0.0);
  23.  
  24.     BlackScreen[3] = TextDrawCreate(642.0, 1.0, "~n~");
  25.     TextDrawLetterSize(BlackScreen[3], 0.5, 49.5);
  26.     TextDrawUseBox(BlackScreen[3], 1);
  27.     TextDrawBoxColor(BlackScreen[3], 0x000000DD);
  28.     TextDrawTextSize(BlackScreen[3], -2.0, 0.0);
  29.  
  30.     BlackScreen[4] = TextDrawCreate(642.0, 1.0, "~n~");
  31.     TextDrawLetterSize(BlackScreen[4], 0.5, 49.5);
  32.     TextDrawUseBox(BlackScreen[4], 1);
  33.     TextDrawBoxColor(BlackScreen[4], 0x000000EE);
  34.     TextDrawTextSize(BlackScreen[4], -2.0, 0.0);
  35.  
  36.     BlackScreen[5] = TextDrawCreate(642.0, 1.0, "~n~");
  37.     TextDrawLetterSize(BlackScreen[5], 0.5, 49.5);
  38.     TextDrawUseBox(BlackScreen[5], 1);
  39.     TextDrawBoxColor(BlackScreen[5], 0x000000FF);
  40.     TextDrawTextSize(BlackScreen[5], -2.0, 0.0);
  41.  
  42.     R[0] = TextDrawCreate(591.0, 406.0, "R");
  43.     TextDrawFont(R[0], 1);
  44.     TextDrawLetterSize(R[0], 1.46, 3.8);
  45.     TextDrawColor(R[0], 0xFFFFFFFF);
  46.  
  47.     R[1] = TextDrawCreate(591.0, 406.0, "R");
  48.     TextDrawFont(R[1], 1);
  49.     TextDrawLetterSize(R[1], 1.46, 3.8);
  50.     TextDrawColor(R[1], 0xFFFFFFAA);
  51.     TextDrawSetProportional(R[1], 1);
  52.  
  53.     Star = TextDrawCreate(615.0, 428.0, "]");
  54.     TextDrawBackgroundColor(Star, 0xFFFFFFFF);
  55.     TextDrawFont(Star, 2);
  56.     TextDrawLetterSize(Star, 0.64, 1.8);
  57.     TextDrawColor(Star, 0x000000FF);
  58.     TextDrawSetOutline(Star, 1);
  59.     return 1;
  60. }
  61. public OnFilterScriptExit()
  62. {
  63.     for(new i; i < sizeof(BlackScreen); i++)
  64.     {
  65.         TextDrawHideForAll(BlackScreen[i]);
  66.         TextDrawDestroy(BlackScreen[i]);
  67.     }
  68.     for(new i; i < sizeof(R); i++)
  69.     {
  70.         TextDrawHideForAll(R[i]);
  71.         TextDrawDestroy(R[i]);
  72.     }
  73.     TextDrawHideForAll(Star);
  74.     TextDrawDestroy(Star);
  75.     return 1;
  76. }
  77. public OnPlayerCommandText(playerid, cmdtext[])
  78. {
  79.     if(strcmp(cmdtext, "/tp", true) == 0)
  80.     {
  81.         SetPlayerPosCW(playerid, 1000.0, 2000.0, 10.0);
  82.         return 1;
  83.     }
  84.     return 0;
  85. }
  86. forward TeleportCW(playerid, Float:x, Float:y, Float:z);
  87. public TeleportCW(playerid, Float:x, Float:y, Float:z)
  88. {
  89.     if(Iter[playerid] > 0)
  90.     {
  91.         switch(Iter[playerid])
  92.         {
  93.             case 16:
  94.             {
  95.                 ApplyAnimation(playerid, "ped", "Run_Wuzi", 1, 0, 1, 1, 1, 1);
  96.             }
  97.             case 8:
  98.             {
  99.                 ApplyAnimation(playerid, "PED", "WALK_DOORPARTIAL", 1, 0, 1, 1, 1, 1);
  100.             }
  101.             case 6:
  102.             {
  103.                 TextDrawShowForPlayer(playerid, BlackScreen[0]);
  104.                 TextDrawShowForPlayer(playerid, R[0]);
  105.                 TextDrawShowForPlayer(playerid, Star);
  106.             }
  107.             case 5:
  108.             {
  109.                 TextDrawHideForPlayer(playerid, R[0]);
  110.                 TextDrawShowForPlayer(playerid, R[1]);
  111.                 TextDrawHideForPlayer(playerid, BlackScreen[0]);
  112.                 TextDrawShowForPlayer(playerid, BlackScreen[1]);
  113.             }
  114.             case 4:
  115.             {
  116.                 TextDrawHideForPlayer(playerid, R[1]);
  117.                 TextDrawShowForPlayer(playerid, R[0]);
  118.                 TextDrawHideForPlayer(playerid, BlackScreen[1]);
  119.                 TextDrawShowForPlayer(playerid, BlackScreen[2]);
  120.             }
  121.             case 3:
  122.             {
  123.                 TextDrawHideForPlayer(playerid, R[0]);
  124.                 TextDrawShowForPlayer(playerid, R[1]);
  125.                 TextDrawHideForPlayer(playerid, BlackScreen[2]);
  126.                 TextDrawShowForPlayer(playerid, BlackScreen[3]);
  127.             }
  128.             case 2:
  129.             {
  130.                 TextDrawHideForPlayer(playerid, R[1]);
  131.                 TextDrawShowForPlayer(playerid, R[0]);
  132.                 TextDrawHideForPlayer(playerid, BlackScreen[3]);
  133.                 TextDrawShowForPlayer(playerid, BlackScreen[4]);
  134.             }
  135.             case 1:
  136.             {
  137.                 TextDrawHideForPlayer(playerid, R[0]);
  138.                 TextDrawShowForPlayer(playerid, R[1]);
  139.                 TextDrawHideForPlayer(playerid, BlackScreen[4]);
  140.                 TextDrawShowForPlayer(playerid, BlackScreen[5]);
  141.             }
  142.         }
  143.         Iter[playerid] -= 1;
  144.         SetTimerEx("TeleportCW", 100, 0, "ifff", playerid, x, y, z);
  145.     }
  146.     else if(Iter[playerid] == 0)
  147.     {
  148.         TextDrawHideForPlayer(playerid, BlackScreen[5]);
  149.         TextDrawHideForPlayer(playerid, R[1]);
  150.         TextDrawHideForPlayer(playerid, Star);
  151.         ClearAnimations(playerid);
  152.         SetPlayerPos(playerid, x, y, z);
  153.         SetCameraBehindPlayer(playerid);
  154.     }
  155.     return 1;
  156. }
  157. stock SetPlayerPosCW(playerid, Float:x, Float:y, Float:z)
  158. {
  159.     ClearAnimations(playerid);
  160.     Iter[playerid] = 16;
  161.     SetTimerEx("TeleportCW", 100, 0, "ifff", playerid, x, y, z);
  162.     return 1;
  163. }
RAW Paste Data