Advertisement
Ranchend

Status Pojazdu

Feb 4th, 2014
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 13.11 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new Text:ServerTextDrawOne;
  4. new Text:ServerTextDrawTwo;
  5. new Text:ServerTextDrawThree[MAX_PLAYERS];
  6. new Text:ServerTextDrawFour[MAX_PLAYERS];
  7. new Text:ServerTextDrawFive[MAX_PLAYERS];
  8. new Text:ServerTextDrawSix[MAX_PLAYERS];
  9. new Text:ServerTextDrawSeven[MAX_PLAYERS];
  10. new Text:ServerTextDrawEight[MAX_PLAYERS];
  11. new ServerTimerOne;
  12. new VehicleNames[][] =
  13. {
  14.     {"Landstalker"},
  15.     {"Bravura"},
  16.     {"Buffalo"},
  17.     {"Linerunner"},
  18.     {"Perrenial"},
  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 1"},
  50.     {"Previon"},
  51.     {"Coach"},
  52.     {"Cabbie"},
  53.     {"Stallion"},
  54.     {"Rumpo"},
  55.     {"RC Bandit"},
  56.     {"Romero"},
  57.     {"Packer"},
  58.     {"Monster 1"},
  59.     {"Admiral"},
  60.     {"Squalo"},
  61.     {"Seasparrow"},
  62.     {"Pizzaboy"},
  63.     {"Tram"},
  64.     {"Trailer 2"},
  65.     {"Turismo"},
  66.     {"Speeder"},
  67.     {"Reefer"},
  68.     {"Tropic"},
  69.     {"Flatbed"},
  70.     {"Yankee"},
  71.     {"Caddy"},
  72.     {"Solair"},
  73.     {"Berkley's 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 1"},
  104.     {"FBI Rancher"},
  105.     {"Virgo"},
  106.     {"Greenwood"},
  107.     {"Jetmax"},
  108.     {"Hotring Racer 1"},
  109.     {"Sandking"},
  110.     {"Blista Compact"},
  111.     {"Police Maverick"},
  112.     {"Boxville"},
  113.     {"Benson"},
  114.     {"Mesa"},
  115.     {"RC Goblin"},
  116.     {"Hotring Racer 2"},
  117.     {"Hotring Racer 3"},
  118.     {"Bloodring Banger"},
  119.     {"Rancher 2"},
  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 Truck"},
  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 LA"},
  159.     {"Hustler"},
  160.     {"Intruder"},
  161.     {"Primo"},
  162.     {"Cargobob"},
  163.     {"Tampa"},
  164.     {"Sunrise"},
  165.     {"Merit"},
  166.     {"Utility"},
  167.     {"Nevada"},
  168.     {"Yosemite"},
  169.     {"Windsor"},
  170.     {"Monster 2"},
  171.     {"Monster 3"},
  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 Flat"},
  184.     {"Streak Carriage"},
  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 3"},
  199.     {"Emperor"},
  200.     {"Wayfarer"},
  201.     {"Euros"},
  202.     {"Hotdog"},
  203.     {"Club"},
  204.     {"Freight Carriage"},
  205.     {"Trailer 4"},
  206.     {"Andromada"},
  207.     {"Dodo"},
  208.     {"RC Cam"},
  209.     {"Launch"},
  210.     {"Police Car (LSPD)"},
  211.     {"Police Car (SFPD)"},
  212.     {"Police Car (LVPD)"},
  213.     {"Police Ranger"},
  214.     {"Picador"},
  215.     {"S.W.A.T. Van"},
  216.     {"Alpha"},
  217.     {"Phoenix"},
  218.     {"Glendale"},
  219.     {"Sadler"},
  220.     {"Luggage Trailer 1"},
  221.     {"Luggage Trailer 2"},
  222.     {"Stair Trailer"},
  223.     {"Boxville"},
  224.     {"Farm Plow"},
  225.     {"Utility Trailer"}
  226. };
  227.  
  228. forward PlayerUpdate();
  229.  
  230. stock VehicleSpeed(Vehicle)
  231. {
  232.     new Float:X;
  233.     new Float:Y;
  234.     new Float:Z;
  235.     GetVehicleVelocity(Vehicle,X,Y,Z);
  236.     new Float:Speed;
  237.     Speed = floatsqroot(floatpower(floatabs(X),2.0) + floatpower(floatabs(Y),2.0) + floatpower(floatabs(Z),2.0)) * 200.0;
  238.     return floatround(Speed);
  239. }
  240.  
  241. public OnFilterScriptInit()
  242. {
  243.     ServerTextDrawOne = TextDrawCreate(560.000000,120.000000,"-");
  244.     TextDrawAlignment(ServerTextDrawOne,2);
  245.     TextDrawBackgroundColor(ServerTextDrawOne,80);
  246.     TextDrawFont(ServerTextDrawOne,1);
  247.     TextDrawLetterSize(ServerTextDrawOne,15.000000,50.000000);
  248.     TextDrawColor(ServerTextDrawOne,80);
  249.     TextDrawSetOutline(ServerTextDrawOne,0);
  250.     TextDrawSetProportional(ServerTextDrawOne,1);
  251.     TextDrawSetShadow(ServerTextDrawOne,1);
  252.     ServerTextDrawTwo = TextDrawCreate(560.000000,370.000000,"~W~~H~Status Pojazdu");
  253.     TextDrawAlignment(ServerTextDrawTwo,2);
  254.     TextDrawBackgroundColor(ServerTextDrawTwo,255);
  255.     TextDrawFont(ServerTextDrawTwo,3);
  256.     TextDrawLetterSize(ServerTextDrawTwo,0.500000,1.000000);
  257.     TextDrawColor(ServerTextDrawTwo,-1);
  258.     TextDrawSetOutline(ServerTextDrawTwo,1);
  259.     TextDrawSetProportional(ServerTextDrawTwo,1);
  260.     for(new Player; Player < GetMaxPlayers(); Player++)
  261.     {
  262.         ServerTextDrawThree[Player] = TextDrawCreate(490.000000,380.000000," ");
  263.         TextDrawBackgroundColor(ServerTextDrawThree[Player],255);
  264.         TextDrawFont(ServerTextDrawThree[Player],2);
  265.         TextDrawLetterSize(ServerTextDrawThree[Player],0.200000,1.000000);
  266.         TextDrawColor(ServerTextDrawThree[Player],-1);
  267.         TextDrawSetOutline(ServerTextDrawThree[Player],1);
  268.         TextDrawSetProportional(ServerTextDrawThree[Player],1);
  269.         ServerTextDrawFour[Player] = TextDrawCreate(490.000000,390.000000," ");
  270.         TextDrawBackgroundColor(ServerTextDrawFour[Player],255);
  271.         TextDrawFont(ServerTextDrawFour[Player],2);
  272.         TextDrawLetterSize(ServerTextDrawFour[Player],0.200000,1.000000);
  273.         TextDrawColor(ServerTextDrawFour[Player],-1);
  274.         TextDrawSetOutline(ServerTextDrawFour[Player],1);
  275.         TextDrawSetProportional(ServerTextDrawFour[Player],1);
  276.         ServerTextDrawFive[Player] = TextDrawCreate(490.000000,400.000000," ");
  277.         TextDrawBackgroundColor(ServerTextDrawFive[Player],255);
  278.         TextDrawFont(ServerTextDrawFive[Player],2);
  279.         TextDrawLetterSize(ServerTextDrawFive[Player],0.200000,1.000000);
  280.         TextDrawColor(ServerTextDrawFive[Player],-1);
  281.         TextDrawSetOutline(ServerTextDrawFive[Player],1);
  282.         TextDrawSetProportional(ServerTextDrawFive[Player],1);
  283.         ServerTextDrawSix[Player] = TextDrawCreate(490.000000,410.000000," ");
  284.         TextDrawBackgroundColor(ServerTextDrawSix[Player],255);
  285.         TextDrawFont(ServerTextDrawSix[Player],2);
  286.         TextDrawLetterSize(ServerTextDrawSix[Player],0.200000,1.000000);
  287.         TextDrawColor(ServerTextDrawSix[Player],-1);
  288.         TextDrawSetOutline(ServerTextDrawSix[Player],1);
  289.         TextDrawSetProportional(ServerTextDrawSix[Player],1);
  290.         ServerTextDrawSeven[Player] = TextDrawCreate(490.000000,420.000000," ");
  291.         TextDrawBackgroundColor(ServerTextDrawSeven[Player],255);
  292.         TextDrawFont(ServerTextDrawSeven[Player],2);
  293.         TextDrawLetterSize(ServerTextDrawSeven[Player],0.200000,1.000000);
  294.         TextDrawColor(ServerTextDrawSeven[Player],-1);
  295.         TextDrawSetOutline(ServerTextDrawSeven[Player],1);
  296.         TextDrawSetProportional(ServerTextDrawSeven[Player],1);
  297.         ServerTextDrawEight[Player] = TextDrawCreate(490.000000,430.000000," ");
  298.         TextDrawBackgroundColor(ServerTextDrawEight[Player],255);
  299.         TextDrawFont(ServerTextDrawEight[Player],2);
  300.         TextDrawLetterSize(ServerTextDrawEight[Player],0.200000,1.000000);
  301.         TextDrawColor(ServerTextDrawEight[Player],-1);
  302.         TextDrawSetOutline(ServerTextDrawEight[Player],1);
  303.         TextDrawSetProportional(ServerTextDrawEight[Player],1);
  304.     }
  305.     ServerTimerOne = SetTimer("PlayerUpdate",1000,1);
  306.     return 1;
  307. }
  308.  
  309. public OnFilterScriptExit()
  310. {
  311.     TextDrawDestroy(ServerTextDrawOne);
  312.     TextDrawDestroy(ServerTextDrawTwo);
  313.     for(new Player; Player < GetMaxPlayers(); Player++)
  314.     {
  315.         TextDrawDestroy(ServerTextDrawThree[Player]);
  316.         TextDrawDestroy(ServerTextDrawFour[Player]);
  317.         TextDrawDestroy(ServerTextDrawFive[Player]);
  318.         TextDrawDestroy(ServerTextDrawSix[Player]);
  319.         TextDrawDestroy(ServerTextDrawSeven[Player]);
  320.         TextDrawDestroy(ServerTextDrawEight[Player]);
  321.     }
  322.     KillTimer(ServerTimerOne);
  323.     return 1;
  324. }
  325.  
  326. public OnPlayerConnect(playerid)
  327. {
  328.     TextDrawHideForPlayer(playerid,ServerTextDrawOne);
  329.     TextDrawHideForPlayer(playerid,ServerTextDrawTwo);
  330.     TextDrawHideForPlayer(playerid,ServerTextDrawThree[playerid]);
  331.     TextDrawHideForPlayer(playerid,ServerTextDrawFour[playerid]);
  332.     TextDrawHideForPlayer(playerid,ServerTextDrawFive[playerid]);
  333.     TextDrawHideForPlayer(playerid,ServerTextDrawSix[playerid]);
  334.     TextDrawHideForPlayer(playerid,ServerTextDrawSeven[playerid]);
  335.     TextDrawHideForPlayer(playerid,ServerTextDrawEight[playerid]);
  336.     TextDrawSetString(ServerTextDrawThree[playerid]," ");
  337.     TextDrawSetString(ServerTextDrawFour[playerid]," ");
  338.     TextDrawSetString(ServerTextDrawFive[playerid]," ");
  339.     TextDrawSetString(ServerTextDrawSix[playerid]," ");
  340.     TextDrawSetString(ServerTextDrawSeven[playerid]," ");
  341.     TextDrawSetString(ServerTextDrawEight[playerid]," ");
  342.     return 1;
  343. }
  344.  
  345. public OnPlayerDisconnect(playerid,reason)
  346. {
  347.     TextDrawHideForPlayer(playerid,ServerTextDrawOne);
  348.     TextDrawHideForPlayer(playerid,ServerTextDrawTwo);
  349.     TextDrawHideForPlayer(playerid,ServerTextDrawThree[playerid]);
  350.     TextDrawHideForPlayer(playerid,ServerTextDrawFour[playerid]);
  351.     TextDrawHideForPlayer(playerid,ServerTextDrawFive[playerid]);
  352.     TextDrawHideForPlayer(playerid,ServerTextDrawSix[playerid]);
  353.     TextDrawHideForPlayer(playerid,ServerTextDrawSeven[playerid]);
  354.     TextDrawHideForPlayer(playerid,ServerTextDrawEight[playerid]);
  355.     TextDrawSetString(ServerTextDrawThree[playerid]," ");
  356.     TextDrawSetString(ServerTextDrawFour[playerid]," ");
  357.     TextDrawSetString(ServerTextDrawFive[playerid]," ");
  358.     TextDrawSetString(ServerTextDrawSix[playerid]," ");
  359.     TextDrawSetString(ServerTextDrawSeven[playerid]," ");
  360.     TextDrawSetString(ServerTextDrawEight[playerid]," ");
  361.     return 1;
  362. }
  363.  
  364. public OnPlayerStateChange(playerid,newstate,oldstate)
  365. {
  366.     if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
  367.     {
  368.         TextDrawShowForPlayer(playerid,ServerTextDrawOne);
  369.         TextDrawShowForPlayer(playerid,ServerTextDrawTwo);
  370.         TextDrawShowForPlayer(playerid,ServerTextDrawThree[playerid]);
  371.         TextDrawShowForPlayer(playerid,ServerTextDrawFour[playerid]);
  372.         TextDrawShowForPlayer(playerid,ServerTextDrawFive[playerid]);
  373.         TextDrawShowForPlayer(playerid,ServerTextDrawSix[playerid]);
  374.         TextDrawShowForPlayer(playerid,ServerTextDrawSeven[playerid]);
  375.         TextDrawShowForPlayer(playerid,ServerTextDrawEight[playerid]);
  376.         TextDrawSetString(ServerTextDrawThree[playerid]," ");
  377.         TextDrawSetString(ServerTextDrawFour[playerid]," ");
  378.         TextDrawSetString(ServerTextDrawFive[playerid]," ");
  379.         TextDrawSetString(ServerTextDrawSix[playerid]," ");
  380.         TextDrawSetString(ServerTextDrawSeven[playerid]," ");
  381.         TextDrawSetString(ServerTextDrawEight[playerid]," ");
  382.     }
  383.     if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
  384.     {
  385.         TextDrawHideForPlayer(playerid,ServerTextDrawOne);
  386.         TextDrawHideForPlayer(playerid,ServerTextDrawTwo);
  387.         TextDrawHideForPlayer(playerid,ServerTextDrawThree[playerid]);
  388.         TextDrawHideForPlayer(playerid,ServerTextDrawFour[playerid]);
  389.         TextDrawHideForPlayer(playerid,ServerTextDrawFive[playerid]);
  390.         TextDrawHideForPlayer(playerid,ServerTextDrawSix[playerid]);
  391.         TextDrawHideForPlayer(playerid,ServerTextDrawSeven[playerid]);
  392.         TextDrawHideForPlayer(playerid,ServerTextDrawEight[playerid]);
  393.         TextDrawSetString(ServerTextDrawThree[playerid]," ");
  394.         TextDrawSetString(ServerTextDrawFour[playerid]," ");
  395.         TextDrawSetString(ServerTextDrawFive[playerid]," ");
  396.         TextDrawSetString(ServerTextDrawSix[playerid]," ");
  397.         TextDrawSetString(ServerTextDrawSeven[playerid]," ");
  398.         TextDrawSetString(ServerTextDrawEight[playerid]," ");
  399.     }
  400.     return 1;
  401. }
  402.  
  403. public PlayerUpdate()
  404. {
  405.     for(new Player; Player < GetMaxPlayers(); Player++)
  406.     {
  407.         if(IsPlayerConnected(Player) && IsPlayerInAnyVehicle(Player))
  408.         {
  409.             new String[100];
  410.             format(String,sizeof(String),"~G~~H~Model Pojazdu: ~W~~H~%d",GetVehicleModel(GetPlayerVehicleID(Player)));
  411.             TextDrawSetString(ServerTextDrawThree[Player],String);
  412.             format(String,sizeof(String),"~G~~H~Nazwa Pojazdu: ~W~~H~%s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(Player)) - 400]);
  413.             TextDrawSetString(ServerTextDrawFour[Player],String);
  414.             new Float:Health;
  415.             GetVehicleHealth(GetPlayerVehicleID(Player),Health);
  416.             if(Health < 0.0) Health = 0.0;
  417.             if(Health > 1000.0) Health = 1000.0;
  418.             format(String,sizeof(String),"~G~~H~Stan Pojazdu: ~W~~H~%d %",floatround(Health / 10));
  419.             TextDrawSetString(ServerTextDrawFive[Player],String);
  420.             format(String,sizeof(String),"~G~~H~Predkosc Pojazdu: ~W~~H~%d KM/H",VehicleSpeed(GetPlayerVehicleID(Player)));
  421.             TextDrawSetString(ServerTextDrawSix[Player],String);
  422.             new Float:X;
  423.             new Float:Y;
  424.             new Float:Z;
  425.             GetVehiclePos(GetPlayerVehicleID(Player),X,Y,Z);
  426.             format(String,sizeof(String),"~G~~H~Wysokosc: ~W~~H~%d Metrow",floatround(Z));
  427.             TextDrawSetString(ServerTextDrawSeven[Player],String);
  428.             new Engine;
  429.             new Lights;
  430.             new Alarm;
  431.             new Doors;
  432.             new Bonnet;
  433.             new Boot;
  434.             new Objective;
  435.             GetVehicleParamsEx(GetPlayerVehicleID(Player),Engine,Lights,Alarm,Doors,Bonnet,Boot,Objective);
  436.             format(String,sizeof(String),"~G~~H~Zamkniety: ~W~~H~%s",(Doors == 1) ? ("Tak") : ("Nie"));
  437.             TextDrawSetString(ServerTextDrawEight[Player],String);
  438.         }
  439.     }
  440.     return 1;
  441. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement