![]() |
Easy tut alert! Ban addon - Printable Version +- Mirage Engine (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: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49) +---- Thread: Easy tut alert! Ban addon (/showthread.php?tid=549) |
Easy tut alert! Ban addon - Leighland - 28-12-2006 Okay, well it occurred to me that some players have dynamic IP addresses and things that can "change" or mask their IP, so I added this bit of code below just to make each ban official. Most of you here probably already have thought of this, but for those who haven't, here you go: Server Side: in modTypes, add this to the PlayerRec: Code: ' Banned Player in modDatabase, add the following: Code: Player(BanPlayerIndex).Char(Player(BanPlayerIndex).Charnum).Banned = 1 Now in modServerTCP, add this function: Code: Function IsCharBanned(ByVal index As Long) As Boolean in modHandleData find: Code: ' :::::::::::::::::::::::::::: and right after that, add this: Code: If IsCharBanned(index) = True Then And that's it, done. Explanation: Depending on where you placed the code in the BanIndex sub, the server sets a "banned" variable in the PlayerRec to true. Then, when the user tries to log in, the "IsCharBanned" function checks to see if that users "Banned" variable is set to true, if so, they are denied access to the game. Very simple, and as far as me and my tester are concerned, effective. If I've left anything out, let me know. EDIT: Almost forgot, saving and loading: in modDatabase, in the SavePlayer sub, add this: Code: Call PutVar(FileName, "CHAR" & i, "Banned", STR(Player(index).Char(i).Banned)) and in the LoadPlayer sub add this: Code: Player(index).Char(i).Banned = Val(GetVar(FileName, "CHAR" & i, "Banned")) - Joost - 31-12-2006 I'd suggest changing the unban sub too. |