Guest User

s

a guest
May 4th, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.66 KB | None | 0 0
  1. // By GROVE4L
  2. // Edited by Williams
  3.  
  4. #include <a_samp>
  5. #define FILTERSCRIPT
  6.  
  7. #define COLOR 0xC2A2DAAA
  8.  
  9. forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
  10. forward Velocidad(playerid);
  11. forward Check(playerid);
  12. forward Rojo(playerid);
  13. forward Camara(playerid);
  14.  
  15. new Timer[MAX_PLAYERS];
  16. new TRojo[MAX_PLAYERS];
  17. new TCamara[MAX_PLAYERS];
  18. new Choque[MAX_PLAYERS];
  19. new Si[MAX_PLAYERS];
  20. new Text: FlashR;
  21. enum Info
  22. {
  23. Manejando,
  24. };
  25. new Informacion[MAX_PLAYERS][Info];
  26.  
  27. public OnPlayerSpawn(playerid)
  28. {
  29. FlashR = TextDrawCreate(1.000000,1.000000,"_");
  30. TextDrawTextSize(FlashR,640.000000,10.000000);
  31. TextDrawLetterSize(FlashR,3.600000,47.600010);
  32. TextDrawUseBox(FlashR,1);
  33. TextDrawAlignment(FlashR,0);
  34. TextDrawFont(FlashR,3);
  35. TextDrawSetOutline(FlashR,1);
  36. TextDrawSetProportional(FlashR,1);
  37. TextDrawSetShadow(FlashR,1);
  38. TextDrawBackgroundColor(FlashR,0xD20000FF);
  39. TextDrawColor(FlashR,0xD20000FF);
  40. TextDrawBoxColor(FlashR,0xD20000FF);
  41. Timer[playerid] = SetTimerEx("Check", 100, 1, "i", playerid);
  42. Informacion[playerid][Manejando] = 0;
  43. }
  44.  
  45. public OnPlayerDisconnect(playerid)
  46. {
  47. KillTimer(Timer[playerid]);
  48. KillTimer(Choque[playerid]);
  49. Informacion[playerid][Manejando] = 0;
  50. return 1;
  51. }
  52.  
  53. public Velocidad(playerid)
  54. {
  55. new Float:Vx, Float:Vy, Float:Vz;
  56. if(IsPlayerInAnyVehicle(playerid) && Informacion[playerid][Manejando])
  57. {
  58. GetVehicleVelocity(GetPlayerVehicleID(playerid), Vx, Vy, Vz);
  59. if(Vx > -0.1 && Vx < 0.1 && Vy > -0.1 && Vy < 0.1)
  60. {
  61. new Float:Vida;
  62. GetPlayerHealth(playerid, Vida);
  63. SetPlayerHealth(playerid, Vida-11.0);
  64. SetPlayerDrunkLevel(playerid, 500000);
  65. TextDrawShowForPlayer(playerid, FlashR);
  66. Informacion[playerid][Manejando] = 0;
  67. new String[256];
  68. new Nombre[MAX_PLAYER_NAME];
  69. GetPlayerName(playerid,Nombre,sizeof(Nombre));
  70. format(String, sizeof(String), "* Airbag se aktivirao (( %s ))", Nombre);
  71. ProxDetector(30.0, playerid, String, COLOR,COLOR,COLOR,COLOR,COLOR);
  72. TRojo[playerid] = SetTimerEx("Rojo", 250, 1, "i", playerid);
  73. TCamara[playerid] = SetTimerEx("Camara", 10000, 1, "i", playerid);
  74. }
  75. }
  76. return 1;
  77. }
  78.  
  79. public Rojo(playerid)
  80. {
  81. TextDrawHideForPlayer(playerid, FlashR);
  82. return 1;
  83. }
  84.  
  85. public Camara(playerid)
  86. {
  87. KillTimer(TCamara[playerid]);
  88. SetPlayerDrunkLevel(playerid, 0);
  89. return 1;
  90. }
  91.  
  92. public Check(playerid)
  93. {
  94. new Float:Cx, Float:Cy, Float:Cz;
  95. if(IsPlayerInAnyVehicle(playerid))
  96. {
  97. GetVehicleVelocity(GetPlayerVehicleID(playerid), Cx, Cy, Cz);
  98. if(Cx < -0.4 || Cx > 0.4 || Cy < -0.4 || Cy > 0.4 && !Informacion[playerid][Manejando])
  99. {
  100. Choque[playerid] = SetTimerEx("Velocidad", 100, 1, "i", playerid);
  101. Informacion[playerid][Manejando] = 1;
  102. }
  103. else
  104. {
  105. KillTimer(Choque[playerid]);
  106. Informacion[playerid][Manejando] = 0;
  107. }
  108. }
  109. return 1;
  110. }
  111.  
  112.  
  113. public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  114. {
  115. if(IsPlayerConnected(playerid))
  116. {
  117. new Float:posx, Float:posy, Float:posz;
  118. new Float:oldposx, Float:oldposy, Float:oldposz;
  119. new Float:tempposx, Float:tempposy, Float:tempposz;
  120. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  121. for(new i = 0; i < MAX_PLAYERS; i++)
  122. {
  123. if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
  124. {
  125. if(!Si[i])
  126. {
  127. GetPlayerPos(i, posx, posy, posz);
  128. tempposx = (oldposx -posx);
  129. tempposy = (oldposy -posy);
  130. tempposz = (oldposz -posz);
  131. if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
  132. {
  133. SendClientMessage(i, col1, string);
  134. }
  135. else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  136. {
  137. SendClientMessage(i, col2, string);
  138. }
  139. else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  140. {
  141. SendClientMessage(i, col3, string);
  142. }
  143. else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  144. {
  145. SendClientMessage(i, col4, string);
  146. }
  147. else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  148. {
  149. SendClientMessage(i, col5, string);
  150. }
  151. }
  152. else
  153. {
  154. SendClientMessage(i, col1, string);
  155. }
  156. }
  157. }
  158. }
  159. return 1;
  160. }
  161.  
  162. // By GROVE4L
Advertisement
Add Comment
Please, Sign In to add comment