Soldat Fans > Developers Corner

AntiTeleport and AntiSuperman

(1/5) > >>

rainrider:
Umm, EnEsCe made few days ago new server (offtopic - Michal said he doesn't need any help -.-) with antimassflag. But antimassflag isn't all... you can simply make antiteleport and antisuperman in one mechanism. Just store in memory coordinates of players in few 'shelves' (arrays, like COORD LastPlayersCoord[32][30]) and move all array data to left by 1 on every server loop step. First XY would be deleted, and the last would be changed with current XY of every player. Now you check that player has moved more than, for example, 100px by comparing abs(LastPlayersCoord[loopstep][29].x&y-LastPlayersCoord[loopstep][0].x&y)>100. If so, server would vote kick. Dunno that each X & Y should be abs()ed, but probably yes. Nope, that method got one little exploit, but I won't explain it couse of possiblement that some cheaters are reading this text. Example in c++ with calculation of PlayerLastCoord size:


--- Code: ---/* global */
#define TPSIZE 200
#include <windows.h> /* coord, abs() */
COORD PlayerLastCoord [ 32 ] [ 30 ];
unsigned short int iPlayerID;
unsigned short int iLoopStep;

/* in server loop */
for ( iPlayerID = 0; iPlayerID < 32; iPlayerID ++ )
 {
  for ( iLoopStep = 1; iLoopStep < sizeof ( PlayerLastCoord [ iPlayerID ] ) / sizeof ( COORD ); iLoopStep ++ )
    PlayerLastCoord [ iPlayerID ] [ iLoopStep - 1 ] = PlayerLastCoord [ iPlayerID ] [ iLoopStep ];
  PlayerLastCoord [ iPlayerID ] [ sizeof ( PlayerLastCoord [ iPlayerID ] ) / sizeof ( COORD ) - 1 ] = /*global player xy*/ PlayerCoords [ iPlayerID ];
  if ( abs ( PlayerLastCoord [ iPlayerID ] [ 0 ] . X - PlayerLastCoord [ iPlayerID ] [ sizeof ( PlayerLastCoord [ iPlayerID ] ) / sizeof ( COORD ) - 1 ] . X ) > TPSIZE ||
       abs ( PlayerLastCoord [ iPlayerID ] [ 0 ] . Y - PlayerLastCoord [ iPlayerID ] [ sizeof ( PlayerLastCoord [ iPlayerID ] ) / sizeof ( COORD ) - 1 ] . Y ) > TPSIZE
     )
    /*vote player cheats!*/
 }
--- End code ---

EnEsCe:
Trust me, I did that. The code is in the server, but all commented out.
Simply because, it was too sensitive. If you respawned, you were cheating. If you changed team, you were cheating. If you lagged, you were cheating. If you M79 boost, you are cheating. Sure, you can make fix that, but then all 'they' have to do is decrease the speed of their 'thing'.

An anti-teleport is in the works, but might be some time.

bja888:
What is this? How are you getting the x and y of the players?

EnEsCe:
bja this is out of your league, go back to the lounge.

bja888:
I'm always looking for new concepts and techniques to improve the efficiency of my programming practices.

Navigation

[0] Message Index

[#] Next page

Go to full version