Advertisement
Chip7

[FS] Speed Limiter

May 29th, 2012
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.25 KB | None | 0 0
  1. /*
  2.         NÃO RETIRE OS CREDITOS
  3.         POR WEVERTON
  4.          
  5.         PLAGIO E CRIME...
  6.         VISITE NOSSO SITE: http://www.sampknd.com/
  7.         SAMP KND MELHOR BLOG DE SAMP DO BRASIL
  8. */
  9. #include a_samp
  10. #include dini
  11. new aviso[MAX_PLAYERS];
  12. #define SPEEDLIMITER 151
  13.  
  14. public OnFilterScriptInit()
  15. {
  16.          
  17.          SetTimer("Speed",1,true);
  18.          printf("FILTERSCRIPT FEITO POR WEVERTON  Skype: scriptsamp");
  19.          return 1;
  20. }
  21. public OnFilterScriptExit()
  22. {
  23.       return 1;
  24. }
  25. stock GetPlayerSpeed(playerid)
  26. {
  27.     new Float:ST[4];
  28.     if(IsPlayerInAnyVehicle(playerid))
  29.     GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
  30.     else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
  31.     ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 100.3;
  32.     return floatround(ST[3]);
  33. }
  34. public OnPlayerConnect(playerid)
  35. {
  36.     new file[128];
  37.     new name[MAX_PLAYER_NAME];
  38.     GetPlayerName(playerid,name,sizeof(name));
  39.     format(file,sizeof(file),"SpeedLimiter/%s.ini",name);
  40.     if(!dini_Exists(file)) return dini_Create(file);
  41.     aviso[playerid] = dini_Int(file,"Avisos");
  42.     return 1;
  43. }
  44. public OnPlayerDisconnect(playerid)
  45. {
  46.     SendClientMessage(playerid,-1,"Servidor com sistema de Anti Velocidade...BY: Weverton");
  47.     if(aviso[playerid] >= 1)
  48.     {
  49.         new file[128];
  50.         new name[MAX_PLAYER_NAME];
  51.         GetPlayerName(playerid,name,sizeof(name));
  52.         format(file,sizeof(file),"SpeedLimiter/%s.ini",name);
  53.         dini_IntSet(file,"Avisos",aviso[playerid]);
  54.     }
  55.     return 1;
  56. }
  57. forward Speed(playerid);
  58. public Speed(playerid)
  59. {
  60.     if(IsPlayerInAnyVehicle(playerid))
  61.     {
  62.  
  63.         new string[128];
  64.         new name[MAX_PLAYER_NAME];
  65.         GetPlayerName(playerid,name,sizeof(name));
  66.         new sp; sp = GetPlayerSpeed(playerid);
  67.         if(sp >= SPEEDLIMITER)
  68.         {
  69.            
  70.           if(aviso[playerid] == 0)
  71.           {
  72.            format(string,sizeof(string),"[AVISO 1/3] %s ultrapassou o limite de velocidade o servidor e foi kickado[%d km/h]",name,sp);
  73.            SendClientMessageToAll(playerid,0x80FF00AA,string);
  74.            aviso[playerid] += 1;
  75.            Kick(playerid);
  76.            return 1;
  77.           }
  78.           else if(aviso[playerid] == 1)
  79.           {
  80.            format(string,sizeof(string),"[AVISO 2/3] %s ultrapassou o limite de velocidade o servidor e foi kickado[%d km/h]",name,sp);
  81.            SendClientMessageToAll(playerid,0x80FF00AA,string);
  82.            aviso[playerid] += 1;
  83.            Kick(playerid);
  84.            return 1;
  85.           }
  86.           else if(aviso[playerid] == 2)
  87.           {
  88.            format(string,sizeof(string),"[AVISO 3/3] %s ultrapassou o limite de velocidade e foi banido",name);
  89.            SendClientMessageToAll(playerid,0x80FF00AA,string);
  90.            aviso[playerid] += 1;
  91.            format(string,sizeof(string)," %s foi banido por atigir a velocidade maxima do servidor [%d km/h]",name,sp);
  92.            SendClientMessage(playerid,-1,string);
  93.            Ban(playerid);
  94.            aviso[playerid] = 0;
  95.            return 1;
  96.            }
  97.         }
  98.     }
  99.     return 1;
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement