Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #include <a_samp>
- #include <callbacks>
- #include <foreach>
- new
- bool:Suspect[ MAX_PLAYERS char ], bool:PressedKey[ MAX_PLAYERS char ]
- ;
- #define PRESSED(%0) \
- (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
- #define PUB:%0(%1) forward %0(%1); \
- public %0(%1)
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print("Anti 'ATJ' by Kyance\nBETA VERSION -LOADED-");
- print("--------------------------------------\n");
- foreach(Player,i) OnPlayerConnect(i);
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n--------------------------------------");
- print("Anti 'ATJ' by Kyance\nBETA VERSION -UNLOADED-");
- print("--------------------------------------\n");
- return 1;
- }
- #endif
- public OnPlayerConnect(playerid)
- {
- Suspect{ playerid } = false, PressedKey{ playerid } = false;
- return 1;
- }
- public OnPlayerCarJack(playerid, targetid, vehicleid)
- {
- if(PressedKey{ playerid })
- {
- Suspect{ playerid } = true;
- CheckATJ(playerid, targetid);
- }
- return 1;
- }
- /*
- This part of the code isn't tested, that's why it's 'commented'
- IMPORTANT: If you wish to uncomment this line, please do some changes in this code, or in the 'OnPlayerCarJack', since then, 2 messages will be sent (if a player gets carjacked by this)
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- if(PressedKey{ playerid })
- {
- if(newstate == PLAYER_STATE_DRIVER && Suspect{ playerid })
- {
- new string[96];
- format(string, sizeof(string), "SERVER: %s is possibly using the 'ATJ' cleo hack!", GetName(playerid)), SendClientMessageToAll(-1, string), string = "\0";
- }
- }
- return 1;
- }
- IMPORTANT: If you wish to uncomment this line, please do some changes in this code, or in the 'OnPlayerCarJack', since then, 2 messages will be sent (if a player gets carjacked by this)
- This part of the code isn't tested, that's why it's 'commented'
- */
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(PRESSED(KEY_HANDBRAKE)) PressedKey{ playerid } = true, SetTimerEx("ResetPK", 2000, false, "i", playerid);
- return 1;
- }
- stock CheckATJ(playerid, targetid = INVALID_PLAYER_ID)
- {
- if(targetid != INVALID_PLAYER_ID && Suspect{ playerid })
- {
- new vehicleid = GetPlayerVehicleID(playerid), string[98];
- RemovePlayerFromVehicle(playerid), SetTimerEx("PutInVehicle", 1500, false, "ii", targetid, vehicleid);
- format(string, sizeof(string), "SERVER: We've detected that you've possibly been a 'ATJ' target by '%s'", GetName(playerid));
- SendClientMessage(targetid, -1, string), string = "\0";
- format(string, sizeof(string), "SERVER: %s is possibly using the 'ATJ' cleo hack!", GetName(playerid)), SendClientMessageToAll(-1, string), string = "\0";
- //You can delete the 83rd line, and use a Kick instead(or ban... or w.e you want to).
- }
- }
- stock GetName(playerid)
- {
- new pnameid[24];
- GetPlayerName(playerid,pnameid,sizeof(pnameid));
- return pnameid;
- }
- PUB:ResetPK(playerid)
- {
- PressedKey{ playerid } = false;
- return 1;
- }
- PUB:PutInVehicle(playerid, vehicleid)
- {
- PutPlayerInVehicle(playerid, vehicleid, 0);
- SendClientMessage(playerid, -1, "SERVER: You've been put back in your vehicle!");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement