Guest User

[FS]-Speed Limiter [BloGdoSamP]

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