Guest User

Untitled

a guest
Oct 14th, 2012
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.02 KB | None | 0 0
  1. /*================================== FS DE RADAR ====================================
  2. ============================ By: Sivi =============================
  3. =================== Edit. por Sivi ======================
  4. ============ ñ TIRE os CREDTS ==============*/
  5.  
  6. #include <a_samp>
  7.  
  8. //----------------------------------------
  9. new UpdateSeconds = 2; // Não Mecher
  10. new maxobject = 4;
  11. //----------------------------------------
  12.  
  13. new Multas[MAX_PLAYERS];
  14.  
  15. public OnFilterScriptInit()
  16. {
  17. print("\n----------------------------------");
  18. print("[FS] Radar Automatico Carregado");
  19. print("----------------------------------\n");
  20. SetTimer("UpdateSpeed", UpdateSeconds*1000, 1);
  21. }
  22.  
  23.  
  24. public OnFilterScriptExit()
  25. {
  26. print("\n----------------------------------");
  27. print("[FS] Radar Automatico Desativado");
  28. print("----------------------------------\n");
  29. }
  30.  
  31. forward UpdateSpeed(playerid);
  32.  
  33. enum SavePlayerPosEnum
  34. {
  35. Float:LastX,
  36. Float:LastY,
  37. Float:LastZ
  38. }
  39.  
  40. #define COLOR_YELLOW 0xFFFF00AA
  41. #define VERDEFRACO 0x80cf80AA
  42. #define SLOTS 500
  43.  
  44. new objectcreated;
  45. new SavePlayerPos[SLOTS][SavePlayerPosEnum];
  46. new distance1[MAX_PLAYERS];
  47.  
  48.  
  49. public UpdateSpeed(playerid)
  50. {
  51. new Float:x,Float:y,Float:z;
  52. new Float:distance,value;
  53. for(new i=0; i<SLOTS; i++)
  54. {
  55. if(IsPlayerConnected(i))
  56. {
  57. GetPlayerPos(i, x, y, z);
  58. 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));
  59. value = floatround(distance * 3600);
  60. if(UpdateSeconds > 1)
  61. {
  62. value = floatround(value / UpdateSeconds);
  63. }
  64. distance1[i] = floatround(value/1600);
  65.  
  66. SavePlayerPos[i][LastX] = x;
  67. SavePlayerPos[i][LastY] = y;
  68. SavePlayerPos[i][LastZ] = z;
  69. /* Para colocar Coordenada no lugar que voce quer , basta colocar a Coordenada X,Y,Z no lugar dos 00000 ,
  70. o 40 é o raio que o radar pega, e o 50 , é a velocidade maxima*/
  71. AddFlitsPaal(i, 1278, 1524.1971,-1674.1224,13.5469, 90, 110); // Radar da DP PM
  72. AddFlitsPaal(i, 1278, 1486.7902,-1726.9485,13.5469, 90, 110); // Prefeitura
  73. AddFlitsPaal(i, 1278, 1454.1200,-1039.0997,23.8281, 90, 110); // BANCO
  74. AddFlitsPaal(i, 1278, 1993.0825,-1453.5201,13.5547, 90, 110); // HOSPITAL
  75. AddFlitsPaal(i, 1278, 1927.7516,-1757.6179,13.5469, 90, 110); // POSTO
  76. AddFlitsPaal(i, 1278, 1480.6022,-1867.0929,13.5469, 90, 110); // ATRAS DA PREF
  77. AddFlitsPaal(i, 1278, 1351.3029,-1291.9943,14.0469, 90, 110); // AMMU NATION
  78. AddFlitsPaal(i, 1278, 1766.7039,-1172.4738,23.8281, 90, 110); // LOJA DE ARMAS 1
  79. AddFlitsPaal(i, 1278, 0000.0000,0000.0000,0000.0000, 90, 110); // VAGO
  80. AddFlitsPaal(i, 1278, 0000.0000,0000.0000,0000.0000, 90, 110); // VAGO
  81.  
  82. //===================TEXTOS===================By: Sivi
  83. Create3DTextLabel("RADAR\nVelocidade\nMaxima 110 KM/H",COLOR_YELLOW,1524.1971,-1674.1224,13.5469,100.0,0); //DP
  84. Create3DTextLabel("RADAR\nVelocidade\nMaxima 110 KM/H",COLOR_YELLOW,1486.7902,-1726.9485,13.5469,100.0,0); //PREF
  85. Create3DTextLabel("RADAR\nVelocidade\nMaxima 110 KM/H",COLOR_YELLOW,1454.1200,-1039.0997,23.8281,100.0,0); //BANCO
  86. Create3DTextLabel("RADAR\nVelocidade\nMaxima 110 KM/H",COLOR_YELLOW,1927.7516,-1757.6179,13.5469,100.0,0); //POSTO
  87. Create3DTextLabel("RADAR\nVelocidade\nMaxima 110 KM/H",COLOR_YELLOW,1766.7039,-1172.4738,23.8281,100.0,0); //L. ARMA 1
  88. Create3DTextLabel("RADAR\nVelocidade\nMaxima 110 KM/H",COLOR_YELLOW,1351.3029,-1291.9943,14.0469,100.0,0); //AMMU NATION
  89. Create3DTextLabel("RADAR\nVelocidade\nMaxima 110 KM/H",COLOR_YELLOW,1348.7843,-1269.7135,14.0469,100.0,0); //AMMU NATION
  90. Create3DTextLabel("RADAR\nVelocidade\nMaxima 110 KM/H",COLOR_YELLOW,1993.0825,-1453.5201,13.5547,100.0,0); //HOSPITAL
  91. Create3DTextLabel("RADAR\nVelocidade\nMaxima 110 KM/H",COLOR_YELLOW,1480.6022,-1867.0929,13.5469,100.0,0); //ATRAS DA PREF
  92. }
  93. }
  94. }
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101. public OnPlayerCommandText(playerid, cmdtext[])
  102. {
  103. if (strcmp("/radar", cmdtext, true, 10) == 0)
  104. {
  105. SendClientMessage(playerid,0xFF0000AA,"******* SISTEMA DE RADAR ************");
  106. SendClientMessage(playerid,0x33CCFFAA,"Existem Radar na Prefeitura, No Hospital e no DP's de Los Santos e Banco");
  107. SendClientMessage(playerid,0x33CCFFAA,"O Limite de velocidade é entre 50 KM/H");
  108. SendClientMessage(playerid,0x33CCFFAA,"Se voce exceder o Limite de velocidade Nesses Locais , Levara Multa de 2000 $ ");
  109. SendClientMessage(playerid,0xFF0000AA,"Atenciosamente , A administração.");
  110. return 1;
  111. }
  112. if(!strcmp(cmdtext, "/pagarmulta", true))
  113. {
  114. if(Multas[playerid] == 0) return SendClientMessage(playerid, 0xFFFFFFAA, "Não há multas a serem pagas!");
  115. new STR[50];
  116. format(STR, 50, "Total de Multas: %d. Valor a pagar: %d", Multas[playerid], (Multas[playerid] * 2000));
  117. SendClientMessage(playerid, 0xFFFF00AA, STR);
  118. SendClientMessage(playerid, 0xFFFFFFAA, "Você pagou suas multas !");
  119. GivePlayerMoney(playerid, -1 * (Multas[playerid] * 2000));
  120. Multas[playerid] = 0;
  121. return 1;
  122. }
  123. return 0;
  124. }
  125.  
  126. IsPlayerInCircle(playerid,Float:x,Float:y,radius)
  127. {
  128. if(GetPlayerDistanceToPoint(playerid,Float:x,Float:y) < radius)
  129. {
  130. return 1;
  131. }
  132. return 0;
  133. }
  134.  
  135. GetPlayerDistanceToPoint(playerid,Float:x,Float:y)
  136. {
  137. new Float:x1,Float:y1,Float:z1; GetPlayerPos(playerid,x1,y1,z1);
  138. new Float:tmpdis = floatsqroot(floatpower(floatabs(floatsub(x,x1)),2)+
  139. floatpower(floatabs(floatsub(y,y1)),2));
  140. return floatround(tmpdis);
  141. }
  142.  
  143. stock AddFlitsPaal(playerid, modelid, Float:xx, Float:yy, Float:zz, radius, speed)
  144. {
  145. new fine[MAX_PLAYERS];
  146. new str[256];
  147.  
  148. if(objectcreated!=maxobject)
  149. {
  150. CreateObject(modelid, xx, yy, zz, 0.0, 0.0, 10);
  151. objectcreated++;
  152. }
  153. new Velocimetro = distance1[playerid] + 33;
  154. if((Velocimetro)>speed)
  155. {
  156. if(IsPlayerInCircle(playerid, xx, yy, radius) && GetPlayerState(playerid)== PLAYER_STATE_DRIVER)
  157. {
  158. fine[playerid]=((distance1[playerid]*17/10)-speed);
  159. Multas[playerid] += 1;
  160. format(str,sizeof(str), "{FFFF00}[INFO-RADAR] {FF0000}O Limite de velocidade é {FFFF00}%d KM/H. {FF0000}Você Passou a {FFFF00}%d KM/H {FF0000}e foi {FFFF00}MULTADO !",speed, Velocimetro);
  161. // Caso queira mudar o nome do radar , é so mudar o xXx pelo nome que quiser. e o -2000 é o valor da multa.
  162. SendClientMessage(playerid, VERDEFRACO, str);
  163. SendClientMessage(playerid, 0x33CCFFAA, "Digite /pagarmulta para pagar suas multas !");
  164. PlayerPlaySound(playerid, 1132, 0.0, 0.0, 0.0);
  165. }
  166. }
  167. }
Advertisement
Add Comment
Please, Sign In to add comment