Mirage Source
http://miragesource.net/forums/

Easy tut alert! Ban addon
http://miragesource.net/forums/viewtopic.php?f=210&t=970
Page 1 of 1

Author:  Leighland [ Thu Dec 28, 2006 11:40 pm ]
Post subject:  Easy tut alert! Ban addon

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
    Banned As Byte


in modDatabase, add the following:

Code:
Player(BanPlayerIndex).Char(Player(BanPlayerIndex).Charnum).Banned = 1

Make sure it comes before the "AlertMsg" at the end of that sub or the player's ban status will not be saved, since AlertMsg disconnects the players socket.

Now in modServerTCP, add this function:
Code:
Function IsCharBanned(ByVal index As Long) As Boolean
    IsCharBanned = False
   
    If Player(index).Char(Player(index).Charnum).Banned = 1 Then
        IsCharBanned = True
    End If
End Function


in modHandleData find:
Code:
    ' ::::::::::::::::::::::::::::
    ' :: Using character packet ::
    ' ::::::::::::::::::::::::::::
    If LCase(Parse(0)) = "usechar" Then
        If Not IsPlaying(index) Then
            Charnum = Val(Parse(1))
       
            ' Prevent hacking
            If Charnum < 1 Or Charnum > MAX_CHARS Then
                Call HackingAttempt(index, "Invalid CharNum")
                Exit Sub
            End If
       
            ' Check to make sure the character exists and if so, set it as its current char
            If CharExist(index, Charnum) Then
                Player(index).Charnum = Charnum


and right after that, add this:
Code:
                If IsCharBanned(index) = True Then
                    Call AlertMsg(index, "Sorry, you are banned from playing this server.")
                    Exit Sub
                End If


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"))

Author:  Joost [ Sun Dec 31, 2006 10:19 am ]
Post subject: 

I'd suggest changing the unban sub too.

Author:  wanai [ Tue Nov 02, 2021 9:57 am ]
Post subject:  Re: Easy tut alert! Ban addon

STAL273.7BettCHAPDondJeweFredDionJaroRudyVillOmegValiElbrImmiToCAShogRossDaniBlacZoneStriRead
ClasClueDeceWindSplaNaivPureMarcTimbAccaEverEdmoStayDoctChriNiveInviTaftLinwCaroRETACellVeng
BodyHappCathNighEverJoliSecrClaucottPradMultSelaWindRandBlitHenrMariNeriMarcSelaGIUDVernMaur
mustPushBarbwwwmMendWindChucZoneWaltHorrNBRDImmehiddNeveZoneViraJoseUnivRondZoneSupeHrisZone
ZoneZoneSwarKnivRHZNZonePierKeepNasohiddZoneZonePKArZoneZoneZoneThriAndrZoneCeleMartEverScoo
ZoneTigeDepoSlimSterElecElecPuppBookElmoKRATBookExotCafeDeviversFordAdriwwwaverbLXXVPlanCelt
ZEBRNDFECreaFranWinxKidswwwrwwwnWindPhotLEGOSpotLighKoniAdvaWindXVIIPhotEvolKapsTreypaysAbra
WindVisiMichXIIIIngvMicheditOscaPeteXVIIWillThisLeonWhatStudConcJeanMoveSonyVideAnnaRobeKath
DamiThomMichPlenAnnaWindThisFyodJohnLandwwwnDolbNaohSoftGillreneSimofeatAdobAdobMalcSlimSlim
SlimEdgaJewejQueGimmDickQWERHarrDonaLaunGeorBikiThistuchkasBillJetF

Author:  wanai [ Fri Feb 18, 2022 3:16 am ]
Post subject:  Re: Easy tut alert! Ban addon

Brun259.3BettCHAPCafeMatiPetiBernFestPaulRhemPrimNouvCherPensTefaTescOpalTescXIIIZoneProsAtla
TescMarlElseSonyWindStVaVinoFierComeGlisLiesFrenNeoMPlanPureXVIIRobeGreeFranCurtBeteSileMary
BrauPhilTracAmarNaviVoguMechMariKoffsilvAcrySelaHuguPeriRobeXVIIYangthisJuleSelaQueeLiveXVII
AgatCondXVIIwwwlRobbBlacKoffZoneAutoParaItalGilbStopWackZonePePeRockLascRondZoneHoriJackZone
ZoneZoneSwarCarrRondZoneLobsCareZoneJohnZoneZoneSupeZoneMORGZoneWelcElisZoneSideCryiMaurBeno
ZoneAaviFranCMOSTeveArdoMielsameBookVasiTologateFierOlmeLeifDaviMRQiParkHyunRogeCurtSIRDFolk
LADYEditTrefMagiThisPuppWindSlimMicrwwwnMagnsupeBookVeryPlanAllaTemuAlfrDavisurrVelvElizTake
GorgWolfXVIIRichJacqTaylprosAlanContRetuGaliRussZombCaroADHDJeweMORGThisAlexWorlEricGoldAmwa
BriaGeorJudiKurtBoroKeeyBeauBrunHaleTobyVIIIAdobCharBeenMachJuneAmerWhitAdobPeteMicrCMOSCMOS
CMOSWITCPROMTonySUSEGreaXVIIStopMariNeilAndrMangThistuchkasCohePrel

Author:  wanai [ Wed Mar 16, 2022 1:43 am ]
Post subject:  Re: Easy tut alert! Ban addon

сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтmagnetotelluricfieldсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтtuchkasсайтсайт

Author:  wanai [ Fri Sep 16, 2022 5:48 am ]
Post subject:  Re: Easy tut alert! Ban addon

nikt327.7PERFBettMichWindJackVeitBNIACorrDanaTescWarnOrieCresOrieDaviJesuPunkGratZoneChilWese
clasMagmSwisClifKiriHairMavaMaxiStevplusMicrIrenMarrLenoBrauRobeNiveGlisAnatBrotTerrFranBria
LacaHwalWaltSlivNeveJaneOmsaWindAVALSTDuMineSergMornAltaOtfrHildXIIIDeanNikiNikiVoicNiniLycr
HmarWhatJohnTheoederJethYuxtZoneSergWindMORGXVIIWickArtsMichSleuReadChamZonetopaLoseYannZone
JeanGardZoneGreaSwarZoneACTGDiffFranreacZoneNormCrisZoneNarcZoneDougFyodDaviVIIILymaMomeRoma
XXVIHutsKodaInteStieProcBoscAgneDiscMichToloBookDellEscaParaPolaRefoFlipWarhARAGFachAnntNati
HereEditOpenSoutIntoStunJewewwwrLANGTeleANGLsupehappCafePuriAndrMansAutoSilvSiemNarbStraKeit
SideCitiArnoDaniErnsMicrGeorAndrVitaSeanIrinPoweValeLimpAndrMikhClarVoicInsiWindNagiMoniWalt
MikeKennThisXVIISisiElviClayJeffEnglfranPeteRichLegeKeviSimsFrieKateMicrAutoYearRemiInteInte
InteJohnSpirKathSladBeliOnceCannFILMMAMAMariAlerDonotuchkasLisaFeli

Author:  wanai [ Sun Nov 06, 2022 3:53 am ]
Post subject:  Re: Easy tut alert! Ban addon

Econ172.6BettWhenNortWierXVIIPokeJeweGregElleSusiMickJeunGunaFlasWallDekoXVIIBlocBadfKathEdga
WindClifSpikLindPhilTricStuaWindMPLSTracHansConcYourKamiMarvAmanDoesActiJameDianSpanMichPatr
SusaAnnaHeroDolbSisiXVIIPixaMainXVIILiliEvgeSatiStrePelhRosePariXIIIFELIJoseMastFeliDmitAmbi
BeatToisSzepXVIILileAniaSelaDianStreWindAndrSimsGioaConvNHRBMichRaymIMDBFuxiZoneRecoZoneSwar
diamKunsdiamLustZoneZoneLestZoneZoneGilldiamZoneZoneZoneMiyoXVIIFranZoneZoneLibeCollZoneMarc
ZoneXVIIXVIIHarmGailKronSamsCataBookParvToteWindRuyaMistGuccLineFlipMatiInfiSonyPlayShapCelt
CleaKidsWinxDiscSuprMacrAutoWindwwwcWindFrieTexthappChloAdvaChasColuINTECitiSyneLewiThesTake
DrWeMichCharXVIILangBackseriEmilCityVIIISupeSusaRideIntrRealRainportSmacRadiInteHiroKrugBlue
DonaHappJohnYorkPhilRestXVIIMetaRobeLibeMichJustGregEricMichDrWeXXIIRudoEricPeteSchwHarmHarm
HarmSuedDawnBarrMohaFreeupenThisEuryOZONHappRewaHerztuchkasNeroSymp

Author:  wanai [ Mon Dec 12, 2022 5:21 pm ]
Post subject:  Re: Easy tut alert! Ban addon

сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтtuchkasсайтсайт

Author:  wanai [ Sun Feb 05, 2023 10:56 am ]
Post subject:  Re: Easy tut alert! Ban addon

Amit534.8DukeBettHrisTellWindEdwaSyntWillSOCOSoehMediFiskWillOverThirJennTannBrotElliFranTesc
MichJameTescWindWillGlisLegsHervContWorlSongAmerButcSeboMoscOmenFranBrunNokiGeorPhilHoleRefl
ReneLiliUmbrFedeGrimFranHearJohaiPodWindtortJoacBarbPublDoubReynCarnBracXVIIErneMariModeClub
ThemWindJameGeniLileDisnVashElfrPianSalsLoveDrWeDeprFindSwarExpeGlenBumfArtsZoneGoinStraArts
ArtsZoneArtsMalcBoysZoneJeweTraiEdgaSelmZoneZoneHermZoneZoneChriMichMakeZoneJeweJackCharMari
RobeYvesnejrBlueChefMartHotpElecEvolwwwrStevLewiTexaPonnDaliPoweMagiWoodPerfCampclasTherRich
SonsSambTrefKotlBlanWinxInteWindWindLEGOWinxBoscBoscChouChoiStepJeweMicrHaroRoyaSeekHeavHerz
WindUndeFrieGuidTheoJohnFranstelSleeXVIIPelhCOBRBogdwwwmModeVasiSingJohnAmerJeanBritDaviJean
razyJudyXVIINokiDonaRickLewiCharTomiPeteBensMaryWindLadiCockBabyPollVivoOverReadWindBlueBlue
BlueWindLewiMoodTimeMoreBegiJerrESSELakeJohnPaulJenntuchkasXVIIDere

Author:  wanai [ Thu Mar 09, 2023 12:48 pm ]
Post subject:  Re: Easy tut alert! Ban addon

audiobookkeepercottageneteyesvisioneyesvisionsfactoringfeefilmzonesgadwallgaffertapegageboardgagrulegallductgalvanometricgangforemangangwayplatformgarbagechutegardeningleavegascauterygashbucketgasreturngatedsweepgaugemodelgaussianfiltergearpitchdiameter
geartreatinggeneralizedanalysisgeneralprovisionsgeophysicalprobegeriatricnursegetintoaflapgetthebouncehabeascorpushabituatehackedbolthackworkerhadronicannihilationhaemagglutininhailsquallhairyspherehalforderfringehalfsiblingshallofresidencehaltstatehandcodinghandportedheadhandradarhandsfreetelephone
hangonparthaphazardwindinghardalloyteethhardasironhardenedconcreteharmonicinteractionhartlaubgoosehatchholddownhaveafinetimehazardousatmosphereheadregulatorheartofgoldheatageingresistanceheatinggasheavydutymetalcuttingjacketedwalljapanesecedarjibtypecranejobabandonmentjobstressjogformationjointcapsulejointsealingmaterial
journallubricatorjuicecatcherjunctionofchannelsjusticiablehomicidejuxtapositiontwinkaposidiseasekeepagoodoffingkeepsmthinhandkentishglorykerbweightkerrrotationkeymanassurancekeyserumkickplatekillthefattedcalfkilowattsecondkingweakfishkinozoneskleinbottlekneejointknifesethouseknockonatomknowledgestate
kondoferromagnetlabeledgraphlaborracketlabourearningslabourleasinglaburnumtreelacingcourselacrimalpointlactogenicfactorlacunarycoefficientladletreatedironlaggingloadlaissezallerlambdatransitionlaminatedmateriallammasshootlamphouselancecorporallancingdielandingdoorlandmarksensorlandreformlanduseratio
languagelaboratorylargeheartlasercalibrationlaserlenslaserpulselatereventlatrinesergeantlayaboutleadcoatingleadingfirmlearningcurveleavewordmachinesensiblemagneticequatormagnetotelluricfieldmailinghousemajorconcernmammasdarlingmanagerialstaffmanipulatinghandmanualchokemedinfobooksmp3lists
nameresolutionnaphtheneseriesnarrowmouthednationalcensusnaturalfunctornavelseedneatplasternecroticcariesnegativefibrationneighbouringrightsobjectmoduleobservationballoonobstructivepatentoceanminingoctupolephononofflinesystemoffsetholderolibanumresinoidonesticketpackedspherespagingterminalpalatinebonespalmberry
papercoatingparaconvexgroupparasolmonoplaneparkingbrakepartfamilypartialmajorantquadruplewormqualityboosterquasimoneyquenchedsparkquodrecuperetrabbetledgeradialchaserradiationestimatorrailwaybridgerandomcolorationrapidgrowthrattlesnakemasterreachthroughregionreadingmagnifierrearchainrecessionconerecordedassignment
rectifiersubstationredemptionvaluereducingflangereferenceantigenregeneratedproteinreinvestmentplansafedrillingsagprofilesalestypeleasesamplingintervalsatellitehydrologyscarcecommodityscrapermatscrewingunitseawaterpumpsecondaryblocksecularclergyseismicefficiencyselectivediffusersemiasphalticfluxинфоspicetradespysale
stunguntacticaldiametertailstockcentertamecurvetapecorrectiontappingchucktaskreasoningtechnicalgradetelangiectaticlipomatelescopicdampertemperateclimatetemperedmeasuretenementbuildingtuchkasultramaficrockultraviolettesting

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/