SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 05/06/2011, 08:52 PM   #1
JernejL
Beta Tester
 
JernejL's Avatar
 
Join Date: Jan 2006
Location: Slovenia
Posts: 567
Reputation: 366
Default remote-jacking anticheat (also detects people controlling remote cars issue)

pawn Code:
check_remote_jacking(PlayerID) {
   
    new currstate;
    currstate = GetPlayerVehicleID(PlayerID);
   
    if (!IsPlayerInAnyVehicle(PlayerID)) // always remember last onfoot coords.
        GetPlayerPos(PlayerID, acstruct[PlayerID][LastOnFootPosition][0], acstruct[PlayerID][LastOnFootPosition][1], acstruct[PlayerID][LastOnFootPosition][2]);
   
    if ((currstate != acstruct[PlayerID][lastantijackstate]) && (currstate != 0) && (GetPlayerState(PlayerID) == PLAYER_STATE_DRIVER)) {
       
        new Float:Tmppos[3];
       
        GetVehiclePos(GetPlayerVehicleID(PlayerID), Tmppos[0], Tmppos[1], Tmppos[2]);
       
        new Float:distancejack = 0.0;
        distancejack = Distance(Tmppos, acstruct[PlayerID][LastOnFootPosition]);
       
        new thiscaride;
        thiscaride = GetVehicleModel(GetPlayerVehicleID(PlayerID));
       
        new Float:distanceth = 10.0; // some sane random value
       
        if ((thiscaride == 577) || (thiscaride == 592)) //ignore AT-400 and andromada (false positives spam)
            distanceth = 25.0;
       
        if (distancejack > distanceth) {
            new sTemp[255];
            format(sTemp, sizeof(sTemp), "Possibly remote-jacked a car type %d (%s) distance to car: %0.2f.", thiscaride, VehicleNames[GetVehicleModel(GetPlayerVehicleID(PlayerID)) - 400], distancejack);
            pos_ReportPlayerToAdmins(ANTICHEAT_ID, ANTICHEAT_NAME, PlayerID, sTemp);
           
            if (notadmin) {
               
                new issin = 0;
                if (IsVehicleStreamedIn(GetPlayerVehicleID(PlayerID), PlayerID))
                    issin = 1;
               
                new sTemp2[1000];
                format(sTemp2, sizeof(sTemp2), "[checkremotejack] %s %d vid: %d IDE: %d distance: %0.1f (%0.2f, %0.2f, %0.2f -> %0.2f, %0.2f, %0.2f ) LDC: %d streamed: %d", pNickname[PlayerID], PlayerID, currstate, thiscaride, distancejack, Tmppos[0], Tmppos[1], Tmppos[2], acstruct[PlayerID][LastOnFootPosition][0], acstruct[PlayerID][LastOnFootPosition][1], acstruct[PlayerID][LastOnFootPosition][2], TickCount() - pLastDrunkChange[PlayerID], issin);
                AddEchoMessageEx(sTemp2);
            }
           
        }
       
        // This is now assumed last position, so we can see if player teleported from one car to another.
        GetPlayerPos(PlayerID, acstruct[PlayerID][LastOnFootPosition][0], acstruct[PlayerID][LastOnFootPosition][1], acstruct[PlayerID][LastOnFootPosition][2]);
       
        acstruct[PlayerID][lastantijackstate] = currstate;
    }
   
}

- Written by me based on Kalcor's instructions on how to handle this issue.
- Put it into onplayerupdate call, change the calls to pos_ReportPlayerToAdmins and AddEchoMessageEx to whatever your player report & irc report routines are.
- When the vehicle is NOT streamed in and this happens, the player is in desynced state (you may consider forcing them to reconnect or kick them to solve that side issue) or your script used PutPlayerInVehicle call.
- It shouldnt be hard for you to figure out the acstruct enum but if you need help let me know
- Also don't forget to init lastantijackstate to 0 on every spawning, connecting etc..

This is VERY reliable but has its flaws (for start it doesn't handle PutPlayerInVehicle properly). but it'll be enough for you to detect when people are trying to remotely controll vehicles (it will register as one player quickly switching around large amout of cars) - example reports of this happening:

Quote:
'Elculiaopesao', '2011-06-01 18:12:50', 'Possible remote jacking vid: 853 IDE: 402 distance: 755.1 (-2000.48, 82.77, 27.44 -> -2652.53, -297.51, 7.07 ) LDC: 725'
'Elculiaopesao', '2011-06-01 18:12:54', 'Possible remote jacking vid: 1154 IDE: 407 distance: 21.2 (-2021.73, 81.74, 28.25 -> -2000.48, 82.77, 27.44 ) LDC: 314'
'Elculiaopesao', '2011-06-01 18:13:05', 'Possible remote jacking vid: 678 IDE: 566 distance: 124.2 (-1983.32, 199.95, 27.48 -> -2021.73, 81.74, 28.25 ) LDC: 246'
'Elculiaopesao', '2011-06-01 18:13:06', 'Possible remote jacking vid: 1154 IDE: 407 distance: 21.1 (-2002.53, 208.76, 27.77 -> -1983.32, 199.95, 27.48 ) LDC: 0'
'Elculiaopesao', '2011-06-01 18:13:06', 'Possible remote jacking vid: 678 IDE: 566 distance: 21.1 (-1983.30, 200.01, 27.45 -> -2002.53, 208.76, 27.77 ) LDC: 718'
'Elculiaopesao', '2011-06-01 18:13:08', 'Possible remote jacking vid: 1154 IDE: 407 distance: 48.4 (-2001.21, 244.98, 29.80 -> -1983.30, 200.01, 27.45 ) LDC: 595'
'Elculiaopesao', '2011-06-01 18:13:09', 'Possible remote jacking vid: 124 IDE: 422 distance: 49.1 (-2045.72, 264.94, 35.79 -> -2001.21, 244.98, 29.80 ) LDC: 303'
'Elculiaopesao', '2011-06-01 18:13:10', 'Possible remote jacking vid: 1222 IDE: 500 distance: 34.1 (-2079.77, 267.00, 35.48 -> -2045.72, 264.94, 35.79 ) LDC: 328'
'Elculiaopesao', '2011-06-01 18:13:11', 'Possible remote jacking vid: 124 IDE: 422 distance: 34.1 (-2045.70, 264.81, 35.80 -> -2079.77, 267.00, 35.48 ) LDC: 166'
It will also let you see when people try to actually remote jack vehicles from other players, etc..

Feel free to post comments, optimizations, improvements.
__________________


8.2.121.99:7777 - Partyserver - TurtleServer (now with extra turtles)!

SA-MP map editor: Not a in-game script but a proper windows application!
http://forum.sa-mp.com/showthread.php?t=282801

Last edited by JernejL; 06/06/2011 at 10:05 PM.
JernejL is offline   Reply With Quote
Old 05/06/2011, 09:19 PM   #2
SkizzoTrick
High-roller
 
SkizzoTrick's Avatar
 
Join Date: Aug 2010
Location: In your bed[if you are a girl]
Posts: 1,884
Reputation: 37
Default Re: remote-jacking anticheat (also detects people controlling remote cars issue)

Nice xD but it would be better if you would use [ pawn ][ /pawn ] because the details like the comments would be more clear.
__________________
Free accounts for XBOX Live, PS, Steam and others!
https://getyourfreeaccount.com
SkizzoTrick is offline   Reply With Quote
Old 05/06/2011, 09:27 PM   #3
Famalamalam
Gangsta
 
Famalamalam's Avatar
 
Join Date: Apr 2011
Posts: 496
Reputation: 39
Default Re: remote-jacking anticheat (also detects people controlling remote cars issue)

Good work, JernejL! This'll come in handy no doubt.
__________________

Famalamalam is offline   Reply With Quote
Old 05/06/2011, 09:56 PM   #4
MrDeath537
High-roller
 
Join Date: Nov 2009
Location: Argentina
Posts: 2,082
Reputation: 29
Default Re: remote-jacking anticheat (also detects people controlling remote cars issue)

Good bob JernejL, it may be useful for some people
__________________
Trabajando en 3 includes, ny_INI, ny_XML y ny_Handling.
MrDeath537 is offline   Reply With Quote
Old 05/06/2011, 10:25 PM   #5
linuxthefish
High-roller
 
linuxthefish's Avatar
 
Join Date: Dec 2010
Posts: 2,995
Reputation: 679
Default Re: remote-jacking anticheat (also detects people controlling remote cars issue)

I've seen this in a 3rd party mod before, but good work!
__________________
linuxthefish is offline   Reply With Quote
Old 06/06/2011, 09:48 AM   #6
BaubaS
Huge Clucker
 
Join Date: May 2011
Posts: 485
Reputation: 52
Default Re: remote-jacking anticheat (also detects people controlling remote cars issue)

I can't understand, what is remote-jacking?
BaubaS is offline   Reply With Quote
Old 06/06/2011, 04:49 PM   #7
Kwarde
High-roller
 
Kwarde's Avatar
 
Join Date: Nov 2009
Location: The Netherlands
Posts: 2,868
Reputation: 1195
Default Re: remote-jacking anticheat (also detects people controlling remote cars issue)

Wrong board, this is the tutorials board. This script is not a tutorial but just a script.
And it's better readable if it's placed between [ pawn ][ /pawn ] tags. However it's nice, I might use it if I get annoying cheaters/hackers
__________________
Lalalalalaaa
Kwarde is offline   Reply With Quote
Old 06/06/2011, 07:01 PM   #8
Michael@Belgium
High-roller
 
Michael@Belgium's Avatar
 
Join Date: Dec 2010
Location: Belgium
Posts: 2,495
Reputation: 836
Default Re: remote-jacking anticheat (also detects people controlling remote cars issue)

Looks good but ... i don't know what remote-jacking is xD
Michael@Belgium is offline   Reply With Quote
Old 06/06/2011, 07:27 PM   #9
Mean
Banned
 
Join Date: Jul 2010
Location: 14th annual lemon party
Posts: 2,892
Reputation: 229
Default Re: remote-jacking anticheat (also detects people controlling remote cars issue)

Good work, this might be useful for me soon.
And yeah, as SkizzoTrick said, use [ pawn ][ /pawn ].
Mean is offline   Reply With Quote
Old 06/06/2011, 07:30 PM   #10
Kwarde
High-roller
 
Kwarde's Avatar
 
Join Date: Nov 2009
Location: The Netherlands
Posts: 2,868
Reputation: 1195
Default Re: remote-jacking anticheat (also detects people controlling remote cars issue)

@Michael: As far as I know, remote-jacking is that cheat where you can enter a car from anywhere. If someone is in it, he'll be removed out from it. Am I right? If not, I don't know what it is neither.

This forum requires that you wait 120 seconds between posts. Please try again in 32 seconds.
32 seconds later.
Second try
__________________
Lalalalalaaa
Kwarde is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
remote access zone Server Support 3 01/02/2013 09:35 AM
Remote car system New_Player[USW] Help Archive 3 06/11/2010 09:01 AM
[FilterScript] [FS] Remote Admin pulposlaw Filterscripts 15 05/06/2009 04:04 PM
Remote Console Danut Server Support 3 09/03/2009 12:23 PM


All times are GMT. The time now is 08:42 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.