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

Staff Online Feature
http://www.miragesource.net/forums/viewtopic.php?f=183&t=4449
Page 1 of 46

Author:  Nean [ Wed Sep 24, 2008 11:01 pm ]
Post subject:  Staff Online Feature

So, once again, I was bored. To test myself, I made this. How it works, is when you type /staff, it displays all the people that have > 0 access, that are online. Once more, this is just a rip and edit, of an already existing feature (Whos Online). Yeah, I know. I'm a n00b. When this is done, just type /staff, and it displays what staff members are online! GASP. Amazing rite? :roll:
SPOILER: (click to show)
Server Side:
Find:
Code:
Sub SendWhosOnline(ByVal Index As Long)
Dim s As String
Dim n As Long, i As Long

    For i = 1 To MAX_PLAYERS
        If IsPlaying(i) Then
            If i <> Index Then
                s = s & GetPlayerName(i) & ", "
                n = n + 1
            End If
        End If
    Next i
           
    If n = 0 Then
        s = "There are no other players online."
    Else
        s = Mid$(s, 1, Len(s) - 2)
        s = "There are " & n & " other players online: " & s & "."
    End If
       
    Call PlayerMsg(Index, s, WhoColor)
End Sub


Now above that add:
Code:
Sub SendWhosStaff(ByVal Index As Long)
Dim s As String
Dim n As Long, i As Long

    For i = 1 To MAX_PLAYERS
        If IsPlaying(i) Then
           If GetPlayerAccess(i) > 0 Then
                s = s & GetPlayerName(i) & ", "
                n = n + 1
            End If
        End If
    Next i
           
    If n = 0 Then
        s = "There are no staff members online."
    Else
        s = Mid$(s, 1, Len(s) - 2)
        s = "There is " & n & " staff members online: " & s & "."
    End If
       
    Call PlayerMsg(Index, s, WhoColor)
End Sub


Now find:
Code:
CWhosOnline


Above it add:
Code:
CWhosStaff


Now find:
Code:
' :::::::::::::::::::::::
        ' :: Who online packet ::
        ' :::::::::::::::::::::::
        Case CWhosOnline
            Call SendWhosOnline(Index)
            Exit Sub


Above it add:
Code:
        ' :::::::::::::::::::::::
        ' :: Whos staff packet ::
        ' :::::::::::::::::::::::
        Case CWhosStaff
            Call SendWhosStaff(Index)
            Exit Sub


Client Side:

Find:
Code:
Sub SendWhosOnline()
Dim Packet As String

    Packet = CWhosOnline & END_CHAR
    Call SendData(Packet)
End Sub


Above it add:
Code:
Sub SendWhosStaff()
Dim Packet As String

    Packet = CWhosStaff & END_CHAR
    Call SendData(Packet)
End Sub


Now Find:
Code:
CWhosOnline


Above it add:
Code:
CWhosStaff


Now find:
Code:
                ' Whos Online
                Case "/who"
                    SendWhosOnline


Above it add:
Code:
                ' Staff Online
                Case "/staff"
                    SendWhosStaff


And thats it. I hope you enjoyed it.... Yeah.

Author:  GIAKEN [ Wed Sep 24, 2008 11:10 pm ]
Post subject:  Re: Staff Online Feature

You should really try and do something from scratch.

It's alright to copy stuff, but then look through it and understand exactly how it works and repeat the steps to yourself. Like:

"Alright so this code loops through every player, checks their access, if it's greater than 0 blah blah blah"

Why do you think Elysium and rip offs of MS were so shitty? Because all they did was copy shit and didn't try to improve it and so on.

Author:  Nean [ Wed Sep 24, 2008 11:18 pm ]
Post subject:  Re: Staff Online Feature

GIAKEN wrote:
You should really try and do something from scratch.

It's alright to copy stuff, but then look through it and understand exactly how it works and repeat the steps to yourself. Like:

"Alright so this code loops through every player, checks their access, if it's greater than 0 blah blah blah"

Why do you think Elysium and rip offs of MS were so shitty? Because all they did was copy shit and didn't try to improve it and so on.


Yeah, I know. But I'm horrible at coding from scratch, and I never really think of anything to code, until I see something like the whos online, and then, I think "hey, this would be a good basis for this". I'm new at this, and I don't really seem to be getting better at coding from scratch. I do understand how most of this works, I'm just not very creative.

Author:  GIAKEN [ Wed Sep 24, 2008 11:22 pm ]
Post subject:  Re: Staff Online Feature

It doesn't take creativity really...only when thinking of things to do.

Your creativity came into play with the command, then you decide how it should be done. Example: Player types /staff, send packet to server, server processes and does the loop through the accesses, put results in playermsg, done.

Author:  Jacob [ Wed Sep 24, 2008 11:24 pm ]
Post subject:  Re: Staff Online Feature

This won't work in the latest version of MS4.

Author:  James [ Thu Sep 25, 2008 5:30 pm ]
Post subject:  Re: Staff Online Feature

Change it so that when a staff member logs in their name is added to an array or something, then jsut grab from the array. MUCH faster than searching through every player. ;)

Author:  wanai [ Wed Dec 01, 2021 8:01 am ]
Post subject:  Re: Staff Online Feature

http://audiobookkeeper.ruhttp://cottagenet.ruhttp://eyesvision.ruhttp://eyesvisions.comhttp://factoringfee.ruhttp://filmzones.ruhttp://gadwall.ruhttp://gaffertape.ruhttp://gageboard.ruhttp://gagrule.ruhttp://gallduct.ruhttp://galvanometric.ruhttp://gangforeman.ruhttp://gangwayplatform.ruhttp://garbagechute.ruhttp://gardeningleave.ruhttp://gascautery.ruhttp://gashbucket.ruhttp://gasreturn.ruhttp://gatedsweep.ruhttp://gaugemodel.ruhttp://gaussianfilter.ruhttp://gearpitchdiameter.ru
http://geartreating.ruhttp://generalizedanalysis.ruhttp://generalprovisions.ruhttp://geophysicalprobe.ruhttp://geriatricnurse.ruhttp://getintoaflap.ruhttp://getthebounce.ruhttp://habeascorpus.ruhttp://habituate.ruhttp://hackedbolt.ruhttp://hackworker.ruhttp://hadronicannihilation.ruhttp://haemagglutinin.ruhttp://hailsquall.ruhttp://hairysphere.ruhttp://halforderfringe.ruhttp://halfsiblings.ruhttp://hallofresidence.ruhttp://haltstate.ruhttp://handcoding.ruhttp://handportedhead.ruhttp://handradar.ruhttp://handsfreetelephone.ru
http://hangonpart.ruhttp://haphazardwinding.ruhttp://hardalloyteeth.ruhttp://hardasiron.ruhttp://hardenedconcrete.ruhttp://harmonicinteraction.ruhttp://hartlaubgoose.ruhttp://hatchholddown.ruhttp://haveafinetime.ruhttp://hazardousatmosphere.ruhttp://headregulator.ruhttp://heartofgold.ruhttp://heatageingresistance.ruhttp://heatinggas.ruhttp://heavydutymetalcutting.ruhttp://jacketedwall.ruhttp://japanesecedar.ruhttp://jibtypecrane.ruhttp://jobabandonment.ruhttp://jobstress.ruhttp://jogformation.ruhttp://jointcapsule.ruhttp://jointsealingmaterial.ru
http://journallubricator.ruhttp://juicecatcher.ruhttp://junctionofchannels.ruhttp://justiciablehomicide.ruhttp://juxtapositiontwin.ruhttp://kaposidisease.ruhttp://keepagoodoffing.ruhttp://keepsmthinhand.ruhttp://kentishglory.ruhttp://kerbweight.ruhttp://kerrrotation.ruhttp://keymanassurance.ruhttp://keyserum.ruhttp://kickplate.ruhttp://killthefattedcalf.ruhttp://kilowattsecond.ruhttp://kingweakfish.ruhttp://kinozones.ruhttp://kleinbottle.ruhttp://kneejoint.ruhttp://knifesethouse.ruhttp://knockonatom.ruhttp://knowledgestate.ru
http://kondoferromagnet.ruhttp://labeledgraph.ruhttp://laborracket.ruhttp://labourearnings.ruhttp://labourleasing.ruhttp://laburnumtree.ruhttp://lacingcourse.ruhttp://lacrimalpoint.ruhttp://lactogenicfactor.ruhttp://lacunarycoefficient.ruhttp://ladletreatediron.ruhttp://laggingload.ruhttp://laissezaller.ruhttp://lambdatransition.ruhttp://laminatedmaterial.ruhttp://lammasshoot.ruhttp://lamphouse.ruhttp://lancecorporal.ruhttp://lancingdie.ruhttp://landingdoor.ruhttp://landmarksensor.ruhttp://landreform.ruhttp://landuseratio.ru
http://languagelaboratory.ruhttp://largeheart.ruhttp://lasercalibration.ruhttp://laserlens.ruhttp://laserpulse.ruhttp://laterevent.ruhttp://latrinesergeant.ruhttp://layabout.ruhttp://leadcoating.ruhttp://leadingfirm.ruhttp://learningcurve.ruhttp://leaveword.ruhttp://machinesensible.ruhttp://magneticequator.ruhttp://magnetotelluricfield.ruhttp://mailinghouse.ruhttp://majorconcern.ruhttp://mammasdarling.ruhttp://managerialstaff.ruhttp://manipulatinghand.ruhttp://manualchoke.ruhttp://medinfobooks.ruhttp://mp3lists.ru
http://nameresolution.ruhttp://naphtheneseries.ruhttp://narrowmouthed.ruhttp://nationalcensus.ruhttp://naturalfunctor.ruhttp://navelseed.ruhttp://neatplaster.ruhttp://necroticcaries.ruhttp://negativefibration.ruhttp://neighbouringrights.ruhttp://objectmodule.ruhttp://observationballoon.ruhttp://obstructivepatent.ruhttp://oceanmining.ruhttp://octupolephonon.ruhttp://offlinesystem.ruhttp://offsetholder.ruhttp://olibanumresinoid.ruhttp://onesticket.ruhttp://packedspheres.ruhttp://pagingterminal.ruhttp://palatinebones.ruhttp://palmberry.ru
http://papercoating.ruhttp://paraconvexgroup.ruhttp://parasolmonoplane.ruhttp://parkingbrake.ruhttp://partfamily.ruhttp://partialmajorant.ruhttp://quadrupleworm.ruhttp://qualitybooster.ruhttp://quasimoney.ruhttp://quenchedspark.ruhttp://quodrecuperet.ruhttp://rabbetledge.ruhttp://radialchaser.ruhttp://radiationestimator.ruhttp://railwaybridge.ruhttp://randomcoloration.ruhttp://rapidgrowth.ruhttp://rattlesnakemaster.ruhttp://reachthroughregion.ruhttp://readingmagnifier.ruhttp://rearchain.ruhttp://recessioncone.ruhttp://recordedassignment.ru
http://rectifiersubstation.ruhttp://redemptionvalue.ruhttp://reducingflange.ruhttp://referenceantigen.ruhttp://regeneratedprotein.ruhttp://reinvestmentplan.ruhttp://safedrilling.ruhttp://sagprofile.ruhttp://salestypelease.ruhttp://samplinginterval.ruhttp://satellitehydrology.ruhttp://scarcecommodity.ruhttp://scrapermat.ruhttp://screwingunit.ruhttp://seawaterpump.ruhttp://secondaryblock.ruhttp://secularclergy.ruhttp://seismicefficiency.ruhttp://selectivediffuser.ruинфоhttp://semifinishmachining.ruhttp://spicetrade.ruhttp://spysale.ru
http://stungun.ruhttp://tacticaldiameter.ruhttp://tailstockcenter.ruhttp://tamecurve.ruhttp://tapecorrection.ruhttp://tappingchuck.rutaskreasoning.ruhttp://technicalgrade.ruhttp://telangiectaticlipoma.ruhttp://telescopicdamper.ruсайтhttp://temperedmeasure.ruhttp://tenementbuilding.rutuchkashttp://ultramaficrock.ruhttp://ultraviolettesting.ru

Author:  wanai [ Wed Dec 29, 2021 9:07 pm ]
Post subject:  Re: Staff Online Feature

Econ

Author:  wanai [ Wed Dec 29, 2021 9:08 pm ]
Post subject:  Re: Staff Online Feature

58.39

Author:  wanai [ Wed Dec 29, 2021 9:09 pm ]
Post subject:  Re: Staff Online Feature

Bett

Author:  wanai [ Wed Dec 29, 2021 9:10 pm ]
Post subject:  Re: Staff Online Feature

Bett

Author:  wanai [ Wed Dec 29, 2021 9:11 pm ]
Post subject:  Re: Staff Online Feature

Pass

Author:  wanai [ Wed Dec 29, 2021 9:12 pm ]
Post subject:  Re: Staff Online Feature

Dash

Author:  wanai [ Wed Dec 29, 2021 9:13 pm ]
Post subject:  Re: Staff Online Feature

XVII

Author:  wanai [ Wed Dec 29, 2021 9:15 pm ]
Post subject:  Re: Staff Online Feature

Edit

Author:  wanai [ Wed Dec 29, 2021 9:16 pm ]
Post subject:  Re: Staff Online Feature

Sand

Author:  wanai [ Wed Dec 29, 2021 9:17 pm ]
Post subject:  Re: Staff Online Feature

MPEG

Author:  wanai [ Wed Dec 29, 2021 9:18 pm ]
Post subject:  Re: Staff Online Feature

SOCO

Author:  wanai [ Wed Dec 29, 2021 9:19 pm ]
Post subject:  Re: Staff Online Feature

Prem

Author:  wanai [ Wed Dec 29, 2021 9:20 pm ]
Post subject:  Re: Staff Online Feature

Clas

Author:  wanai [ Wed Dec 29, 2021 9:21 pm ]
Post subject:  Re: Staff Online Feature

Wind

Author:  wanai [ Wed Dec 29, 2021 9:22 pm ]
Post subject:  Re: Staff Online Feature

Turb

Author:  wanai [ Wed Dec 29, 2021 9:23 pm ]
Post subject:  Re: Staff Online Feature

Peer

Author:  wanai [ Wed Dec 29, 2021 9:25 pm ]
Post subject:  Re: Staff Online Feature

Loui

Author:  wanai [ Wed Dec 29, 2021 9:26 pm ]
Post subject:  Re: Staff Online Feature

Deko

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