Guest User

oSpeeDo1.2

a guest
Jun 13th, 2010
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 12.26 KB | None | 0 0
  1. /////////////////////////////////////////oSpeeDo Version 1.2////////////////////////////////////////////////////////////
  2. #include <a_samp>
  3. /*Timer for updating textdraws*/
  4. forward CheckInfo();
  5.  
  6. /*Textdraws*/
  7. new Text:Name[MAX_PLAYERS];
  8. new Text:Height[MAX_PLAYERS];
  9. new Text:Type[MAX_PLAYERS];
  10. new Text:KMH[MAX_PLAYERS];
  11. new Text:Health[MAX_PLAYERS];
  12. new Text:White1[MAX_PLAYERS],Text:White2[MAX_PLAYERS],Text:White3[MAX_PLAYERS],Text:White4[MAX_PLAYERS];
  13. new Names[][] = {
  14.    "Landstalker",
  15.    "Bravura",
  16.    "Buffalo",
  17.    "Linerunner",
  18.    "Pereniel",
  19.    "Sentinel",
  20.    "Dumper",
  21.    "Firetruck",
  22.    "Trashmaster",
  23.    "Stretch",
  24.    "Manana",
  25.    "Infernus",
  26.    "Voodoo",
  27.    "Pony",
  28.    "Mule",
  29.    "Cheetah",
  30.    "Ambulance",
  31.    "Leviathan",
  32.    "Moonbeam",
  33.    "Esperanto",
  34.    "Taxi",
  35.    "Washington",
  36.    "Bobcat",
  37.    "Mr Whoopee",
  38.    "BF Injection",
  39.    "Hunter",
  40.    "Premier",
  41.    "Enforcer",
  42.    "Securicar",
  43.    "Banshee",
  44.    "Predator",
  45.    "Bus",
  46.    "Rhino",
  47.    "Barracks",
  48.    "Hotknife",
  49.    "Trailer",
  50.    "Previon",
  51.    "Coach",
  52.    "Cabbie",
  53.    "Stallion",
  54.    "Rumpo",
  55.    "RC Bandit",
  56.    "Romero",
  57.    "Packer",
  58.    "Monster",
  59.    "Admiral",
  60.    "Squalo",
  61.    "Seasparrow",
  62.    "Pizzaboy",
  63.    "Tram",
  64.    "Trailer",
  65.    "Turismo",
  66.    "Speeder",
  67.    "Reefer",
  68.    "Tropic",
  69.    "Flatbed",
  70.    "Yankee",
  71.    "Caddy",
  72.    "Solair",
  73.    "RC Van",
  74.    "Skimmer",
  75.    "PCJ-600",
  76.    "Faggio",
  77.    "Freeway",
  78.    "RC Baron",
  79.    "RC Raider",
  80.    "Glendale",
  81.    "Oceanic",
  82.    "Sanchez",
  83.    "Sparrow",
  84.    "Patriot",
  85.    "Quad",
  86.    "Coastguard",
  87.    "Dinghy",
  88.    "Hermes",
  89.    "Sabre",
  90.    "Rustler",
  91.    "ZR-350",
  92.    "Walton",
  93.    "Regina",
  94.    "Comet",
  95.    "BMX",
  96.    "Burrito",
  97.    "Camper",
  98.    "Marquis",
  99.    "Baggage",
  100.    "Dozer",
  101.    "Maverick",
  102.    "News Chopper",
  103.    "Rancher",
  104.    "FBI Rancher",
  105.    "Virgo",
  106.    "Greenwood",
  107.    "Jetmax",
  108.    "Hotring",
  109.    "Sandking",
  110.    "Blista Compact",
  111.    "PD Maverick",
  112.    "Boxville",
  113.    "Benson",
  114.    "Mesa",
  115.    "RC Goblin",
  116.    "Hotring",
  117.    "Hotring",
  118.    "Bloodring",
  119.    "Rancher",
  120.    "Super GT",
  121.    "Elegant",
  122.    "Journey",
  123.    "Bike",
  124.    "Mountain Bike",
  125.    "Beagle",
  126.    "Cropdust",
  127.    "Stunt",
  128.    "Tanker",
  129.    "RoadTrain",
  130.    "Nebula",
  131.    "Majestic",
  132.    "Buccaneer",
  133.    "Shamal",
  134.    "Hydra",
  135.    "FCR-900",
  136.    "NRG-500",
  137.    "HPV1000",
  138.    "Cement",
  139.    "Tow Truck",
  140.    "Fortune",
  141.    "Cadrona",
  142.    "FBI Truck",
  143.    "Willard",
  144.    "Forklift",
  145.    "Tractor",
  146.    "Combine",
  147.    "Feltzer",
  148.    "Remington",
  149.    "Slamvan",
  150.    "Blade",
  151.    "Freight",
  152.    "Streak",
  153.    "Vortex",
  154.    "Vincent",
  155.    "Bullet",
  156.    "Clover",
  157.    "Sadler",
  158.    "Firetruck",
  159.    "Hustler",
  160.    "Intruder",
  161.    "Primo",
  162.    "Cargobob",
  163.    "Tampa",
  164.    "Sunrise",
  165.    "Merit",
  166.    "Utility",
  167.    "Nevada",
  168.    "Yosemite",
  169.    "Windsor",
  170.    "Monster",
  171.    "Monster",
  172.    "Uranus",
  173.    "Jester",
  174.    "Sultan",
  175.    "Stratum",
  176.    "Elegy",
  177.    "Raindance",
  178.    "RC Tiger",
  179.    "Flash",
  180.    "Tahoma",
  181.    "Savanna",
  182.    "Bandito",
  183.    "Freight",
  184.    "Trailer",
  185.    "Kart",
  186.    "Mower",
  187.    "Duneride",
  188.    "Sweeper",
  189.    "Broadway",
  190.    "Tornado",
  191.    "AT-400",
  192.    "DFT-30",
  193.    "Huntley",
  194.    "Stafford",
  195.    "BF-400",
  196.    "Newsvan",
  197.    "Tug",
  198.    "Trailer",
  199.    "Emperor",
  200.    "Wayfarer",
  201.    "Euros",
  202.    "Hotdog",
  203.    "Club",
  204.    "Trailer",
  205.    "Trailer",
  206.    "Andromada",
  207.    "Dodo",
  208.    "RC Cam",
  209.    "Launch",
  210.    "Police Car",
  211.    "Police Car",
  212.    "Police Car",
  213.    "Police Ranger",
  214.    "Picador",
  215.    "S.W.A.T",
  216.    "Alpha",
  217.    "Phoenix",
  218.    "Glendale",
  219.    "Sadler",
  220.    "Luggage Trailer",
  221.    "Luggage Trailer",
  222.    "Stair Trailer",
  223.    "Boxville",
  224.    "Farm Plow",
  225.    "Utility Trailer"
  226. };
  227.  
  228. public OnFilterScriptInit()
  229. {
  230.     SetTimer("CheckInfo",150,1);
  231.    
  232.     for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
  233.     {
  234.         Name[playerid] = TextDrawCreate(422.000000, 363.000000, "~r~Name:");
  235.         TextDrawBackgroundColor(Name[playerid], 255);
  236.         TextDrawFont(Name[playerid], 1);
  237.         TextDrawLetterSize(Name[playerid], 0.409999, 1.000000);
  238.         TextDrawColor(Name[playerid], -1);
  239.         TextDrawSetOutline(Name[playerid], 1);
  240.         TextDrawSetProportional(Name[playerid], 1);
  241.         TextDrawUseBox(Name[playerid], 1);
  242.         TextDrawBoxColor(Name[playerid], 102);
  243.         TextDrawTextSize(Name[playerid], 553.000000, -2.000000);
  244.  
  245.         Height[playerid] = TextDrawCreate(422.000000, 379.000000, "~y~Height:");
  246.         TextDrawBackgroundColor(Height[playerid], 255);
  247.         TextDrawFont(Height[playerid], 1);
  248.         TextDrawLetterSize(Height[playerid], 0.409999, 1.000000);
  249.         TextDrawColor(Height[playerid], -1);
  250.         TextDrawSetOutline(Height[playerid], 1);
  251.         TextDrawSetProportional(Height[playerid], 1);
  252.         TextDrawUseBox(Height[playerid], 1);
  253.         TextDrawBoxColor(Height[playerid], 102);
  254.         TextDrawTextSize(Height[playerid], 553.000000, -2.000000);
  255.  
  256.         Type[playerid] = TextDrawCreate(422.000000, 395.000000, "~g~Type:");
  257.         TextDrawBackgroundColor(Type[playerid], 255);
  258.         TextDrawFont(Type[playerid], 1);
  259.         TextDrawLetterSize(Type[playerid], 0.409999, 1.000000);
  260.         TextDrawColor(Type[playerid], -1);
  261.         TextDrawSetOutline(Type[playerid], 1);
  262.         TextDrawSetProportional(Type[playerid], 1);
  263.         TextDrawUseBox(Type[playerid], 1);
  264.         TextDrawBoxColor(Type[playerid], 102);
  265.         TextDrawTextSize(Type[playerid], 553.000000, -2.000000);
  266.  
  267.         KMH[playerid] = TextDrawCreate(422.000000, 411.000000, "~p~KM/H:");
  268.         TextDrawBackgroundColor(KMH[playerid], 255);
  269.         TextDrawFont(KMH[playerid], 1);
  270.         TextDrawLetterSize(KMH[playerid], 0.409999, 1.000000);
  271.         TextDrawColor(KMH[playerid], -1);
  272.         TextDrawSetOutline(KMH[playerid], 1);
  273.         TextDrawSetProportional(KMH[playerid], 1);
  274.         TextDrawUseBox(KMH[playerid], 1);
  275.         TextDrawBoxColor(KMH[playerid], 102);
  276.         TextDrawTextSize(KMH[playerid], 553.000000, -2.000000);
  277.  
  278.         Health[playerid] = TextDrawCreate(422.000000, 427.000000, "~b~Health:");
  279.         TextDrawBackgroundColor(Health[playerid], 255);
  280.         TextDrawFont(Health[playerid], 1);
  281.         TextDrawLetterSize(Health[playerid], 0.409999, 1.000000);
  282.         TextDrawColor(Health[playerid], -1);
  283.         TextDrawSetOutline(Health[playerid], 1);
  284.         TextDrawSetProportional(Health[playerid], 1);
  285.         TextDrawUseBox(Health[playerid], 1);
  286.         TextDrawBoxColor(Health[playerid], 102);
  287.         TextDrawTextSize(Health[playerid], 553.000000, -2.000000);
  288.  
  289.         White1[playerid] = TextDrawCreate(422.000000, 363.000000, "_");
  290.         TextDrawBackgroundColor(White1[playerid], 255);
  291.         TextDrawFont(White1[playerid], 1);
  292.         TextDrawLetterSize(White1[playerid], 0.500000, 8.099999);
  293.         TextDrawColor(White1[playerid], -1);
  294.         TextDrawSetOutline(White1[playerid], 0);
  295.         TextDrawSetProportional(White1[playerid], 1);
  296.         TextDrawSetShadow(White1[playerid], 1);
  297.         TextDrawUseBox(White1[playerid], 1);
  298.         TextDrawBoxColor(White1[playerid], -1);
  299.         TextDrawTextSize(White1[playerid], 416.000000, 0.000000);
  300.  
  301.         White2[playerid] = TextDrawCreate(561.000000, 363.000000, "_");
  302.         TextDrawBackgroundColor(White2[playerid], 255);
  303.         TextDrawFont(White2[playerid], 1);
  304.         TextDrawLetterSize(White2[playerid], 0.500000, 8.099999);
  305.         TextDrawColor(White2[playerid], -1);
  306.         TextDrawSetOutline(White2[playerid], 0);
  307.         TextDrawSetProportional(White2[playerid], 1);
  308.         TextDrawSetShadow(White2[playerid], 1);
  309.         TextDrawUseBox(White2[playerid], 1);
  310.         TextDrawBoxColor(White2[playerid], -1);
  311.         TextDrawTextSize(White2[playerid], 555.000000, 0.000000);
  312.  
  313.         White3[playerid] = TextDrawCreate(563.000000, 360.000000, "_");
  314.         TextDrawBackgroundColor(White3[playerid], 255);
  315.         TextDrawFont(White3[playerid], 1);
  316.         TextDrawLetterSize(White3[playerid], 0.500000, -0.499998);
  317.         TextDrawColor(White3[playerid], -1);
  318.         TextDrawSetOutline(White3[playerid], 0);
  319.         TextDrawSetProportional(White3[playerid], 1);
  320.         TextDrawSetShadow(White3[playerid], 1);
  321.         TextDrawUseBox(White3[playerid], 1);
  322.         TextDrawBoxColor(White3[playerid], -1);
  323.         TextDrawTextSize(White3[playerid], 414.000000, 0.000000);
  324.  
  325.         White4[playerid] = TextDrawCreate(563.000000, 444.000000, "_");
  326.         TextDrawBackgroundColor(White4[playerid], 255);
  327.         TextDrawFont(White4[playerid], 1);
  328.         TextDrawLetterSize(White4[playerid], 0.500000, -0.499998);
  329.         TextDrawColor(White4[playerid], -1);
  330.         TextDrawSetOutline(White4[playerid], 0);
  331.         TextDrawSetProportional(White4[playerid], 1);
  332.         TextDrawSetShadow(White4[playerid], 1);
  333.         TextDrawUseBox(White4[playerid], 1);
  334.         TextDrawBoxColor(White4[playerid], -1);
  335.         TextDrawTextSize(White4[playerid], 414.000000, 0.000000);
  336.     }
  337.     return 1;
  338. }
  339.  
  340. public OnFilterScriptExit()
  341. {
  342.     for(new i = 0;i < MAX_PLAYERS; i++)
  343.     {
  344.         TextDrawHideForPlayer(i,Name[i]);
  345.         TextDrawHideForPlayer(i,Height[i]);
  346.         TextDrawHideForPlayer(i,KMH[i]);
  347.         TextDrawHideForPlayer(i,Type[i]);
  348.         TextDrawHideForPlayer(i,Health[i]);
  349.         TextDrawHideForPlayer(i,White1[i]);
  350.         TextDrawHideForPlayer(i,White2[i]);
  351.         TextDrawHideForPlayer(i,White3[i]);
  352.         TextDrawHideForPlayer(i,White4[i]);
  353.     }
  354.     return 1;
  355. }
  356. public CheckInfo()
  357. {
  358.     for(new i = 0;i < MAX_PLAYERS; i++)
  359.     {
  360.         if (IsPlayerInAnyVehicle(i) && IsPlayerConnected(i))
  361.         {
  362.             new Float:h,spe = GetPlayerSpeed(i),v = GetPlayerVehicleID(i),m = GetVehicleModel(v),Str1[138],Str2[138],Str3[138],Str4[138],Float:x,Float:y,Float:z;
  363.             GetVehicleHealth(v,h);
  364.             if(IsInAnyBike(v))
  365.             {
  366.                 TextDrawSetString(Type[i],"~g~Type: ~w~Bike");
  367.             }
  368.             else if(IsInAirplane(v))
  369.             {
  370.                 TextDrawSetString(Type[i],"~g~Type: ~w~Airplane");
  371.             }
  372.             else if(IsInHeli(v))
  373.             {
  374.                 TextDrawSetString(Type[i],"~g~Type: ~w~Helicopter");
  375.             }
  376.             else if(IsInBoat(v))
  377.             {
  378.                 TextDrawSetString(Type[i],"~g~Type: ~w~Boat");
  379.             }
  380.             else
  381.             {
  382.                 TextDrawSetString(Type[i],"~g~Type: ~w~Car");
  383.             }
  384.             GetPlayerPos(i,x,y,z);
  385.             format(Str1,138,"~p~KM/H: ~w~%d",spe);
  386.             format(Str2,138,"~r~Name: ~w~%s",Names[m-400]);
  387.             format(Str3,138,"~b~Health ~w~%.0f",h);
  388.             format(Str4,138,"~y~Height: ~w~%.2f",z);
  389.             TextDrawSetString(Name[i],Str2);
  390.             TextDrawSetString(Height[i],Str4);
  391.             TextDrawSetString(Health[i],Str3);
  392.             TextDrawSetString(KMH[i],Str1);
  393.         }
  394.     }
  395.     return 1;
  396. }
  397. public OnPlayerStateChange(playerid, newstate, oldstate)
  398. {
  399.     if (newstate == PLAYER_STATE_DRIVER)
  400.     {
  401.         TextDrawShowForPlayer(playerid,KMH[playerid]);
  402.         TextDrawShowForPlayer(playerid,Name[playerid]);
  403.         TextDrawShowForPlayer(playerid,Type[playerid]);
  404.         TextDrawShowForPlayer(playerid,Health[playerid]);
  405.         TextDrawShowForPlayer(playerid,Height[playerid]);
  406.         TextDrawShowForPlayer(playerid,White1[playerid]);
  407.         TextDrawShowForPlayer(playerid,White2[playerid]);
  408.         TextDrawShowForPlayer(playerid,White3[playerid]);
  409.         TextDrawShowForPlayer(playerid,White4[playerid]);
  410.     }
  411.     else if (newstate == PLAYER_STATE_ONFOOT)
  412.     {
  413.         TextDrawHideForPlayer(playerid,KMH[playerid]);
  414.         TextDrawHideForPlayer(playerid,Name[playerid]);
  415.         TextDrawHideForPlayer(playerid,Type[playerid]);
  416.         TextDrawHideForPlayer(playerid,Health[playerid]);
  417.         TextDrawHideForPlayer(playerid,Height[playerid]);
  418.         TextDrawHideForPlayer(playerid,White1[playerid]);
  419.         TextDrawHideForPlayer(playerid,White2[playerid]);
  420.         TextDrawHideForPlayer(playerid,White3[playerid]);
  421.         TextDrawHideForPlayer(playerid,White4[playerid]);
  422.     }
  423.     return 1;
  424. }
  425. stock IsInAnyBike(bikeid)
  426. {
  427.     new Bikes[] = { 509,510,481,581, 462, 521, 463, 522, 461, 448, 471, 468, 586 };
  428.     for(new i = 0; i < sizeof(Bikes); i++)
  429.     {
  430.         if(GetVehicleModel(bikeid) == Bikes[i]) return 1;
  431.     }
  432.     return 0;
  433. }
  434. stock IsInAirplane(airplaneid)
  435. {
  436.     new Airplanes[] = { 460,476,511,512,513,519,520,553,577,563,592,593 };
  437.     for(new i = 0; i < sizeof(Airplanes); i++)
  438.     {
  439.         if(GetVehicleModel(airplaneid) == Airplanes[i]) return 1;
  440.     }
  441.     return 0;
  442. }
  443. stock IsInHeli(heliid)
  444. {
  445.     new Helis[] = { 417,425,447,469,487,488,497,548,563 };
  446.     for(new i = 0; i < sizeof(Helis); i++)
  447.     {
  448.         if(GetVehicleModel(heliid) == Helis[i]) return 1;
  449.     }
  450.     return 0;
  451. }
  452. stock IsInBoat(boatid)
  453. {
  454.     new Boats[] = { 472, 473, 493, 495, 484, 430, 454, 453, 452, 446 };
  455.     for(new i = 0; i < sizeof(Boats); i++)
  456.     {
  457.         if(GetVehicleModel(boatid) == Boats[i]) return 1;
  458.     }
  459.     return 0;
  460. }
  461. stock GetPlayerSpeed(playerid)
  462. {
  463.     new Float:ST[4];
  464.     if(IsPlayerInAnyVehicle(playerid))
  465.     GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
  466.     else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
  467.     ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 100.3;
  468.     return floatround(ST[3]);
  469. }
Advertisement
Add Comment
Please, Sign In to add comment