Advertisement
Guest User

[FS]Radar[BlogDoSamp]

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