05.06.2011, 20:52
(
Последний раз редактировалось JernejL; 06.06.2011 в 22:05.
)
pawn Код:
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;
}
}
- 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' |
Feel free to post comments, optimizations, improvements.