SA-MP Forums Archive
[Include] Weapon+ammo anticheat [BETA] - 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] Weapon+ammo anticheat [BETA] (/showthread.php?tid=207781)



Weapon+ammo anticheat [BETA] - DRIFT_HUNTER - 06.01.2011

Here is one Weapon+ammo anticheat
First version used GetPlayerWeaponData and it always give me wrong ammo amount so i replaced it with GetPlayerWeapon and GetPlayerAmmo


-How to use it?
1.
Add at top of the script
pawn Код:
#include <anticheat>
2.
If you use it in filterscript just skip these step
If you want to use it in GameMode
Add
pawn Код:
public OnGameModeInit()
{
    //AnticheatInit(time)
    AnticheatInit(1000);//Set your update time HERE(in milisecunds) (In these case its 1 second)
    return 1;  
}
public OnGameModeExit()
{
    AnticheatExit();
    return 1;
}
3.Add
pawn Код:
public OnPlayerConnect(playerid)
{
    PlayerConnect(playerid);//Add these under OnPlayerConnect
    return 1;
}
public OnPlayerDisconnect(playerid)
{
    PlayerDisconnect(playerid);//Add these under OnPlayerDisconnect
    return 1;
}
4.
Change samp function's to anticheat one
pawn Код:
GivePlayerWeapon   - to - GivePlayerGun
SetPlayerAmmo       - to - SetPlayerAmmoPerSlot
ResetPlayerWeapons- to - ResetPlayerGuns
5.Add Anticheat callback
pawn Код:
OnAnticheatDetectWeaponCheat(playerid,weaponid,type)
{
    //These is called when Anticheat detect cheat
    //If type = 0 Player spawned weapon
    //If type = 1 Player spawned ammo for weapon

    //Example on how to use
    new string[128];
    switch(type)
    {
        case 0: format(string,sizeof(string),"[ANTICHEAT]Kicked playerid %d for spawning weapon %d",playerid,weaponid);
        case 1: format(string,sizeof(string),"[ANTICHEAT]Kicked playerid %d for spawning ammo for weapon %d",playerid,weaponid);
    }
    Kick(playerid);
    SendClientMessageToAll(COLOR_RED,string);
    return 1;
}
6.Compile script

Anticheat functions:
pawn Код:
AnticheatInit(time);//These must be called on gamemode init
AnticheatExit();//These must be called on GameMode exit
PlayerConnect(playerid);//These must be called OnPlayerConnect
PlayerDisconnect(playerid);//These must be called OnPlayerDisconnect
SetPlayerGun(playerid,weaponid,ammo);
ResetPlayerGuns(playerid);
SetPlayerAmmoPerSlot(playerid,weaponslot,ammo);
GetWeaponSlot(weaponid);//Cant remember who posted these but its not by me
Callback's
pawn Код:
OnAnticheatDetectWeaponCheat(playerid,weaponid,type)
//If type = 0 Player spawned weapon
//If type = 1 Player spawned ammo for weapon
[NOTE]GameMode must use anticheat in order to use these anticheat in filterscript
Known bug's:
None for now

License:
1.Use it
2.Love it
3.Sell it
4.Claim it - Optional xD
5.Declare war to cheaters

If you do not agree you still can use it :P
Download--->>>http://www.mediafire.com/?j3kkw58ntcf640g

IF YOU FIND ANY BUG REPORT IT HERE


Re: Weapon+ammo anticheat [BETA] - [Ips]Guh - 07.01.2011

Hmmmmm ...... Very Good...
Good Job...


Re: Weapon+ammo anticheat [BETA] - Lorenc_ - 07.01.2011

Looks great, nice inc.


Re: Weapon+ammo anticheat [BETA] - Kwarde - 07.01.2011

idk if it's good.
However I came here for a tip:

You added the 'PlayerConnect' ETC in the OnPlayerConnect.
You can also use CallRemoteFunction or CallLocalFunction
Then, player's don't need to add the PlayerConnect etc stuff


Re: Weapon+ammo anticheat [BETA] - DRIFT_HUNTER - 07.01.2011

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
idk if it's good.
However I came here for a tip:

You added the 'PlayerConnect' ETC in the OnPlayerConnect.
You can also use CallRemoteFunction or CallLocalFunction
Then, player's don't need to add the PlayerConnect etc stuff
Well thats used just to reset player variables.There is no need foe that
And its not public function
Anyway thx for suggestion


Respuesta: Weapon+ammo anticheat [BETA] - Cacoby - 07.01.2011

nice job
good inc

:P


Re: Weapon+ammo anticheat [BETA] - wups - 07.01.2011

Can be done with much more efficient ways. Other than that, i think it's nice, but you should really consider optimizing it.


Re: Weapon+ammo anticheat [BETA] - NimaKhan - 30.01.2014

please fix link i need it


Re: Weapon+ammo anticheat [BETA] - BOyka1 - 19.02.2019

Any updated link?


Re: Weapon+ammo anticheat [BETA] - HNIC - 19.02.2019

Quote:
Originally Posted by BOyka1
Посмотреть сообщение
Any updated link?
There are way better anticheats, and you shouldn't bump a thread that's over 4 years old.