![]() |
Stop Speed Hacks - Printable Version +- Mirage Source (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51) +----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44) +------ Forum: Tutorials (https://mirage-engine.uk/forums/forumdisplay.php?fid=13) +------ Thread: Stop Speed Hacks (/showthread.php?tid=2421) |
Stop Speed Hacks - Labmonkey - 03-12-2008 I'm not sure if this should go in ms4 tutorials or ms4 development or resources-bugfixes. If anyone wants to move it that's fine. Anyway, I made this for my game (Rising Flames) as part of the stun/slow system, but it also stops speedhacking, so I thought I would post it here. Basically what I am doing is making the client wait for the server to say "you moved" instead of having the client move itself. This, along with a timer check server side, removes the ability to speedhack. [CLIENT SIDE] in modGameLogic, sub checkmovement: find and delete/comment out. Code: ' Check if player has the shift key down for running We do this so if the client doesn't get the OK from the server, it isn't already moving. also delete/comment out Code: Player(MyIndex).YOffset = PIC_Y Code: Player(MyIndex).YOffset = PIC_Y * -1 Code: Player(MyIndex).XOffset = PIC_X Code: Player(MyIndex).XOffset = PIC_X * -1 We do this so that the client is no longer moving itself if it doesn't get the OK from the server. [SERVER SIDE] Now you may be thinking, "we didn't set up any packets clientside for the OK from the server" That is right, because I am taking advantage of the already made code to handle other player's movement. Turns out it works without any changes for us too. We just have to send the packet to ourselves from the server. modPlayer, sub playermove find and replace each Code: Call SendDataToMapBut(Index, GetPlayerMap(Index), packet) with Code: Call SendDataToMap(GetPlayerMap(Index), packet) Now for the last part of this tutorial. We need to place the check serverside to stop the player from moving too fast. first we need to add a value to the player that shows their timer. still serverside, modTypes, type TempPlayerRec in the type, right below Code: GettingMap As Byte Code: LastMove As Long now, back in sub Playermove under Code: Call SetPlayerDir(Index, Dir) Code: If TempPlayer(Index).LastMove = 0 Then TempPlayer(Index).LastMove = GetTickCount in my game, i only have walking, so i have yet to test the running code. It should work though. The numbers 220 and 460 are very important. In a perfect world, they would be 240 and 480, which you get by doing the walk timer (30) times the pixels in a tile (32) divided by the movement speed (4) 30*32/4 = 240 i had to subtract 20 from it to compensate for some lag. You may have to subtract more/less depending on your lag, or change the numbers if you have a different walk/run speed or a different pic_x/pic_y. EDIT: Forgot to mention, I tested this and it worked against cheat engine 5.4 Re: Stop Speed Hacks - William - 03-12-2008 My tutorial did basicaly the same thing. What I noticed about those numbers is that at big lag, people can't move. Those numbers would have to be like 1000+ from my experience. Still a good tutorial. Re: Stop Speed Hacks - genusis - 03-12-2008 i like it i can't complain looks good ^^ |