SA-MP Forums Archive
[Include] Anti-Camp Include - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Anti-Camp Include (/showthread.php?tid=407862)



Anti-Camp Include - BlackBank - 15.01.2013

Anti-Camp Include
By BlackBank3

Little description:
With this script you can detect players that are camping.
You can choose whatever you want to do with them, because i've implanted a callback that will be called if the player is camping.
You can also change the react time of the anti-camp system and the distance check.

Functions:
Код:
AntiCamp_Enable(playerid, ReactTimeInSeconds = AC_DEFAULT_REACT_TIME, bool:enabled = true);
AntiCamp_Disable(playerid);
AntiCamp_ResetReactCount(playerid);
AntiCamp_SetReactTime(playerid, Seconds = AC_DEFAULT_REACT_TIME);
AntiCamp_IsEnabled(playerid);
Callbacks:
Код:
public OnPlayerCamping(playerid)
Notes:
- You can change the distance with ANTI_CAMP_DISTANCE define. Default it's set on 6.0.
- React time means the time when he will call the Callback and detects you as a 'camper'.
- The default react time in seconds is "AC_DEFAULT_REACT_TIME =" 7 seconds.
- You can only include this script in ONE script. Next version will support more then only one script.

Little Example:
pawn Код:
#include <anti-camp>

public OnPlayerCamping(playerid)
{
        SendClientMessage(playerid, -1, "ANTI-CAMP: Camping is not allowed on this server!");
        SetPlayerHealth(playerid, 0.0);
        return 1;
}
 
public OnPlayerCommandText(playerid, cmdtext[])
{
        if(strcmp(cmdtext, "/anticamp") == 0)
        {
                if(AntiCamp_IsEnabled(playerid) == 0)
                {
                    AntiCamp_Enable(playerid, 10); //Enable anti-camp, with a react time of 10 seconds.
                    SendClientMessage(playerid, -1, "ANTI-CAMP is now on!");
                }
                else
                {
                    AntiCamp_Disable(playerid); //Disable anti-camp.
                    SendClientMessage(playerid, -1, "ANTI-CAMP is now off!");
                }
            return 1;
        }
        return 0;
}
Thanks to:
Michael@Belgium (For the idea).

Download:
.zip: http://blackbanks.net/samp/anti-camp.zip
Pastebin: http://pastebin.com/xxrQuRBL


Re: Anti-Camp Include - DiReCt hIt - 15.01.2013

Nice include Anti-Camp ,


Re: Anti-Camp Include - Gforcez - 15.01.2013

Nice one!