Guest User

Untitled

a guest
Nov 7th, 2014
1,199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 9.18 KB | None | 0 0
  1. /*
  2.  
  3.     Data utworzenia skryptu: 26.07.2014
  4.     Data zakończenia skryptu: 26.07.2014 2godz. później
  5.    
  6.     Autor: ReveresPL
  7.    
  8.     Opis: Skrypt dodaje do gry okrągły licznik.
  9.    
  10.     Zakaz zmiany autora ! i wstawiania tego skryptu na inne fora niż (pawno.pl) bez zgody autora !!! ReveresPL
  11. */
  12.  
  13. #define FILTERSCRIPT
  14.  
  15. #include <a_samp>
  16.  
  17. #undef MAX_PLAYERS
  18. #define MAX_PLAYERS     5
  19.  
  20. #define FRESH_TIMER     250     //Czas w ms. odświeżania licznika (nie zaleca się dawać mniejszych wartości niż 250)
  21.  
  22. //
  23. new Text:Box1;
  24. new Text:Box2;
  25. new Text:s0;
  26. new Text:s1;
  27. new Text:s2;
  28. new Text:s3;
  29. new Text:s4;
  30. new Text:s5;
  31. new Text:s6;
  32. new Text:s7;
  33. new Text:s8;
  34. new Text:s9;
  35. new Text:s10;
  36. new Text:s11;
  37. new Text:wsk[MAX_PLAYERS];
  38. //
  39.  
  40. new speed[MAX_PLAYERS];
  41. new act_speed[MAX_PLAYERS];
  42. new licznik[MAX_PLAYERS];
  43.  
  44. public OnFilterScriptInit()
  45. {
  46.     print("\n--------------------------------------");
  47.     print(" Circle Speedometr .... by ReveresPL");
  48.     print("--------------------------------------\n");
  49.     //
  50.     LoadTD();
  51.     print(" ***Skrypt załadowany ***");
  52.     return 1;
  53. }
  54.  
  55. public OnFilterScriptExit()
  56. {
  57.     UnloadTD();
  58.     return 1;
  59. }
  60.  
  61. public OnPlayerConnect(playerid)
  62. {
  63.     return 1;
  64. }
  65.  
  66. public OnPlayerDisconnect(playerid, reason)
  67. {
  68.     if(licznik[playerid])
  69.     {
  70.         licznik[playerid]=false;
  71.         HideTD(playerid);
  72.         KillTimer(speed[playerid]);
  73.     }
  74.     return 1;
  75. }
  76.  
  77. public OnPlayerStateChange(playerid, newstate, oldstate)
  78. {
  79.     if(newstate == PLAYER_STATE_DRIVER)
  80.     {
  81.         licznik[playerid]=true;
  82.         ShowTD(playerid);
  83.         speed[playerid] = SetTimerEx("Speedometr", FRESH_TIMER, true, "i", playerid);
  84.     }
  85.     if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER)
  86.     {
  87.         licznik[playerid]=false;
  88.         HideTD(playerid);
  89.         KillTimer(speed[playerid]);
  90.     }
  91.     return 1;
  92. }
  93.  
  94. stock LoadTD()
  95. {
  96.     Box1 = TextDrawCreate(506.799926, 271.096191, "LD_POOL:ball");
  97.     TextDrawLetterSize(Box1, 0.000000, 0.000000);
  98.     TextDrawTextSize(Box1, 120.399993, 94.583976);
  99.     TextDrawAlignment(Box1, 1);
  100.     TextDrawColor(Box1, 255);
  101.     TextDrawSetShadow(Box1, 0);
  102.     TextDrawSetOutline(Box1, 0);
  103.     TextDrawFont(Box1, 4);
  104.     TextDrawSetPreviewModel(Box1, 19348);
  105.     TextDrawSetPreviewRot(Box1, 0.000000, 90.000000, 0.000000, 1.000000);
  106.  
  107.     Box2 = TextDrawCreate(509.049926, 272.832000, "LD_POOL:ball");
  108.     TextDrawLetterSize(Box2, 0.000000, 0.000000);
  109.     TextDrawTextSize(Box2, 116.350006, 90.775962);
  110.     TextDrawAlignment(Box2, 1);
  111.     TextDrawColor(Box2, -1);
  112.     TextDrawSetShadow(Box2, 0);
  113.     TextDrawSetOutline(Box2, 0);
  114.     TextDrawFont(Box2, 4);
  115.  
  116.     s0 = TextDrawCreate(526.500000, 333.199951, "0");
  117.     TextDrawLetterSize(s0, 0.250050, 1.300400);
  118.     TextDrawAlignment(s0, 1);
  119.     TextDrawColor(s0, -16776961);
  120.     TextDrawSetShadow(s0, 0);
  121.     TextDrawSetOutline(s0, 0);
  122.     TextDrawBackgroundColor(s0, 255);
  123.     TextDrawFont(s0, 2);
  124.     TextDrawSetProportional(s0, 1);
  125.  
  126.     s1 = TextDrawCreate(515.500000, 321.999877, "20");
  127.     TextDrawLetterSize(s1, 0.250399, 1.300401);
  128.     TextDrawAlignment(s1, 1);
  129.     TextDrawColor(s1, -16776961);
  130.     TextDrawSetShadow(s1, 0);
  131.     TextDrawSetOutline(s1, 0);
  132.     TextDrawBackgroundColor(s1, 255);
  133.     TextDrawFont(s1, 2);
  134.     TextDrawSetProportional(s1, 1);
  135.  
  136.     s2 = TextDrawCreate(513.500000, 308.559906, "40");
  137.     TextDrawLetterSize(s2, 0.250500, 1.300960);
  138.     TextDrawAlignment(s2, 1);
  139.     TextDrawColor(s2, -16776961);
  140.     TextDrawSetShadow(s2, 0);
  141.     TextDrawSetOutline(s2, 0);
  142.     TextDrawBackgroundColor(s2, 255);
  143.     TextDrawFont(s2, 2);
  144.     TextDrawSetProportional(s2, 1);
  145.  
  146.     s3 = TextDrawCreate(518.099853, 292.879791, "60");
  147.     TextDrawLetterSize(s3, 0.250000, 1.300400);
  148.     TextDrawAlignment(s3, 1);
  149.     TextDrawColor(s3, -16776961);
  150.     TextDrawSetShadow(s3, 0);
  151.     TextDrawSetOutline(s3, 0);
  152.     TextDrawBackgroundColor(s3, 255);
  153.     TextDrawFont(s3, 2);
  154.     TextDrawSetProportional(s3, 1);
  155.  
  156.     s4 = TextDrawCreate(530.500000, 281.679962, "80");
  157.     TextDrawLetterSize(s4, 0.250999, 1.300960);
  158.     TextDrawAlignment(s4, 1);
  159.     TextDrawColor(s4, -16776961);
  160.     TextDrawSetShadow(s4, 0);
  161.     TextDrawSetOutline(s4, 0);
  162.     TextDrawBackgroundColor(s4, 255);
  163.     TextDrawFont(s4, 2);
  164.     TextDrawSetProportional(s4, 1);
  165.  
  166.     s5 = TextDrawCreate(545.500000, 274.959960, "100");
  167.     TextDrawLetterSize(s5, 0.250499, 1.300400);
  168.     TextDrawAlignment(s5, 1);
  169.     TextDrawColor(s5, -16776961);
  170.     TextDrawSetShadow(s5, 0);
  171.     TextDrawSetOutline(s5, 0);
  172.     TextDrawBackgroundColor(s5, 255);
  173.     TextDrawFont(s5, 2);
  174.     TextDrawSetProportional(s5, 1);
  175.  
  176.     s6 = TextDrawCreate(568.400085, 274.959960, "120");
  177.     TextDrawLetterSize(s6, 0.250500, 1.300400);
  178.     TextDrawAlignment(s6, 1);
  179.     TextDrawColor(s6, -16776961);
  180.     TextDrawSetShadow(s6, 0);
  181.     TextDrawSetOutline(s6, 0);
  182.     TextDrawFont(s6, 2);
  183.     TextDrawBackgroundColor(s6, 255);
  184.     TextDrawSetProportional(s6, 1);
  185.  
  186.     s7 = TextDrawCreate(587.000000, 281.679931, "140");
  187.     TextDrawLetterSize(s7, 0.250999, 1.300400);
  188.     TextDrawAlignment(s7, 1);
  189.     TextDrawColor(s7, -16776961);
  190.     TextDrawSetShadow(s7, 0);
  191.     TextDrawSetOutline(s7, 0);
  192.     TextDrawBackgroundColor(s7, 255);
  193.     TextDrawFont(s7, 2);
  194.     TextDrawSetProportional(s7, 1);
  195.  
  196.     s8 = TextDrawCreate(597.500000, 292.880004, "160");
  197.     TextDrawLetterSize(s8, 0.250499, 1.300959);
  198.     TextDrawAlignment(s8, 1);
  199.     TextDrawColor(s8, -16776961);
  200.     TextDrawSetShadow(s8, 0);
  201.     TextDrawSetOutline(s8, 0);
  202.     TextDrawBackgroundColor(s8, 255);
  203.     TextDrawFont(s8, 2);
  204.     TextDrawSetProportional(s8, 1);
  205.  
  206.     s9 = TextDrawCreate(601.500000, 308.000061, "180");
  207.     TextDrawLetterSize(s9, 0.250999, 1.300959);
  208.     TextDrawAlignment(s9, 1);
  209.     TextDrawColor(s9, -16776961);
  210.     TextDrawSetShadow(s9, 0);
  211.     TextDrawSetOutline(s9, 0);
  212.     TextDrawBackgroundColor(s9, 255);
  213.     TextDrawFont(s9, 2);
  214.     TextDrawSetProportional(s9, 1);
  215.  
  216.     s10 = TextDrawCreate(600.500000, 321.439941, "200");
  217.     TextDrawLetterSize(s10, 0.250500, 1.300960);
  218.     TextDrawAlignment(s10, 1);
  219.     TextDrawColor(s10, -16776961);
  220.     TextDrawSetShadow(s10, 0);
  221.     TextDrawSetOutline(s10, 0);
  222.     TextDrawBackgroundColor(s10, 255);
  223.     TextDrawFont(s10, 2);
  224.     TextDrawSetProportional(s10, 1);
  225.  
  226.     s11 = TextDrawCreate(594.000000, 331.519836, "220");
  227.     TextDrawLetterSize(s11, 0.250500, 1.300400);
  228.     TextDrawAlignment(s11, 1);
  229.     TextDrawColor(s11, -16776961);
  230.     TextDrawSetShadow(s11, 0);
  231.     TextDrawSetOutline(s11, 0);
  232.     TextDrawBackgroundColor(s11, 255);
  233.     TextDrawFont(s11, 2);
  234.     TextDrawSetProportional(s11, 1);
  235.    
  236.     for(new i=0; i<MAX_PLAYERS; i++)
  237.     {
  238.         wsk[i] = TextDrawCreate(531.000000, 338.800018, "wsk");
  239.         TextDrawLetterSize(wsk[i], 0.449999, 1.600000);
  240.         TextDrawTextSize(wsk[i], 70.500000, -59.360008);
  241.         TextDrawAlignment(wsk[i], 1);
  242.         TextDrawColor(wsk[i], -1);
  243.         TextDrawUseBox(wsk[i], true);
  244.         TextDrawBoxColor(wsk[i], 0x00000000);
  245.         TextDrawBackgroundColor(wsk[i], 0x00000000);
  246.         TextDrawFont(wsk[i], TEXT_DRAW_FONT_MODEL_PREVIEW);
  247.         TextDrawSetPreviewModel(wsk[i], 19348);
  248.         TextDrawSetPreviewRot(wsk[i], 0.0, 70.0, 0.0, 1.0);
  249.     }
  250. }
  251.  
  252. stock UnloadTD()
  253. {
  254.     TextDrawDestroy(Box1);
  255.     TextDrawDestroy(Box2);
  256.     TextDrawDestroy(s0);
  257.     TextDrawDestroy(s1);
  258.     TextDrawDestroy(s2);
  259.     TextDrawDestroy(s3);
  260.     TextDrawDestroy(s4);
  261.     TextDrawDestroy(s5);
  262.     TextDrawDestroy(s6);
  263.     TextDrawDestroy(s7);
  264.     TextDrawDestroy(s8);
  265.     TextDrawDestroy(s9);
  266.     TextDrawDestroy(s10);
  267.     TextDrawDestroy(s11);
  268.     for(new i=0; i<MAX_PLAYERS; i++)
  269.     {
  270.         TextDrawDestroy(wsk[i]);
  271.     }
  272. }
  273.  
  274. stock ShowTD(playerid)
  275. {
  276.     TextDrawShowForPlayer(playerid, Box1);
  277.     TextDrawShowForPlayer(playerid, Box2);
  278.     TextDrawShowForPlayer(playerid, s0);
  279.     TextDrawShowForPlayer(playerid, s1);
  280.     TextDrawShowForPlayer(playerid, s2);
  281.     TextDrawShowForPlayer(playerid, s3);
  282.     TextDrawShowForPlayer(playerid, s4);
  283.     TextDrawShowForPlayer(playerid, s5);
  284.     TextDrawShowForPlayer(playerid, s6);
  285.     TextDrawShowForPlayer(playerid, s7);
  286.     TextDrawShowForPlayer(playerid, s8);
  287.     TextDrawShowForPlayer(playerid, s9);
  288.     TextDrawShowForPlayer(playerid, s10);
  289.     TextDrawShowForPlayer(playerid, s11);
  290.     TextDrawShowForPlayer(playerid, wsk[playerid]);
  291. }
  292.  
  293. stock HideTD(playerid)
  294. {
  295.     TextDrawHideForPlayer(playerid, Box1);
  296.     TextDrawHideForPlayer(playerid, Box2);
  297.     TextDrawHideForPlayer(playerid, s0);
  298.     TextDrawHideForPlayer(playerid, s1);
  299.     TextDrawHideForPlayer(playerid, s2);
  300.     TextDrawHideForPlayer(playerid, s3);
  301.     TextDrawHideForPlayer(playerid, s4);
  302.     TextDrawHideForPlayer(playerid, s5);
  303.     TextDrawHideForPlayer(playerid, s6);
  304.     TextDrawHideForPlayer(playerid, s7);
  305.     TextDrawHideForPlayer(playerid, s8);
  306.     TextDrawHideForPlayer(playerid, s9);
  307.     TextDrawHideForPlayer(playerid, s10);
  308.     TextDrawHideForPlayer(playerid, s11);
  309.     TextDrawHideForPlayer(playerid, wsk[playerid]);
  310. }
  311.  
  312. forward Speedometr(playerid);
  313. public Speedometr(playerid)
  314. {
  315.     //TextDrawHideForPlayer(playerid, wsk[playerid]);
  316.     act_speed[playerid] = GetVehicleSpeed(GetPlayerVehicleID(playerid));
  317.     if(act_speed[playerid] >= 0){
  318.         TextDrawSetPreviewRot(wsk[playerid], 0, act_speed[playerid]+70, 0, 1);
  319.     }else if(act_speed[playerid] > 220){
  320.         TextDrawSetPreviewRot(wsk[playerid], 0, 300, 0, 1);
  321.     }
  322.     TextDrawShowForPlayer(playerid, wsk[playerid]);
  323.     return 1;
  324. }
  325.  
  326. stock GetVehicleSpeed(vehicleid)
  327. {
  328.     new Float:xyz[3];
  329.     GetVehicleVelocity(vehicleid, xyz[0], xyz[1], xyz[2]);
  330.     return floatround(floatsqroot(floatpower(xyz[0], 2) + floatpower(xyz[1], 2) + floatpower(xyz[2], 2)) * 200);
  331. }
  332.  
  333. //Zakaz zmiany autora ! i wstawiania tego skryptu na inne fora niż (pawno.pl) bez zgody autora !!! ReveresPL
Advertisement
Add Comment
Please, Sign In to add comment