Advertisement
Guest User

[FS]Radar

a guest
Oct 10th, 2016
571
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.68 KB | None | 0 0
  1. //www.sampextremeoficial.blogspot.com
  2. #include <a_samp>
  3. //----------------------------------------
  4. new UpdateSeconds = 2; // Não Mecher
  5. new maxobject = 4;//Altere se for colocar mais Lugares ( 4 = DP PREF BANCO E HOSPITAL )
  6. //----------------------------------------
  7.  
  8. public OnFilterScriptInit() {
  9. print("\n----------------------------------");
  10. print("[FS] Radar Automatico Carregado");
  11. print("----------------------------------\n");
  12. SetTimer("UpdateSpeed", UpdateSeconds*1000, 1);
  13. }
  14.  
  15. public OnFilterScriptExit() {
  16. print("\n----------------------------------");
  17. print("[FS] Radar Automatico Desativado");
  18. print("----------------------------------\n");
  19. }
  20. forward UpdateSpeed(playerid);
  21. enum SavePlayerPosEnum {
  22. Float:LastX,
  23. Float:LastY,
  24. Float:LastZ
  25. }
  26. #define COLOR_YELLOW 0xFFFF00AA
  27. #define VERDEFRACO 0x80cf80AA
  28. #define SLOTS 500
  29.  
  30. new objectcreated;
  31. new SavePlayerPos[SLOTS][SavePlayerPosEnum];
  32. new distance1[MAX_PLAYERS];
  33.  
  34.  
  35. public UpdateSpeed(playerid)
  36. {
  37. new Float:x,Float:y,Float:z;
  38. new Float:distance,value;
  39. for(new i=0; i<SLOTS; i++)
  40. {
  41. if(IsPlayerConnected(i))
  42. {
  43. GetPlayerPos(i, x, y, z);
  44. distance = floatsqroot(floatpower(floatabs(floatsub(x,SavePlayerPos[i][LastX])),2)+floatpower(floatabs(floatsub(y,SavePlayerPos[i][LastY])),2)+floatpower(floatabs(floatsub(z,SavePlayerPos[i][LastZ])),2));
  45. value = floatround(distance * 3600);
  46. if(UpdateSeconds > 1)
  47. {
  48. value = floatround(value / UpdateSeconds);
  49. }
  50. distance1[i] = floatround(value/1600);
  51.  
  52. SavePlayerPos[i][LastX] = x;
  53. SavePlayerPos[i][LastY] = y;
  54. SavePlayerPos[i][LastZ] = z;
  55. /* Para colocar Coordenada no lugar que voce quer , basta colocar a Coordenada X,Y,Z no lugar dos 00000 ,
  56. o 40 é o raio que o radar pega, e o 50 , é a velocidade maxima*/
  57. AddFlitsPaal(i, 1278, 1476.2402,-1726.3396,13.5469, 40, 50); // Radar da DP PM
  58. AddFlitsPaal(i, 1278, 1524.1256,-1679.0756,13.5469, 40, 50); // Prefeitura
  59. AddFlitsPaal(i, 1278, 2048.7131,1353.5975,10.6719, 40, 50); // BANCO
  60. AddFlitsPaal(i, 1278, 1200.9847,-1337.9875,13.3984, 40, 45); // HOSPITAL
  61. AddFlitsPaal(i, 1278, 0000.0000,0000.0000,0000.0000, 50, 70); // VAGO
  62. AddFlitsPaal(i, 1278, 0000.0000,0000.0000,0000.0000, 20, 50); // VAGO
  63. AddFlitsPaal(i, 1278, 0000.0000,0000.0000,0000.0000, 20, 50); // VAGO
  64. AddFlitsPaal(i, 1278, 0000.0000,0000.0000,0000.0000, 20, 50); // VAGO
  65. AddFlitsPaal(i, 1278, 0000.0000,0000.0000,0000.0000, 20, 50); // VAGO
  66. AddFlitsPaal(i, 1278, 0000.0000,0000.0000,0000.0000, 20, 50); // VAGO
  67. }
  68. }
  69. }
  70.  
  71. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  72. {
  73. return 1;
  74. }
  75.  
  76.  
  77. public OnPlayerExitVehicle(playerid, vehicleid)
  78. {
  79. return 1;
  80. }
  81.  
  82. IsPlayerInCircle(playerid,Float:x,Float:y,radius)
  83. {
  84. if(GetPlayerDistanceToPoint(playerid,Float:x,Float:y) < radius)
  85. {
  86. return 1;
  87. }
  88. return 0;
  89. }
  90.  
  91. GetPlayerDistanceToPoint(playerid,Float:x,Float:y)
  92. {
  93. new Float:x1,Float:y1,Float:z1; GetPlayerPos(playerid,x1,y1,z1);
  94. new Float:tmpdis = floatsqroot(floatpower(floatabs(floatsub(x,x1)),2)+
  95. floatpower(floatabs(floatsub(y,y1)),2));
  96. return floatround(tmpdis);
  97. }
  98.  
  99. stock AddFlitsPaal(playerid, modelid, Float:xx, Float:yy, Float:zz, radius, speed)
  100. {
  101. new fine[MAX_PLAYERS];
  102. new str[256];
  103.  
  104. if(objectcreated!=maxobject)
  105. {
  106. CreateObject(modelid, xx, yy, zz, 0.0, 0.0, 10);
  107. objectcreated++;
  108. }
  109. if((distance1[playerid])>speed)
  110. {
  111. if(IsPlayerInCircle(playerid, xx, yy, radius) && GetPlayerState(playerid)== PLAYER_STATE_DRIVER)
  112. {
  113. fine[playerid]=((distance1[playerid]*17/10)-speed);
  114. GivePlayerMoney(playerid, -2000);
  115. format(str,sizeof(str), "[RADAR xXX ] O Limite de velocidade é %d KM/H Voce Passou a %d KM/H e foi multado!",speed, distance1[playerid] ,fine[playerid]);
  116. // Caso queira mudar o nome do radar , é so mudar o xXx pelo nome que quiser. e o -2000 é o valor da multa.
  117. SendClientMessage(playerid, VERDEFRACO, str);
  118. PlayerPlaySound(playerid, 1132, 0.0, 0.0, 0.0);
  119. }
  120. }
  121. }
  122. public OnPlayerCommandText(playerid, cmdtext[])
  123. if (strcmp("/sradar", cmdtext, true, 10) == 0)
  124. {
  125. SendClientMessage(playerid,0x33CCFFAA,"******* SISTEMA DE RADAR ************");
  126. SendClientMessage(playerid,0x33CCFFAA,"Existem Radar na Prefeitura, No Hospital e no DP's de Los Santos e Banco");
  127. SendClientMessage(playerid,0x33CCFFAA,"O Limite de velocidade é entre 50 KM/H");
  128. SendClientMessage(playerid,0x33CCFFAA,"Se você exceder o Limite de velocidade Nesses Locais , Levara Multa de 2000 $ ");
  129. SendClientMessage(playerid,0xAA3333AA,"Atenciosamente , A administração.");
  130. return 1;
  131. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement