Advertisement
Guest User

Untitled

a guest
Feb 16th, 2010
6,296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.51 KB | None | 0 0
  1. #include <a_samp>
  2. enum td
  3. {
  4.     Text:TDSpeedClock[15]
  5. }
  6.  
  7. new TextDraws[td];
  8. new Text:TextDrawsd[MAX_PLAYERS][4];
  9.  
  10. public OnFilterScriptInit()
  11. {
  12.     print("Kolowy licznik predkosci zaladowany");
  13.    
  14.     TextDraws[TDSpeedClock][0] = TextDrawCreate(496.000000,400.000000,"~g~20");
  15.     TextDraws[TDSpeedClock][1] = TextDrawCreate(487.000000,388.000000,"~g~40");
  16.     TextDraws[TDSpeedClock][2] = TextDrawCreate(483.000000,375.000000,"~g~60");
  17.     TextDraws[TDSpeedClock][3] = TextDrawCreate(488.000000,362.000000,"~g~80");
  18.     TextDraws[TDSpeedClock][4] = TextDrawCreate(491.000000,349.000000,"~g~100");
  19.     TextDraws[TDSpeedClock][5] = TextDrawCreate(508.000000,336.500000,"~g~120");
  20.     TextDraws[TDSpeedClock][6] = TextDrawCreate(536.000000,332.000000,"~g~140");
  21.     TextDraws[TDSpeedClock][7] = TextDrawCreate(567.000000,337.000000,"~g~160");
  22.     TextDraws[TDSpeedClock][8] = TextDrawCreate(584.000000,348.000000,"~g~180");
  23.     TextDraws[TDSpeedClock][9] = TextDrawCreate(595.000000,360.000000,"~g~200");
  24.     TextDraws[TDSpeedClock][10] = TextDrawCreate(603.000000,374.000000,"~g~220");
  25.     TextDraws[TDSpeedClock][11] = TextDrawCreate(594.000000,386.000000,"~g~240");
  26.     TextDraws[TDSpeedClock][14] = TextDrawCreate(585.000000,399.000000,"~g~260");
  27.     TextDraws[TDSpeedClock][12] = TextDrawCreate(534.000000,396.000000,"~r~/ \\");
  28.     TextDrawLetterSize(TextDraws[TDSpeedClock][12], 1.059999, 2.100000);
  29.     TextDraws[TDSpeedClock][13] = TextDrawCreate(548.000000,401.000000,".");
  30.     TextDrawLetterSize(TextDraws[TDSpeedClock][13], 0.73, -2.60);
  31.     TextDrawSetOutline(TextDraws[TDSpeedClock][13], 0);
  32.     TextDrawSetShadow(TextDraws[TDSpeedClock][13], 1);
  33.     TextDrawSetShadow(TextDraws[TDSpeedClock][14], 0);
  34.     for(new i; i < 13; i++)
  35.         TextDrawSetShadow(TextDraws[TDSpeedClock][i], 0);
  36.  
  37.    
  38.     return 1;
  39. }
  40.  
  41. public OnFilterScriptExit()
  42. {
  43.     print("Kolowy licznik predkosci odlaczony");
  44.    
  45.     return 1;
  46. }
  47.  
  48. public OnPlayerStateChange(playerid, newstate, oldstate)
  49. {
  50.     if(newstate == PLAYER_STATE_DRIVER)
  51.     {
  52.         for(new i; i < 15; i++)
  53.             TextDrawShowForPlayer(playerid, TextDraws[TDSpeedClock][i]);
  54.            
  55.         for(new i; i < 4; i++)
  56.             TextDrawsd[playerid][i] = TextDrawCreate(555.0, 402.0, "~b~.");
  57.  
  58.     }
  59.     else
  60.     {
  61.         for(new i; i < 4; i++)
  62.             TextDrawHideForPlayer(playerid, TextDrawsd[playerid][i]);
  63.         for(new i; i < 15; i++)
  64.             TextDrawHideForPlayer(playerid, TextDraws[TDSpeedClock][i]);
  65.     }
  66.    
  67.     return 1;
  68. }
  69.  
  70. public OnPlayerUpdate(playerid)
  71. {
  72.     new
  73.         Float:fPos[3],
  74.         Float:Pos[4][2],
  75.         Float:fSpeed;
  76.        
  77.     if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  78.     {
  79.         GetVehicleVelocity(GetPlayerVehicleID(playerid), fPos[0], fPos[1], fPos[2]);
  80.  
  81.         fSpeed = floatsqroot(floatpower(fPos[0], 2) + floatpower(fPos[1], 2) +
  82.          floatpower(fPos[2], 2)) * 200;
  83.        
  84.         new Float:alpha = 320 - fSpeed;
  85.  
  86.         for(new i; i < 4; i++)
  87.         {
  88.             TextDrawHideForPlayer(playerid, TextDrawsd[playerid][i]);
  89.             TextDrawDestroy(TextDrawsd[playerid][i]);
  90.             GetDotXY(548, 401, Pos[i][0], Pos[i][1], alpha, (i + 1) * 8);
  91.             TextDrawsd[playerid][i] = TextDrawCreate(Pos[i][0], Pos[i][1], "~b~.");
  92.             TextDrawLetterSize(TextDrawsd[playerid][i], 0.73, -2.60);
  93.             TextDrawSetOutline(TextDrawsd[playerid][i], 0);
  94.             TextDrawSetShadow(TextDrawsd[playerid][i], 1);
  95.             TextDrawShowForPlayer(playerid, TextDrawsd[playerid][i]);
  96.         }
  97.     }
  98.    
  99.    
  100.     return 1;
  101. }
  102.  
  103. stock GetDotXY(Float:StartPosX, Float:StartPosY, &Float:NewX, &Float:NewY, Float:alpha, Float:dist)
  104. {
  105.      NewX = StartPosX + (dist * floatsin(alpha, degrees));
  106.      NewY = StartPosY + (dist * floatcos(alpha, degrees));
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement