Jump to content
  • 0

API


ysfl

Question

on the Internet, I found a detection the cheat code, must be placed on MovementHandler. Below the CPP, so what should I use? Or, should I put where? Because is the code for many years, I don't know that there are no effect...

if(!_player->blinked && sWorld.antihack_speed && !_player->m_uint32Values[uNIT_FIELD_CHARM] && !_player->m_TransporterGUID) 
 { 
   // calculate distance between last heartbeat and this 
   if(_player->_lastHeartbeatTime && _player->_heartBeatDisabledUntil < UNIXTIME) 
   { 
     int32 time_diff = movement_info.time - _player->_lastHeartbeatTime; 
     //float distance_travelled = _player->m_position.Distance2D(_player->_lastHeartbeatX, _player->_lastHeartbeatY); 
     float delta_x = movement_info.x - _player->_lastHeartbeatX; 
     float delta_y = movement_info.y - _player->_lastHeartbeatY; 
     float distance_travelled = sqrtf(delta_x*delta_x + delta_y*delta_y); 
     // speed
     float speed = _player->m_runSpeed; 
     // fly
     switch(_player->m_lastMoveType) 
     { 
     case 1:    // swimspeed 
       speed = _player->m_swimSpeed; 
       break; 
     case 2:    //flyspeed 
       speed = _player->m_flySpeed; 
       break; 
     } 
     int32 move_time = (int32)((float)distance_travelled / (float)(speed*0.001f)); 
     // check if we're in the correct bounds 
     if(move_time > time_diff) 
     { 
       int32 difference = move_time - time_diff; 
       if(difference > 350)  // say this for now 
       { 
         if(_player->m_speedhackChances) 
         { 
           sChatHandler.SystemMessage(this, "kick 5 ms ."); 
           _player->SetMovement(MOVE_ROOT, 1); 
           sEventMgr.AddEvent(_player, &Player::SetMovement, uint8(MOVE_UNROOT), uint32(1), EVENT_DELETE_TIMER, 5000, 1,EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); 
           _player->ResetHeartbeatCoords(); 
           _player->m_speedhackChances--; 
           sCheatLog.writefromsession(this, "The speed of your mistake %u", ); 
         } 
         else if(_player->m_speedhackChances == 0) 
         { 
           sChatHandler.SystemMessage(this, "You will leave the server."); 
           sCheatLog.writefromsession(this, "Kicked for speedhack, time diff of %u", difference); 
           _player->m_KickDelay = 0; 
           sEventMgr.AddEvent(_player, &Player::_Kick, EVENT_PLAYER_KICK, 10000, 1,0); 
           // Root movement  heheheh evil 
           _player->SetMovement(MOVE_ROOT, 1); 
         } 
       } 
       //printf("Move shit: %ums\n", abs(difference)); 
       //sChatHandler.SystemMessage(this, "Move time : %d / %d, diff: %d", move_time, time_diff, difference); 
     } 
   } 
   _player->_lastHeartbeatTime = movement_info.time; 
   _player->_lastHeartbeatX = movement_info.x; 
   _player->_lastHeartbeatY = movement_info.y; 
 }

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use