Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Basic SA-MP script against bots.
- //==============================================================================
- // Includes.
- //==============================================================================
- #include <a_samp>
- //==============================================================================
- //------------------------------------------------------------------------------
- // Configuration.
- //------------------------------------------------------------------------------
- //==============================================================================
- //==============================================================================
- // Define IPS.
- //==============================================================================
- #define IPS 7
- //==============================================================================
- //------------------------------------------------------------------------------
- // Publics.
- //------------------------------------------------------------------------------
- //==============================================================================
- //==============================================================================
- // Public - OnPlayerConnect.
- //==============================================================================
- public OnPlayerConnect(playerid)
- {
- new Connecting[32+1];
- GetPlayerIp(playerid, Connecting, 32);
- new Num = GetNumberOfPlayersOnThisIP(Connecting);
- if(Num > IPS)
- {
- printf("MAX IPs: Connecting player(%d) exceeded %d IP connections from %s.", playerid, IPS, Connecting);
- BanEx(playerid, "Bots");
- return 1;
- }
- return 0;
- }
- //==============================================================================
- // Stock - GetNumberOfPlayersOnThisIP.
- //==============================================================================
- stock GetNumberOfPlayersOnThisIP(Test[])
- {
- new Against[32+1];
- new X = 0;
- new Count = 0;
- for(X = 0; X < MAX_PLAYERS; X++)
- {
- if(IsPlayerConnected(X))
- {
- GetPlayerIp(X, Against, 32);
- if(!strcmp(Against, Test)) Count++;
- }
- }
- return Count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement