Advertisement
Guest User

Spectate TextDraws by King

a guest
Nov 2nd, 2018
716
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 36.57 KB | None | 0 0
  1. // Napravio: Gammix
  2. // Editovao: King Script (Ja)
  3. #include <a_samp>
  4. #include <zcmd>
  5. #include <sscanf2>
  6. #include <foreach>
  7.  
  8. #define SPECTATE_TYPE_PLAYER 0
  9. #define SPECTATE_TYPE_VEHICLE 1
  10.  
  11. static const VEHICLE_NAMES[][] = {
  12.     "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel", "Dumper", "Firetruck", "Trashmaster", "Stretch",
  13.     "Manana", "Infernus", "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam", "Esperanto", "Taxi",
  14.     "Washington", "Bobcat", "Mr Whoopee", "BF Injection", "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator",
  15.     "Bus", "Rhino", "Barracks", "Hotknife", "Trailer 1", "Previon", "Coach", "Cabbie", "Stallion", "Rumpo", "RC Bandit", "Romero",
  16.     "Packer", "Monster", "Admiral", "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer 2", "Turismo", "Speeder", "Reefer", "Tropic",
  17.     "Flatbed", "Yankee", "Caddy", "Solair", "Berkley's RC Van", "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider",
  18.     "Glendale", "Oceanic", "Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy", "Hermes", "Sabre", "Rustler", "ZR-350",
  19.     "Walton", "Regina", "Comet", "BMX", "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper", "Rancher",
  20.     "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking", "Blista Compact", "Police Maverick", "Boxville", "Benson",
  21.     "Mesa", "RC Goblin", "Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher", "Super GT", "Elegant", "Journey",
  22.     "Bike", "Mountain Bike", "Beagle", "Cropdust", "Stunt", "Tanker", "Roadtrain", "Nebula", "Majestic", "Buccaneer", "Shamal",
  23.     "Hydra", "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune", "Cadrona", "FBI Truck", "Willard", "Forklift",
  24.     "Tractor", "Combine", "Feltzer", "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent", "Bullet", "Clover",
  25.     "Sadler", "Firetruck LA", "Hustler", "Intruder", "Primo", "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite",
  26.     "Windsor", "Monster A", "Monster B", "Uranus", "Jester", "Sultan", "Stratum", "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma",
  27.     "Savanna", "Bandito", "Freight Flat", "Streak Carriage", "Kart", "Mower", "Duneride", "Sweeper", "Broadway", "Tornado", "AT-400",
  28.     "DFT-30", "Huntley", "Stafford", "BF-400", "Newsvan", "Tug", "Trailer 3", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
  29.     "Freight Carriage", "Trailer 3", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car (LSPD)", "Police Car (SFPD)",
  30.     "Police Car (LVPD)", "Police Ranger", "Picador", "S.W.A.T. Tank", "Alpha", "Phoenix", "Glendale", "Sadler", "Luggage Trailer A",
  31.     "Luggage Trailer B", "Stair Trailer", "Boxville", "Farm Plow", "Utility Trailer"
  32. };
  33.  
  34. static const Float:VEHICLE_TOP_SPEEDS[] = {
  35.     157.0, 147.0, 186.0, 110.0, 133.0, 164.0, 110.0, 148.0, 100.0, 158.0, 129.0, 221.0, 168.0, 110.0, 105.0, 192.0, 154.0, 270.0, 115.0, 149.0,
  36.     145.0, 154.0, 140.0, 99.0,  135.0, 270.0, 173.0, 165.0, 157.0, 201.0, 190.0, 130.0, 94.0,  110.0, 167.0, 0.0,   149.0, 158.0, 142.0, 168.0,
  37.     136.0, 145.0, 139.0, 126.0, 110.0, 164.0, 270.0, 270.0, 111.0, 0.0,   0.0,   193.0, 270.0, 60.0,  135.0, 157.0, 106.0, 95.0,  157.0, 136.0,
  38.     270.0, 160.0, 111.0, 142.0, 145.0, 145.0, 147.0, 140.0, 144.0, 270.0, 157.0, 110.0, 190.0, 190.0, 149.0, 173.0, 270.0, 186.0, 117.0, 140.0,
  39.     184.0, 73.0,  156.0, 122.0, 190.0, 99.0,  64.0,  270.0, 270.0, 139.0, 157.0, 149.0, 140.0, 270.0, 214.0, 176.0, 162.0, 270.0, 108.0, 123.0,
  40.     140.0, 145.0, 216.0, 216.0, 173.0, 140.0, 179.0, 166.0, 108.0, 79.0,  101.0, 270.0, 270.0, 270.0, 120.0, 142.0, 157.0, 157.0, 164.0, 270.0,
  41.     270.0, 160.0, 176.0, 151.0, 130.0, 160.0, 158.0, 149.0, 176.0, 149.0, 60.0,  70.0,  110.0, 167.0, 168.0, 158.0, 173.0, 0.0,   0.0,   270.0,
  42.     149.0, 203.0, 164.0, 151.0, 150.0, 147.0, 149.0, 142.0, 270.0, 153.0, 145.0, 157.0, 121.0, 270.0, 144.0, 158.0, 113.0, 113.0, 156.0, 178.0,
  43.     169.0, 154.0, 178.0, 270.0, 145.0, 165.0, 160.0, 173.0, 146.0, 0.0,   0.0,   93.0,  60.0,  110.0, 60.0,  158.0, 158.0, 270.0, 130.0, 158.0,
  44.     153.0, 151.0, 136.0, 85.0,  0.0,   153.0, 142.0, 165.0, 108.0, 162.0, 0.0,   0.0,   270.0, 270.0, 130.0, 190.0, 175.0, 175.0, 175.0, 158.0,
  45.     151.0, 110.0, 169.0, 171.0, 148.0, 152.0, 0.0,   0.0,   0.0,   108.0, 0.0,   0.0
  46. };
  47.  
  48.  
  49. new Iterator:SpectatePlayers<MAX_PLAYERS>;
  50.  
  51. new Text:playerInfoFrameTD[6];
  52. new Text:playerInfoTD[7];
  53. new Text:vehicleInfoFrameTD[2];
  54. new Text:vehicleInfoTD[4];
  55.  
  56. new PlayerText:playerInfoPTD[MAX_PLAYERS][8];
  57. new PlayerText:vehicleInfoPTD[MAX_PLAYERS][5];
  58.  
  59. new spectateID[MAX_PLAYERS];
  60. new spectateType[MAX_PLAYERS];
  61. new bool:spectateCameraON[MAX_PLAYERS];
  62.  
  63. new playerVirtualWorld[MAX_PLAYERS];
  64.  
  65. new oldPlayerVirtualWorld[MAX_PLAYERS];
  66. new oldPlayerInterior[MAX_PLAYERS];
  67. new Float:oldPlayerPosition[MAX_PLAYERS][4];
  68. new Float:oldPlayerHealth[MAX_PLAYERS];
  69. new Float:oldPlayerArmour[MAX_PLAYERS];
  70.  
  71. #define BUTTON_PREVIOUS playerInfoFrameTD[1]
  72. #define BUTTON_NEXT playerInfoFrameTD[2]
  73.  
  74. CreateTextDraws() {
  75.  
  76.     playerInfoFrameTD[0] = TextDrawCreate(218.0000, 330.0000, "LD_SPAC:WHITE");
  77.     TextDrawFont(playerInfoFrameTD[0], 4);
  78.     TextDrawLetterSize(playerInfoFrameTD[0], 0.5000, 1.0000);
  79.     TextDrawColor(playerInfoFrameTD[0], 1094795775);
  80.     TextDrawSetShadow(playerInfoFrameTD[0], 0);
  81.     TextDrawSetOutline(playerInfoFrameTD[0], 0);
  82.     TextDrawBackgroundColor(playerInfoFrameTD[0], 255);
  83.     TextDrawSetProportional(playerInfoFrameTD[0], 1);
  84.     TextDrawTextSize(playerInfoFrameTD[0], 200.0000, 70.0000);
  85.  
  86.     playerInfoFrameTD[1] = TextDrawCreate(219.0000, 331.0000, "LD_SPAC:WHITE");
  87.     TextDrawFont(playerInfoFrameTD[1], 4);
  88.     TextDrawLetterSize(playerInfoFrameTD[1], 0.5000, 1.0000);
  89.     TextDrawColor(playerInfoFrameTD[1], 589505535);
  90.     TextDrawSetShadow(playerInfoFrameTD[1], 0);
  91.     TextDrawSetOutline(playerInfoFrameTD[1], 0);
  92.     TextDrawBackgroundColor(playerInfoFrameTD[1], 255);
  93.     TextDrawSetProportional(playerInfoFrameTD[1], 1);
  94.     TextDrawTextSize(playerInfoFrameTD[1], 30.0000, 68.0000);
  95.     TextDrawSetSelectable(playerInfoFrameTD[1], 1);
  96.  
  97.     playerInfoFrameTD[2] = TextDrawCreate(387.0000, 331.0000, "LD_SPAC:WHITE");
  98.     TextDrawFont(playerInfoFrameTD[2], 4);
  99.     TextDrawLetterSize(playerInfoFrameTD[2], 0.5000, 1.0000);
  100.     TextDrawColor(playerInfoFrameTD[2], 589505535);
  101.     TextDrawSetShadow(playerInfoFrameTD[2], 0);
  102.     TextDrawSetOutline(playerInfoFrameTD[2], 0);
  103.     TextDrawBackgroundColor(playerInfoFrameTD[2], 255);
  104.     TextDrawSetProportional(playerInfoFrameTD[2], 1);
  105.     TextDrawTextSize(playerInfoFrameTD[2], 30.0000, 68.0000);
  106.     TextDrawSetSelectable(playerInfoFrameTD[2], 1);
  107.  
  108.     playerInfoFrameTD[3] = TextDrawCreate(250.0000, 331.0000, "LD_SPAC:WHITE");
  109.     TextDrawFont(playerInfoFrameTD[3], 4);
  110.     TextDrawLetterSize(playerInfoFrameTD[3], 0.5000, 1.0000);
  111.     TextDrawColor(playerInfoFrameTD[3], 589505535);
  112.     TextDrawSetShadow(playerInfoFrameTD[3], 0);
  113.     TextDrawSetOutline(playerInfoFrameTD[3], 0);
  114.     TextDrawBackgroundColor(playerInfoFrameTD[3], 255);
  115.     TextDrawSetProportional(playerInfoFrameTD[3], 1);
  116.     TextDrawTextSize(playerInfoFrameTD[3], 136.0000, 68.0000);
  117.  
  118.     playerInfoFrameTD[4] = TextDrawCreate(224.5000, 349.5000, "LD_BEAT:LEFT");
  119.     TextDrawFont(playerInfoFrameTD[4], 4);
  120.     TextDrawLetterSize(playerInfoFrameTD[4], 0.5000, 1.0000);
  121.     TextDrawColor(playerInfoFrameTD[4], 1684301055);
  122.     TextDrawSetShadow(playerInfoFrameTD[4], 0);
  123.     TextDrawSetOutline(playerInfoFrameTD[4], 0);
  124.     TextDrawBackgroundColor(playerInfoFrameTD[4], 255);
  125.     TextDrawSetProportional(playerInfoFrameTD[4], 1);
  126.     TextDrawTextSize(playerInfoFrameTD[4], 20.0000, 28.0000);
  127.  
  128.     playerInfoFrameTD[5] = TextDrawCreate(393.5000, 349.5000, "LD_BEAT:RIGHT");
  129.     TextDrawFont(playerInfoFrameTD[5], 4);
  130.     TextDrawLetterSize(playerInfoFrameTD[5], 0.5000, 1.0000);
  131.     TextDrawColor(playerInfoFrameTD[5], 1684301055);
  132.     TextDrawSetShadow(playerInfoFrameTD[5], 0);
  133.     TextDrawSetOutline(playerInfoFrameTD[5], 0);
  134.     TextDrawBackgroundColor(playerInfoFrameTD[5], 255);
  135.     TextDrawSetProportional(playerInfoFrameTD[5], 1);
  136.     TextDrawTextSize(playerInfoFrameTD[5], 20.0000, 28.0000);
  137.  
  138.     playerInfoTD[0] = TextDrawCreate(302.0000, 333.5000, "NOW SPECTATING:");
  139.     TextDrawFont(playerInfoTD[0], 1);
  140.     TextDrawLetterSize(playerInfoTD[0], 0.1399, 0.7999);
  141.     TextDrawColor(playerInfoTD[0], -1768515841);
  142.     TextDrawSetShadow(playerInfoTD[0], 0);
  143.     TextDrawSetOutline(playerInfoTD[0], 0);
  144.     TextDrawBackgroundColor(playerInfoTD[0], 255);
  145.     TextDrawSetProportional(playerInfoTD[0], 1);
  146.     TextDrawTextSize(playerInfoTD[0], 640.0000, 0.0000);
  147.  
  148.     playerInfoTD[1] = TextDrawCreate(252.0000, 333.5000, "PLAYER_MODEL");
  149.     TextDrawFont(playerInfoTD[1], 5);
  150.     TextDrawLetterSize(playerInfoTD[1], 0.2099, 1.1000);
  151.     TextDrawColor(playerInfoTD[1], -1768515841);
  152.     TextDrawSetShadow(playerInfoTD[1], 0);
  153.     TextDrawSetOutline(playerInfoTD[1], 0);
  154.     TextDrawBackgroundColor(playerInfoTD[1], 1684301055);
  155.     TextDrawSetProportional(playerInfoTD[1], 1);
  156.     TextDrawTextSize(playerInfoTD[1], 49.0000, 49.0000);
  157.     TextDrawSetPreviewModel(playerInfoTD[1], 0);
  158.     TextDrawSetPreviewRot(playerInfoTD[1], 0.0000, 0.0000, 0.0000, 1.0000);
  159.  
  160.     playerInfoTD[2] = TextDrawCreate(252.0000, 392.0000, "LD_SPAC:WHITE");
  161.     TextDrawFont(playerInfoTD[2], 4);
  162.     TextDrawLetterSize(playerInfoTD[2], 0.2099, 1.1000);
  163.     TextDrawColor(playerInfoTD[2], -1768515841);
  164.     TextDrawSetShadow(playerInfoTD[2], 0);
  165.     TextDrawSetOutline(playerInfoTD[2], 0);
  166.     TextDrawBackgroundColor(playerInfoTD[2], 255);
  167.     TextDrawSetProportional(playerInfoTD[2], 1);
  168.     TextDrawTextSize(playerInfoTD[2], 64.0000, 3.0000);
  169.  
  170.     playerInfoTD[3] = TextDrawCreate(252.0000, 392.0000, "LD_SPAC:WHITE");
  171.     TextDrawFont(playerInfoTD[3], 4);
  172.     TextDrawLetterSize(playerInfoTD[3], 0.2099, 1.1000);
  173.     TextDrawColor(playerInfoTD[3], -16776961);
  174.     TextDrawSetShadow(playerInfoTD[3], 0);
  175.     TextDrawSetOutline(playerInfoTD[3], 0);
  176.     TextDrawBackgroundColor(playerInfoTD[3], 255);
  177.     TextDrawSetProportional(playerInfoTD[3], 1);
  178.     TextDrawTextSize(playerInfoTD[3], 55.0000, 3.0000);
  179.  
  180.     playerInfoTD[4] = TextDrawCreate(320.5000, 392.0000, "LD_SPAC:WHITE");
  181.     TextDrawFont(playerInfoTD[4], 4);
  182.     TextDrawLetterSize(playerInfoTD[4], 0.2099, 1.1000);
  183.     TextDrawColor(playerInfoTD[4], -1768515841);
  184.     TextDrawSetShadow(playerInfoTD[4], 0);
  185.     TextDrawSetOutline(playerInfoTD[4], 0);
  186.     TextDrawBackgroundColor(playerInfoTD[4], 255);
  187.     TextDrawSetProportional(playerInfoTD[4], 1);
  188.     TextDrawTextSize(playerInfoTD[4], 64.0000, 3.0000);
  189.  
  190.     playerInfoTD[5] = TextDrawCreate(321.0000, 392.0000, "LD_SPAC:WHITE");
  191.     TextDrawFont(playerInfoTD[5], 4);
  192.     TextDrawLetterSize(playerInfoTD[5], 0.2099, 1.1000);
  193.     TextDrawColor(playerInfoTD[5], -1);
  194.     TextDrawSetShadow(playerInfoTD[5], 0);
  195.     TextDrawSetOutline(playerInfoTD[5], 0);
  196.     TextDrawBackgroundColor(playerInfoTD[5], 255);
  197.     TextDrawSetProportional(playerInfoTD[5], 1);
  198.     TextDrawTextSize(playerInfoTD[5], 10.5000, 3.0000);
  199.  
  200.     playerInfoTD[6] = TextDrawCreate(341.0000, 376.0000, "[MAX: 35.0 MPH]");
  201.     TextDrawFont(playerInfoTD[6], 1);
  202.     TextDrawLetterSize(playerInfoTD[6], 0.1199, 0.5999);
  203.     TextDrawColor(playerInfoTD[6], 1684301055);
  204.     TextDrawSetShadow(playerInfoTD[6], 0);
  205.     TextDrawSetOutline(playerInfoTD[6], 0);
  206.     TextDrawBackgroundColor(playerInfoTD[6], 255);
  207.     TextDrawSetProportional(playerInfoTD[6], 1);
  208.     TextDrawTextSize(playerInfoTD[6], 640.0000, 0.0000);
  209.  
  210.     vehicleInfoFrameTD[0] = TextDrawCreate(218.0000, 403.5000, "LD_SPAC:WHITE");
  211.     TextDrawFont(vehicleInfoFrameTD[0], 4);
  212.     TextDrawLetterSize(vehicleInfoFrameTD[0], 0.5000, 1.0000);
  213.     TextDrawColor(vehicleInfoFrameTD[0], 1094795775);
  214.     TextDrawSetShadow(vehicleInfoFrameTD[0], 0);
  215.     TextDrawSetOutline(vehicleInfoFrameTD[0], 0);
  216.     TextDrawBackgroundColor(vehicleInfoFrameTD[0], 255);
  217.     TextDrawSetProportional(vehicleInfoFrameTD[0], 1);
  218.     TextDrawTextSize(vehicleInfoFrameTD[0], 200.0000, 32.0000);
  219.  
  220.     vehicleInfoFrameTD[1] = TextDrawCreate(219.0000, 404.5000, "LD_SPAC:WHITE");
  221.     TextDrawFont(vehicleInfoFrameTD[1], 4);
  222.     TextDrawLetterSize(vehicleInfoFrameTD[1], 0.5000, 1.0000);
  223.     TextDrawColor(vehicleInfoFrameTD[1], 589505535);
  224.     TextDrawSetShadow(vehicleInfoFrameTD[1], 0);
  225.     TextDrawSetOutline(vehicleInfoFrameTD[1], 0);
  226.     TextDrawBackgroundColor(vehicleInfoFrameTD[1], 255);
  227.     TextDrawSetProportional(vehicleInfoFrameTD[1], 1);
  228.     TextDrawTextSize(vehicleInfoFrameTD[1], 198.0000, 30.0000);
  229.  
  230.     vehicleInfoTD[0] = TextDrawCreate(252.0000, 406.0000, "PLAYER VEHICLE INFO:");
  231.     TextDrawFont(vehicleInfoTD[0], 1);
  232.     TextDrawLetterSize(vehicleInfoTD[0], 0.1399, 0.7999);
  233.     TextDrawColor(vehicleInfoTD[0], -1768515841);
  234.     TextDrawSetShadow(vehicleInfoTD[0], 0);
  235.     TextDrawSetOutline(vehicleInfoTD[0], 0);
  236.     TextDrawBackgroundColor(vehicleInfoTD[0], 255);
  237.     TextDrawSetProportional(vehicleInfoTD[0], 1);
  238.     TextDrawTextSize(vehicleInfoTD[0], 640.0000, 0.0000);
  239.  
  240.     vehicleInfoTD[1] = TextDrawCreate(220.5000, 406.5000, "PLAYER_MODEL");
  241.     TextDrawFont(vehicleInfoTD[1], 5);
  242.     TextDrawLetterSize(vehicleInfoTD[1], 0.2099, 1.1000);
  243.     TextDrawColor(vehicleInfoTD[1], -1);
  244.     TextDrawSetShadow(vehicleInfoTD[1], 0);
  245.     TextDrawSetOutline(vehicleInfoTD[1], 0);
  246.     TextDrawBackgroundColor(vehicleInfoTD[1], 842150655);
  247.     TextDrawSetProportional(vehicleInfoTD[1], 1);
  248.     TextDrawTextSize(vehicleInfoTD[1], 30.0000, 26.0000);
  249.     TextDrawSetPreviewModel(vehicleInfoTD[1], 456);
  250.     TextDrawSetPreviewRot(vehicleInfoTD[1], 0.0000, 0.0000, -50.0000, 1.0000);
  251.  
  252.     vehicleInfoTD[2] = TextDrawCreate(320.5000, 429.0000, "LD_SPAC:WHITE");
  253.     TextDrawFont(vehicleInfoTD[2], 4);
  254.     TextDrawLetterSize(vehicleInfoTD[2], 0.2099, 1.1000);
  255.     TextDrawColor(vehicleInfoTD[2], -1768515841);
  256.     TextDrawSetShadow(vehicleInfoTD[2], 0);
  257.     TextDrawSetOutline(vehicleInfoTD[2], 0);
  258.     TextDrawBackgroundColor(vehicleInfoTD[2], 255);
  259.     TextDrawSetProportional(vehicleInfoTD[2], 1);
  260.     TextDrawTextSize(vehicleInfoTD[2], 94.5000, 3.0000);
  261.  
  262.     vehicleInfoTD[3] = TextDrawCreate(320.5000, 429.0000, "LD_SPAC:WHITE");
  263.     TextDrawFont(vehicleInfoTD[3], 4);
  264.     TextDrawLetterSize(vehicleInfoTD[3], 0.2099, 1.1000);
  265.     TextDrawColor(vehicleInfoTD[3], -16776961);
  266.     TextDrawSetShadow(vehicleInfoTD[3], 0);
  267.     TextDrawSetOutline(vehicleInfoTD[3], 0);
  268.     TextDrawBackgroundColor(vehicleInfoTD[3], 255);
  269.     TextDrawSetProportional(vehicleInfoTD[3], 1);
  270.     TextDrawTextSize(vehicleInfoTD[3], 94.5000, 3.0000);
  271. }
  272.  
  273. CreatePlayerTextDraws(playerid) {
  274. //==============================================================================---> Player Spectate ( Prikazuje informacije o igracu kojeg specate ) !
  275.     playerInfoPTD[playerid][0] = CreatePlayerTextDraw(playerid, 302.0000, 340.0000, "Nickname:");
  276.     PlayerTextDrawFont(playerid, playerInfoPTD[playerid][0], 1);
  277.     PlayerTextDrawLetterSize(playerid, playerInfoPTD[playerid][0], 0.2399, 1.3000);
  278.     PlayerTextDrawColor(playerid, playerInfoPTD[playerid][0], -7601921);
  279.     PlayerTextDrawSetShadow(playerid, playerInfoPTD[playerid][0], 0);
  280.     PlayerTextDrawSetOutline(playerid, playerInfoPTD[playerid][0], 0);
  281.     PlayerTextDrawBackgroundColor(playerid, playerInfoPTD[playerid][0], 255);
  282.     PlayerTextDrawSetProportional(playerid, playerInfoPTD[playerid][0], 1);
  283.     PlayerTextDrawTextSize(playerid, playerInfoPTD[playerid][0], 640.0000, 0.0000);
  284.  
  285.     playerInfoPTD[playerid][1] = CreatePlayerTextDraw(playerid, 302.0000, 351.0000, "ID: 13");
  286.     PlayerTextDrawFont(playerid, playerInfoPTD[playerid][1], 1);
  287.     PlayerTextDrawLetterSize(playerid, playerInfoPTD[playerid][1], 0.1199, 0.5999);
  288.     PlayerTextDrawColor(playerid, playerInfoPTD[playerid][1], 1684301055);
  289.     PlayerTextDrawSetShadow(playerid, playerInfoPTD[playerid][1], 0);
  290.     PlayerTextDrawSetOutline(playerid, playerInfoPTD[playerid][1], 0);
  291.     PlayerTextDrawBackgroundColor(playerid, playerInfoPTD[playerid][1], 255);
  292.     PlayerTextDrawSetProportional(playerid, playerInfoPTD[playerid][1], 1);
  293.     PlayerTextDrawTextSize(playerid, playerInfoPTD[playerid][1], 640.0000, 0.0000);
  294.  
  295.     playerInfoPTD[playerid][2] = CreatePlayerTextDraw(playerid, 251.5000, 384.0000, "HEALTH: ~w~80");
  296.     PlayerTextDrawFont(playerid, playerInfoPTD[playerid][2], 1);
  297.     PlayerTextDrawLetterSize(playerid, playerInfoPTD[playerid][2], 0.1399, 0.7999);
  298.     PlayerTextDrawColor(playerid, playerInfoPTD[playerid][2], -1768515841);
  299.     PlayerTextDrawSetShadow(playerid, playerInfoPTD[playerid][2], 0);
  300.     PlayerTextDrawSetOutline(playerid, playerInfoPTD[playerid][2], 0);
  301.     PlayerTextDrawBackgroundColor(playerid, playerInfoPTD[playerid][2], 255);
  302.     PlayerTextDrawSetProportional(playerid, playerInfoPTD[playerid][2], 1);
  303.     PlayerTextDrawTextSize(playerid, playerInfoPTD[playerid][2], 640.0000, 0.0000);
  304.  
  305.     playerInfoPTD[playerid][3] = CreatePlayerTextDraw(playerid, 320.5000, 384.0000, "ARMOUR: ~w~10");
  306.     PlayerTextDrawFont(playerid, playerInfoPTD[playerid][3], 1);
  307.     PlayerTextDrawLetterSize(playerid, playerInfoPTD[playerid][3], 0.1399, 0.7999);
  308.     PlayerTextDrawColor(playerid, playerInfoPTD[playerid][3], -1768515841);
  309.     PlayerTextDrawSetShadow(playerid, playerInfoPTD[playerid][3], 0);
  310.     PlayerTextDrawSetOutline(playerid, playerInfoPTD[playerid][3], 0);
  311.     PlayerTextDrawBackgroundColor(playerid, playerInfoPTD[playerid][3], 255);
  312.     PlayerTextDrawSetProportional(playerid, playerInfoPTD[playerid][3], 1);
  313.     PlayerTextDrawTextSize(playerid, playerInfoPTD[playerid][3], 640.0000, 0.0000);
  314.  
  315.     playerInfoPTD[playerid][4] = CreatePlayerTextDraw(playerid, 302.0000, 360.5000, "WEAPON: ~w~M4 (144)");
  316.     PlayerTextDrawFont(playerid, playerInfoPTD[playerid][4], 1);
  317.     PlayerTextDrawLetterSize(playerid, playerInfoPTD[playerid][4], 0.1399, 0.7999);
  318.     PlayerTextDrawColor(playerid, playerInfoPTD[playerid][4], -1768515841);
  319.     PlayerTextDrawSetShadow(playerid, playerInfoPTD[playerid][4], 0);
  320.     PlayerTextDrawSetOutline(playerid, playerInfoPTD[playerid][4], 0);
  321.     PlayerTextDrawBackgroundColor(playerid, playerInfoPTD[playerid][4], 255);
  322.     PlayerTextDrawSetProportional(playerid, playerInfoPTD[playerid][4], 1);
  323.     PlayerTextDrawTextSize(playerid, playerInfoPTD[playerid][4], 640.0000, 0.0000);
  324.  
  325.     playerInfoPTD[playerid][5] = CreatePlayerTextDraw(playerid, 302.0000, 368.0000, "MONEY: ~g~$~w~99,242,221");
  326.     PlayerTextDrawFont(playerid, playerInfoPTD[playerid][5], 1);
  327.     PlayerTextDrawLetterSize(playerid, playerInfoPTD[playerid][5], 0.1399, 0.7999);
  328.     PlayerTextDrawColor(playerid, playerInfoPTD[playerid][5], -1768515841);
  329.     PlayerTextDrawSetShadow(playerid, playerInfoPTD[playerid][5], 0);
  330.     PlayerTextDrawSetOutline(playerid, playerInfoPTD[playerid][5], 0);
  331.     PlayerTextDrawBackgroundColor(playerid, playerInfoPTD[playerid][5], 255);
  332.     PlayerTextDrawSetProportional(playerid, playerInfoPTD[playerid][5], 1);
  333.     PlayerTextDrawTextSize(playerid, playerInfoPTD[playerid][5], 640.0000, 0.0000);
  334.  
  335.     playerInfoPTD[playerid][6] = CreatePlayerTextDraw(playerid, 302.0000, 375.0000, "SPEED: ~w~0.2 mps");
  336.     PlayerTextDrawFont(playerid, playerInfoPTD[playerid][6], 1);
  337.     PlayerTextDrawLetterSize(playerid, playerInfoPTD[playerid][6], 0.1399, 0.7999);
  338.     PlayerTextDrawColor(playerid, playerInfoPTD[playerid][6], -1768515841);
  339.     PlayerTextDrawSetShadow(playerid, playerInfoPTD[playerid][6], 0);
  340.     PlayerTextDrawSetOutline(playerid, playerInfoPTD[playerid][6], 0);
  341.     PlayerTextDrawBackgroundColor(playerid, playerInfoPTD[playerid][6], 255);
  342.     PlayerTextDrawSetProportional(playerid, playerInfoPTD[playerid][6], 1);
  343.     PlayerTextDrawTextSize(playerid, playerInfoPTD[playerid][6], 640.0000, 0.0000);
  344.  
  345.     playerInfoPTD[playerid][7] = CreatePlayerTextDraw(playerid, 384.0000, 333.5000, "1/15");
  346.     PlayerTextDrawFont(playerid, playerInfoPTD[playerid][7], 1);
  347.     PlayerTextDrawLetterSize(playerid, playerInfoPTD[playerid][7], 0.1399, 0.7999);
  348.     PlayerTextDrawAlignment(playerid, playerInfoPTD[playerid][7], 3);
  349.     PlayerTextDrawColor(playerid, playerInfoPTD[playerid][7], -1768515841);
  350.     PlayerTextDrawSetShadow(playerid, playerInfoPTD[playerid][7], 0);
  351.     PlayerTextDrawSetOutline(playerid, playerInfoPTD[playerid][7], 0);
  352.     PlayerTextDrawBackgroundColor(playerid, playerInfoPTD[playerid][7], 255);
  353.     PlayerTextDrawSetProportional(playerid, playerInfoPTD[playerid][7], 1);
  354.     PlayerTextDrawTextSize(playerid, playerInfoPTD[playerid][7], 640.0000, 0.0000);
  355.    
  356. //==============================================================================---> PlayerInVehicle Spectate ( prikazuje informacije o vozilu u kojem je igrac ) !
  357.     vehicleInfoPTD[playerid][0] = CreatePlayerTextDraw(playerid, 251.5000, 412.0000, "Truck");
  358.     PlayerTextDrawFont(playerid, vehicleInfoPTD[playerid][0], 1);
  359.     PlayerTextDrawLetterSize(playerid, vehicleInfoPTD[playerid][0], 0.2399, 1.3000);
  360.     PlayerTextDrawColor(playerid, vehicleInfoPTD[playerid][0], -1768515841);
  361.     PlayerTextDrawSetShadow(playerid, vehicleInfoPTD[playerid][0], 0);
  362.     PlayerTextDrawSetOutline(playerid, vehicleInfoPTD[playerid][0], 0);
  363.     PlayerTextDrawBackgroundColor(playerid, vehicleInfoPTD[playerid][0], 255);
  364.     PlayerTextDrawSetProportional(playerid, vehicleInfoPTD[playerid][0], 1);
  365.     PlayerTextDrawTextSize(playerid, vehicleInfoPTD[playerid][0], 640.0000, 0.0000);
  366.  
  367.     vehicleInfoPTD[playerid][1] = CreatePlayerTextDraw(playerid, 251.5000, 423.5000, "MODEL ID: 456");
  368.     PlayerTextDrawFont(playerid, vehicleInfoPTD[playerid][1], 1);
  369.     PlayerTextDrawLetterSize(playerid, vehicleInfoPTD[playerid][1], 0.1199, 0.5999);
  370.     PlayerTextDrawColor(playerid, vehicleInfoPTD[playerid][1], 1684301055);
  371.     PlayerTextDrawSetShadow(playerid, vehicleInfoPTD[playerid][1], 0);
  372.     PlayerTextDrawSetOutline(playerid, vehicleInfoPTD[playerid][1], 0);
  373.     PlayerTextDrawBackgroundColor(playerid, vehicleInfoPTD[playerid][1], 255);
  374.     PlayerTextDrawSetProportional(playerid, vehicleInfoPTD[playerid][1], 1);
  375.     PlayerTextDrawTextSize(playerid, vehicleInfoPTD[playerid][1], 640.0000, 0.0000);
  376.  
  377.     vehicleInfoPTD[playerid][2] = CreatePlayerTextDraw(playerid, 320.5000, 421.0000, "HEALTH: ~w~1000/1000");
  378.     PlayerTextDrawFont(playerid, vehicleInfoPTD[playerid][2], 1);
  379.     PlayerTextDrawLetterSize(playerid, vehicleInfoPTD[playerid][2], 0.1399, 0.7999);
  380.     PlayerTextDrawColor(playerid, vehicleInfoPTD[playerid][2], -1768515841);
  381.     PlayerTextDrawSetShadow(playerid, vehicleInfoPTD[playerid][2], 0);
  382.     PlayerTextDrawSetOutline(playerid, vehicleInfoPTD[playerid][2], 0);
  383.     PlayerTextDrawBackgroundColor(playerid, vehicleInfoPTD[playerid][2], 255);
  384.     PlayerTextDrawSetProportional(playerid, vehicleInfoPTD[playerid][2], 1);
  385.     PlayerTextDrawTextSize(playerid, vehicleInfoPTD[playerid][2], 640.0000, 0.0000);
  386.  
  387.     vehicleInfoPTD[playerid][3] = CreatePlayerTextDraw(playerid, 320.5000, 406.0000, "SPEED: ~w~60 kps");
  388.     PlayerTextDrawFont(playerid, vehicleInfoPTD[playerid][3], 1);
  389.     PlayerTextDrawLetterSize(playerid, vehicleInfoPTD[playerid][3], 0.1399, 0.7999);
  390.     PlayerTextDrawColor(playerid, vehicleInfoPTD[playerid][3], -1768515841);
  391.     PlayerTextDrawSetShadow(playerid, vehicleInfoPTD[playerid][3], 0);
  392.     PlayerTextDrawSetOutline(playerid, vehicleInfoPTD[playerid][3], 0);
  393.     PlayerTextDrawBackgroundColor(playerid, vehicleInfoPTD[playerid][3], 255);
  394.     PlayerTextDrawSetProportional(playerid, vehicleInfoPTD[playerid][3], 1);
  395.     PlayerTextDrawTextSize(playerid, vehicleInfoPTD[playerid][3], 640.0000, 0.0000);
  396.  
  397.     vehicleInfoPTD[playerid][4] = CreatePlayerTextDraw(playerid, 320.5000, 413.5000, "[MAX: 120 kps]");
  398.     PlayerTextDrawFont(playerid, vehicleInfoPTD[playerid][4], 1);
  399.     PlayerTextDrawLetterSize(playerid, vehicleInfoPTD[playerid][4], 0.1199, 0.5999);
  400.     PlayerTextDrawColor(playerid, vehicleInfoPTD[playerid][4], 1684301055);
  401.     PlayerTextDrawSetShadow(playerid, vehicleInfoPTD[playerid][4], 0);
  402.     PlayerTextDrawSetOutline(playerid, vehicleInfoPTD[playerid][4], 0);
  403.     PlayerTextDrawBackgroundColor(playerid, vehicleInfoPTD[playerid][4], 255);
  404.     PlayerTextDrawSetProportional(playerid, vehicleInfoPTD[playerid][4], 1);
  405.     PlayerTextDrawTextSize(playerid, vehicleInfoPTD[playerid][4], 640.0000, 0.0000);
  406. }
  407.  
  408. Float:GetSpeed(Float:vx, Float:vy, Float:vz) {
  409.     return floatsqroot(floatpower(vx, 2.0) + floatpower(vy, 2.0) + floatpower(vz, 2.0)) * 180.0;
  410. }
  411.  
  412. GetVehicleModelName(modelid, dest[], maxlength) {
  413.     return format(dest, maxlength, VEHICLE_NAMES[modelid - 400]);
  414. }
  415.  
  416. Float:GetVehicleModelTopSpeed(modelid) {
  417.     return VEHICLE_TOP_SPEEDS[modelid - 400];
  418. }
  419.  
  420. FormatNumber(number) {
  421.     new numOfPeriods = 0;
  422.     new tmp = number;
  423.     new ret[32];
  424.  
  425.     while(tmp > 1000) {
  426.         tmp = floatround(tmp / 1000, floatround_floor);
  427.         ++numOfPeriods;
  428.     }
  429.  
  430.     valstr(ret, number);
  431.  
  432.     new slen = strlen(ret);
  433.     for(new i = 1; i != (numOfPeriods + 1); ++i) {
  434.         strins(ret, ",", (slen - 3 * i));
  435.     }
  436.  
  437.     return ret;
  438. }
  439.  
  440. ShowPlayerInfo(playerid, targetid) {
  441.     TextDrawSetPreviewModel(playerInfoTD[1], GetPlayerSkin(targetid));
  442.  
  443.     new name[MAX_PLAYER_NAME];
  444.     GetPlayerName(targetid, name, MAX_PLAYER_NAME);
  445.     PlayerTextDrawSetString(playerid, playerInfoPTD[playerid][0], name);
  446.     PlayerTextDrawColor(playerid, playerInfoPTD[playerid][0], ((GetPlayerColor(targetid) & ~0xFF) | 0xFF));
  447.  
  448.     new string[128];
  449.     format(string, sizeof(string), "ID: %i", targetid);
  450.     PlayerTextDrawSetString(playerid, playerInfoPTD[playerid][1], string);
  451.  
  452.     for (new i = 0; i < sizeof(playerInfoPTD[]); i++) {
  453.         PlayerTextDrawShow(playerid, playerInfoPTD[playerid][i]);
  454.     }
  455.  
  456.     for (new i = 0; i < sizeof(playerInfoFrameTD); i++) {
  457.         TextDrawShowForPlayer(playerid, playerInfoFrameTD[i]);
  458.     }
  459.  
  460.     for (new i = 0; i < sizeof(playerInfoTD); i++) {
  461.         TextDrawShowForPlayer(playerid, playerInfoTD[i]);
  462.     }
  463. }
  464.  
  465. HidePlayerInfo(playerid) {
  466.     for (new i = 0; i < sizeof(playerInfoPTD[]); i++) {
  467.         PlayerTextDrawHide(playerid, playerInfoPTD[playerid][i]);
  468.     }
  469.  
  470.     for (new i = 0; i < sizeof(playerInfoFrameTD); i++) {
  471.         TextDrawHideForPlayer(playerid, playerInfoFrameTD[i]);
  472.     }
  473.  
  474.     for (new i = 0; i < sizeof(playerInfoTD); i++) {
  475.         TextDrawHideForPlayer(playerid, playerInfoTD[i]);
  476.     }
  477. }
  478.  
  479. UpdatePlayerInfo(playerid, targetid) {
  480.     new Float:amount;
  481.     GetPlayerHealth(targetid, amount);
  482.  
  483.     new string[128];
  484.     format(string, sizeof(string), "HEALTH: ~w~%i", floatround(amount));
  485.     PlayerTextDrawSetString(playerid, playerInfoPTD[playerid][2], string);
  486.  
  487.     new Float:barLength = ((clamp(floatround(amount), 0, 100) / 100.0) * 64.0);
  488.     TextDrawTextSize(playerInfoTD[3], barLength, 3.0000);
  489.     TextDrawShowForPlayer(playerid, playerInfoTD[3]);
  490.  
  491.     GetPlayerArmour(targetid, amount);
  492.     format(string, sizeof(string), "ARMOUR: ~w~%i", floatround(amount));
  493.     PlayerTextDrawSetString(playerid, playerInfoPTD[playerid][3], string);
  494.  
  495.     barLength = ((clamp(floatround(amount), 0, 100) / 100.0) * 64.0);
  496.     TextDrawTextSize(playerInfoTD[5], barLength, 3.0000);
  497.     TextDrawShowForPlayer(playerid, playerInfoTD[5]);
  498.  
  499.     if (GetPlayerWeapon(targetid) == 0) {
  500.         string = "WEAPON: ~w~Unarmed";
  501.     }
  502.     else {
  503.         GetWeaponName(GetPlayerWeapon(targetid), string, sizeof(string));
  504.         format(string, sizeof(string), "WEAPON: ~w~%s (%i)", string, GetPlayerAmmo(targetid));
  505.     }
  506.     PlayerTextDrawSetString(playerid, playerInfoPTD[playerid][4], string);
  507.  
  508.     format(string, sizeof(string), "MONEY: ~g~$~w~%s", FormatNumber(GetPlayerMoney(targetid)));
  509.     PlayerTextDrawSetString(playerid, playerInfoPTD[playerid][5], string);
  510.  
  511.     new Float:vx, Float:vy, Float:vz;
  512.     GetPlayerVelocity(targetid, vx, vy, vz);
  513.     format(string, sizeof(string), "SPEED: ~w~%0.1f MPH", (GetSpeed(vx, vy, vz) / 1.609344));
  514.     PlayerTextDrawSetString(playerid, playerInfoPTD[playerid][6], string);
  515.  
  516.     new index;
  517.     foreach (new i : SpectatePlayers) {
  518.         ++index;
  519.         if (i == targetid) {
  520.             break;
  521.         }
  522.     }
  523.     format(string, sizeof(string), "%i/%i", index, Iter_Count(SpectatePlayers));
  524.     PlayerTextDrawSetString(playerid, playerInfoPTD[playerid][7], string);
  525. }
  526.  
  527. ShowVehicleInfo(playerid, vehicleid) {
  528.     new modelid = GetVehicleModel(vehicleid);
  529.     TextDrawSetPreviewModel(vehicleInfoTD[1], modelid);
  530.  
  531.     new string[128];
  532.     GetVehicleModelName(modelid, string, sizeof(string));
  533.     PlayerTextDrawSetString(playerid, vehicleInfoPTD[playerid][0], string);
  534.  
  535.     format(string, sizeof(string), "MODEL ID: %i", modelid);
  536.     PlayerTextDrawSetString(playerid, vehicleInfoPTD[playerid][1], string);
  537.  
  538.     format(string, sizeof(string), "[MAX: %0.1f km/h]", GetVehicleModelTopSpeed(modelid));
  539.     PlayerTextDrawSetString(playerid, vehicleInfoPTD[playerid][4], string);
  540.  
  541.     for (new i = 0; i < sizeof(vehicleInfoPTD[]); i++) {
  542.         PlayerTextDrawShow(playerid, vehicleInfoPTD[playerid][i]);
  543.     }
  544.  
  545.     for (new i = 0; i < sizeof(vehicleInfoFrameTD); i++) {
  546.         TextDrawShowForPlayer(playerid, vehicleInfoFrameTD[i]);
  547.     }
  548.  
  549.     for (new i = 0; i < sizeof(vehicleInfoTD); i++) {
  550.         TextDrawShowForPlayer(playerid, vehicleInfoTD[i]);
  551.     }
  552. }
  553.  
  554. HideVehicleInfo(playerid) {
  555.     for (new i = 0; i < sizeof(vehicleInfoPTD[]); i++) {
  556.         PlayerTextDrawHide(playerid, vehicleInfoPTD[playerid][i]);
  557.     }
  558.  
  559.     for (new i = 0; i < sizeof(vehicleInfoFrameTD); i++) {
  560.         TextDrawHideForPlayer(playerid, vehicleInfoFrameTD[i]);
  561.     }
  562.  
  563.     for (new i = 0; i < sizeof(vehicleInfoTD); i++) {
  564.         TextDrawHideForPlayer(playerid, vehicleInfoTD[i]);
  565.     }
  566. }
  567.  
  568. UpdateVehicleInfo(playerid, vehicleid) {
  569.     new Float:amount;
  570.     GetVehicleHealth(vehicleid, amount);
  571.  
  572.     new string[128];
  573.     format(string, sizeof(string), "HEALTH: ~w~%i/1000", floatround(amount));
  574.     PlayerTextDrawSetString(playerid, vehicleInfoPTD[playerid][2], string);
  575.  
  576.     new Float:barLength = ((clamp(floatround(amount), 0, 1000) / 1000.0) * 94.5);
  577.     TextDrawTextSize(vehicleInfoTD[3], barLength, 3.0000);
  578.     TextDrawShowForPlayer(playerid, vehicleInfoTD[3]);
  579.  
  580.     new Float:vx, Float:vy, Float:vz;
  581.     GetVehicleVelocity(vehicleid, vx, vy, vz);
  582.     format(string, sizeof(string), "SPEED: ~w~%0.1f KM/H", GetSpeed(vx, vy, vz));
  583.     PlayerTextDrawSetString(playerid, vehicleInfoPTD[playerid][3], string);
  584. }
  585.  
  586. GetNextPlayer(current) {
  587.     new next = INVALID_PLAYER_ID;
  588.  
  589.     if (Iter_Count(SpectatePlayers) > 1) {
  590.         if (Iter_Contains(SpectatePlayers, current)) {
  591.             next = Iter_Next(SpectatePlayers, current);
  592.  
  593.             if (next == Iter_End(SpectatePlayers)) {
  594.                 next = Iter_First(SpectatePlayers);
  595.             }
  596.         }
  597.     }
  598.  
  599.     return next;
  600. }
  601.  
  602. GetPreviousPlayer(current) {
  603.     new prev = INVALID_PLAYER_ID;
  604.  
  605.     if (Iter_Count(SpectatePlayers) > 1) {
  606.         if (Iter_Contains(SpectatePlayers, current)) {
  607.             prev = Iter_Prev(SpectatePlayers, current);
  608.  
  609.             if (prev == Iter_Begin(SpectatePlayers)) {
  610.                 prev = Iter_Last(SpectatePlayers);
  611.             }
  612.         }
  613.     }
  614.  
  615.     return prev;
  616. }
  617.  
  618. StartSpectate(playerid, targetid) {
  619.     TogglePlayerSpectating(playerid, 1);
  620.  
  621.     SetPlayerInterior(playerid, GetPlayerInterior(targetid));
  622.     SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(targetid));
  623.  
  624.     new vehicleid = GetPlayerVehicleID(targetid);
  625.     if (vehicleid != 0) {
  626.         PlayerSpectateVehicle(playerid, vehicleid, SPECTATE_MODE_NORMAL);
  627.         ShowPlayerInfo(playerid, targetid);
  628.         ShowVehicleInfo(playerid, vehicleid);
  629.     }
  630.     else {
  631.         PlayerSpectatePlayer(playerid, targetid, SPECTATE_MODE_NORMAL);
  632.         ShowPlayerInfo(playerid, targetid);
  633.         HideVehicleInfo(playerid);
  634.     }
  635.  
  636.     spectateID[playerid] = targetid;
  637.     spectateType[playerid] = (vehicleid != 0) ? SPECTATE_TYPE_VEHICLE : SPECTATE_TYPE_PLAYER;
  638.  
  639.     return SelectTextDraw(playerid, 0xAA0000FF);
  640. }
  641.  
  642. StopSpectate(playerid) {
  643.     TogglePlayerSpectating(playerid, 0);
  644.  
  645.     HidePlayerInfo(playerid);
  646.     HideVehicleInfo(playerid);
  647.  
  648.     spectateID[playerid] = INVALID_PLAYER_ID;
  649.  
  650.     return CancelSelectTextDraw(playerid);
  651. }
  652.  
  653. public OnFilterScriptInit() {
  654.     CreateTextDraws();
  655.  
  656.     return 1;
  657. }
  658.  
  659. public OnFilterScriptExit() {
  660.     for (new i = 0; i < sizeof(playerInfoFrameTD); i++) {
  661.         TextDrawDestroy(playerInfoFrameTD[i]);
  662.     }
  663.  
  664.     for (new i = 0; i < sizeof(playerInfoTD); i++) {
  665.         TextDrawDestroy(playerInfoTD[i]);
  666.     }
  667.  
  668.     for (new i = 0; i < sizeof(vehicleInfoFrameTD); i++) {
  669.         TextDrawDestroy(vehicleInfoFrameTD[i]);
  670.     }
  671.  
  672.     for (new i = 0; i < sizeof(vehicleInfoTD); i++) {
  673.         TextDrawDestroy(vehicleInfoTD[i]);
  674.     }
  675.  
  676.     return 1;
  677. }
  678.  
  679. public OnPlayerConnect(playerid) {
  680.     spectateID[playerid] = INVALID_PLAYER_ID;
  681.  
  682.     CreatePlayerTextDraws(playerid);
  683.  
  684.     return 1;
  685. }
  686.  
  687. public OnPlayerStateChange(playerid, newstate, oldstate) {
  688.     if (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) {
  689.         new vehicleid = GetPlayerVehicleID(playerid);
  690.  
  691.         foreach (new i : Player) {
  692.             if (spectateID[i] == playerid) {
  693.                 PlayerSpectateVehicle(i, vehicleid, SPECTATE_MODE_NORMAL);
  694.  
  695.                 ShowVehicleInfo(i, vehicleid);
  696.                 spectateType[i] = SPECTATE_TYPE_VEHICLE;
  697.             }
  698.         }
  699.     }
  700.     else if (newstate == PLAYER_STATE_ONFOOT) {
  701.         foreach (new i : Player) {
  702.             if (spectateID[i] == playerid) {
  703.                 PlayerSpectatePlayer(i, playerid, SPECTATE_MODE_NORMAL);
  704.  
  705.                 HideVehicleInfo(i);
  706.                 spectateType[i] = SPECTATE_TYPE_PLAYER;
  707.             }
  708.         }
  709.     }
  710.     else if (newstate == PLAYER_STATE_SPECTATING) {
  711.         new prev = GetPreviousPlayer(playerid);
  712.  
  713.         if (prev == INVALID_PLAYER_ID) {
  714.             foreach (new i : Player) {
  715.                 if (spectateID[i] == playerid) {
  716.                     StopSpectate(i);
  717.                 }
  718.             }
  719.         }
  720.         else {
  721.             foreach (new i : Player) {
  722.                 if (spectateID[i] == playerid) {
  723.                     StartSpectate(i, prev);
  724.                 }
  725.             }
  726.         }
  727.  
  728.         Iter_Remove(SpectatePlayers, playerid);
  729.     }
  730.  
  731.     return 1;
  732. }
  733.  
  734. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid) {
  735.     foreach (new i : Player) {
  736.         if (spectateID[i] == playerid) {
  737.             SetPlayerInterior(i, newinteriorid);
  738.         }
  739.     }
  740.  
  741.     return 1;
  742. }
  743.  
  744. public OnPlayerDisconnect(playerid, reason) {
  745.     new prev = GetPreviousPlayer(playerid);
  746.  
  747.     if (prev == INVALID_PLAYER_ID) {
  748.         foreach (new i : Player) {
  749.             if (spectateID[i] == playerid) {
  750.                 StopSpectate(i);
  751.             }
  752.         }
  753.     }
  754.     else {
  755.         foreach (new i : Player) {
  756.             if (spectateID[i] == playerid) {
  757.                 StartSpectate(i, prev);
  758.             }
  759.         }
  760.     }
  761.  
  762.     Iter_Remove(SpectatePlayers, playerid);
  763.  
  764.     return 1;
  765. }
  766.  
  767. public OnPlayerDeath(playerid, killerid, reason) {
  768.     new Float:x, Float:y, Float:z;
  769.     GetPlayerPos(playerid, x, y, z);
  770.  
  771.     new Float:cx, Float:cy, Float:cz;
  772.     GetPlayerCameraPos(playerid, cx, cy, cz);
  773.  
  774.     cz += !GetPlayerInterior(playerid) ? 5.0 : 0.5;
  775.  
  776.     foreach (new i : Player) {
  777.         if (spectateID[i] == playerid) {
  778.             SetPlayerCameraPos(i, cx, cy, cz);
  779.             SetPlayerCameraLookAt(i, x, y, z);
  780.         }
  781.     }
  782.  
  783.     Iter_Remove(SpectatePlayers, playerid);
  784.  
  785.     return 1;
  786. }
  787.  
  788. public OnPlayerSpawn(playerid) {
  789.     Iter_Add(SpectatePlayers, playerid);
  790.  
  791.     foreach (new i : Player) {
  792.         if (spectateID[i] == playerid) {
  793.             StartSpectate(i, playerid);
  794.         }
  795.     }
  796.  
  797.     return 1;
  798. }
  799.  
  800. public OnPlayerClickTextDraw(playerid, Text:clickedid) {
  801.     if (spectateID[playerid] != INVALID_PLAYER_ID) {
  802.         if (clickedid == Text:INVALID_TEXT_DRAW) {
  803.             spectateCameraON[playerid] = true;
  804.         }
  805.         else if (clickedid == BUTTON_PREVIOUS) {
  806.             new prev = GetPreviousPlayer(spectateID[playerid]);
  807.             if (prev == INVALID_PLAYER_ID) {
  808.                 PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
  809.             }
  810.             else {
  811.                 StartSpectate(playerid, prev);
  812.             }
  813.         }
  814.         else if (clickedid == BUTTON_NEXT) {
  815.             new next = GetNextPlayer(spectateID[playerid]);
  816.             if (next == INVALID_PLAYER_ID) {
  817.                 PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
  818.             }
  819.             else {
  820.                 StartSpectate(playerid, next);
  821.             }
  822.         }
  823.     }
  824.  
  825.     return 0;
  826. }
  827.  
  828. public OnPlayerUpdate(playerid) {
  829.     new worldid = GetPlayerVirtualWorld(playerid);
  830.     if (playerVirtualWorld[playerid] != worldid) {
  831.         playerVirtualWorld[playerid] = worldid;
  832.  
  833.         foreach (new i : Player) {
  834.             if (spectateID[i] == playerid) {
  835.                 SetPlayerVirtualWorld(i, worldid);
  836.             }
  837.         }
  838.     }
  839.  
  840.     foreach (new i : Player) {
  841.         if (spectateID[i] == playerid) {
  842.             UpdatePlayerInfo(i, playerid);
  843.  
  844.             if (spectateType[i] == SPECTATE_TYPE_VEHICLE) {
  845.                 UpdateVehicleInfo(i, GetPlayerVehicleID(playerid));
  846.             }
  847.         }
  848.     }
  849.  
  850.     return 1;
  851. }
  852. CMD:spectate(playerid, params[]) {
  853.     new targetid;
  854.     if (sscanf(params, "u", targetid)) {
  855.         return SendClientMessage(playerid, -1, "[USE]: /spectate [ID]");
  856.     }
  857.  
  858.     if (targetid == INVALID_PLAYER_ID || targetid == playerid) {
  859.         return SendClientMessage(playerid, 0xBB0000FF, "{B00000}[GRESKA]: {FFFFFF}Pogresan ID !");
  860.     }
  861.  
  862.     if (GetPlayerState(targetid) == PLAYER_STATE_WASTED || GetPlayerState(targetid) == PLAYER_STATE_SPECTATING) {
  863.         return SendClientMessage(playerid, 0xBB0000FF, "{B00000}[GRESKA]: {FFFFFF}Igrac se jos nije prijavio !");
  864.     }
  865.  
  866.     oldPlayerVirtualWorld[playerid] = GetPlayerVirtualWorld(playerid);
  867.     oldPlayerInterior[playerid] = GetPlayerInterior(playerid);
  868.     GetPlayerPos(playerid, oldPlayerPosition[playerid][0], oldPlayerPosition[playerid][1], oldPlayerPosition[playerid][2]);
  869.     GetPlayerFacingAngle(playerid, oldPlayerPosition[playerid][3]);
  870.     GetPlayerHealth(playerid, oldPlayerHealth[playerid]);
  871.     GetPlayerArmour(playerid, oldPlayerArmour[playerid]);
  872.  
  873.     StartSpectate(playerid, targetid);
  874.     return 1;
  875. }
  876.  
  877. CMD:spectateoff(playerid, params[]) {
  878.     if (GetPlayerState(playerid) != PLAYER_STATE_SPECTATING) {
  879.         return SendClientMessage(playerid, 0xBB0000FF, "{B00000}[GRESKA]: {FFFFFF}Trenutno ne specate nikoga !");
  880.     }
  881.  
  882.     StopSpectate(playerid);
  883.  
  884.     SetPlayerVirtualWorld(playerid, oldPlayerVirtualWorld[playerid]);
  885.     SetPlayerInterior(playerid, oldPlayerInterior[playerid]);
  886.     SetPlayerPos(playerid, oldPlayerPosition[playerid][0], oldPlayerPosition[playerid][1], oldPlayerPosition[playerid][2]);
  887.     SetPlayerFacingAngle(playerid, oldPlayerPosition[playerid][3]);
  888.     SetPlayerHealth(playerid, oldPlayerHealth[playerid]);
  889.     SetPlayerArmour(playerid, oldPlayerArmour[playerid]);
  890.     return 1;
  891. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement