Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Semi-Advanced Warn System Difficulty 2/5 (C&P)
#1
Okay, so the other day, I got bored and tried to write one from scratch, needless to say it was a success. I'm pretty confident in it, as it seemed to work quite well, though I'd appreciate it if someone with a bit more knowledge than I, took a look at it to see if there was any potential bugs or problems. The good thing about this is, that it keeps track of the players warn level. So all you need to do is /warn the player. First warning sends a text warn. Second a kick, and the third a good ol' ban. Enjoy, and remember I need some constructive criticism.

Server Side

[spoiler]Find
Code:
CQuit

Under it add:

Code:
CSetWarn

Then Find:

Code:
Sub SetPlayerPK(ByVal Index As Long, ByVal PK As Long)
    Player(Index).Char(TempPlayer(Index).CharNum).PK = PK
End Sub

Under it add:
Code:
Function GetPlayerWarn(ByVal Index As Long) As Long
    GetPlayerWarn = Player(Index).Char(TempPlayer(Index).CharNum).Warn
End Function

Sub SetPlayerWarn(ByVal Index As Long, ByVal Warn As Long)
    Player(Index).Char(TempPlayer(Index).CharNum).Warn = Warn
End Sub

Then Find
Code:
Case Else
            GoTo ErrorHandle ' packet not found

Above it add:

Code:
Case CSetWarn
            HandleSetWarn Index, Parse

Then Find:
Code:
' :::::::::::::::::::::::
' :: Set sprite packet ::
' :::::::::::::::::::::::
Private Sub HandleSetSprite(ByVal Index As Long, ByRef Parse() As String)
Dim N As Long

    ' Prevent hacking
    If GetPlayerAccess(Index) < ADMIN_MAPPER Then
        Call HackingAttempt(Index, "Admin Cloning")
        Exit Sub
    End If
    
    ' The sprite
    N = CLng(Parse(1))
    
    Call SetPlayerSprite(Index, N)
    Call SendPlayerData(Index)
    Exit Sub
End Sub

And under that add:
Code:
' :::::::::::::::::::::::
' :: Set Warn packet ::
' :::::::::::::::::::::::
Sub HandleSetWarn(ByVal Index As Long, _
                  ByRef Parse() As String)
    Dim N As Long

    N = FindPlayer(Parse(1))
    
    If N > 0 Then
        If N  Index Then

            Select Case GetPlayerWarn(N) + 1

                Case 1
                    Call SetPlayerWarn(N, 1)
                    'Call SetPlayerWarn(n, GetPlayerWarn(n) + 1)
                    Call PlayerMsg(Index, "You have received your first warning, for breaking the rules. Your second will result in a kick!", Blue)

                Case 2
                    Call SetPlayerWarn(N, GetPlayerWarn(N) + 1)
                    Call AlertMsg(Index, "You have received your second warning. Your third will result in a ban")

                Case 3
                    Call SetPlayerWarn(N, GetPlayerWarn(N) + 1)
                    Call BanIndex(N, Index)
            End Select

        Else
            Call PlayerMsg(Index, "You can't warn yourself!", BrightRed)
        End If

    Else
        Call PlayerMsg(Index, "Player Isn't Online!", BrightRed)
    End If

End Sub

Then in the player rec find:
Code:
PK As Byte

Under that add:
Code:
Warn As Byte
[/spoiler]

Client Side

[spoiler]Find:
Code:
Case "/setaccess"
                    If GetPlayerAccess(MyIndex) < ADMIN_CREATOR Then
                        AddText "You need to be a high enough staff member to do this!", AlertColor
                        GoTo Continue
                    End If
                    
                    If UBound(Command) < 2 Then
                        AddText "Usage: /setaccess (name) (access)", AlertColor
                        GoTo Continue
                    End If
                    
                    If IsNumeric(Command(1)) = True Or IsNumeric(Command(2)) = False Then
                        AddText "Usage: /setaccess (name) (access)", AlertColor
                        GoTo Continue
                    End If
                    
                    SendSetAccess Command(1), CLng(Command(2))

Under it add:
Code:
Case "/warn"
                    If GetPlayerAccess(MyIndex) < ADMIN_CREATOR Then
                        AddText "You need to be a high enough staff member to do this!", AlertColor
                        GoTo Continue
                    End If
                    
                    If UBound(Command) < 1 Then
                        AddText "Usage: /warn (name)", AlertColor
                        GoTo Continue
                    End If
                    
                    If IsNumeric(Command(1)) = True Then
                        AddText "Usage: /warn (name)", AlertColor
                        GoTo Continue
                    End If
                    
                    SendSetWarn Command(1)

Then find:
Code:
Sub SendSetAccess(ByVal Name As String, ByVal Access As Byte)
Dim Packet As String

    Packet = CSetAccess & SEP_CHAR & Name & SEP_CHAR & Access & END_CHAR
    Call SendData(Packet)
End Sub

Under it add:
Code:
Sub SendSetWarn(ByVal Name As String)
Dim Packet As String

    Packet = CSetWarn & SEP_CHAR & Name & END_CHAR
    Call SendData(Packet)
End Sub

Then find:
Code:
CQuit

Under it add:
Code:
CSetWarn
[/spoiler]
That should be it. Give it a whirl, and drop me some feed back.
Reply
#2
No use to anyone?
Reply
#3
It's plenty useful, in fact I have a warn system that's nearly identical. Wink Here's a challenge for ya Nean, store a date on the player rec as well, and make the third warning a one day ban, and add a fourth warning that permanently bans them Big Grin
Reply
#4
Rian Wrote:It's plenty useful, in fact I have a warn system that's nearly identical. Wink Here's a challenge for ya Nean, store a date on the player rec as well, and make the third warning a one day ban, and add a fourth warning that permanently bans them Big Grin

Ooh. That might be tough... Even tougher it'll be to test it though, provided I can even remember. I'll try that challenge Rian, I'll try that. Big Grin
Reply
#5
Player.bandate = date
Player.bantime = time

Then all you gotta do is..

If bandate date and bantime < time then
unban
end if
Reply
#6
haha this is good ^^. another thing that would work with this would be a report system. To have players type the rule breaking players name in select a report option a picture be taken of the current situation and the text be save for that player. on serverside. and make it where a admin or moderator could look at the report and be able to press yes or no and if yes it warns the player mattering on the condition of the rule. ^^.
Reply
#7
How bout making it impossible to do the things in the first place to get you warned. Kind like (pardon the bad anology) locking the door, instead of calling the cops.

First make a list of everything that can get you warned/banned in your game.

Example

Spamming
Cursing (depends)
Hacking
Pissing you off


First lets look at spamming. A common type of spamming is sending the same text over and over again. This would be quite easy to check for, and is already in many games. Simply make a variable "lasttext" for the player and save their last message in it. When they send another message, if its the same, dont send it, and instead send them text saying 'you already said that'.
Also you can let people have an ignore command, so your players can simply ingore/block spammers, rendering them powerless to annoy.

Cursing, get a word filter, and make it clientside. Let people turn it on and off.

Hacking, get proper security.

Pissing you off: make an easy to access ban button client and serverside.
Reply
#8
haha sometimes there are glitches and some people like to take advantage of them and not tell you about them. the purpose of it would be allowing players to help out with the stuff you can't 100% cover.
Reply
#9
The post was not directed at you genusis. It was merely something for Nean to code, seeing as he wants to program stuff.

Wait, just realized your post could have not been directed at me also, which would make me seem idiotic. So, sorry if that is the case.

But anyway, i believe ed3 has a report system, its sadscript, but you can rip it from there.
Reply
#10
sadscript. ................... LMAO Worthless. if i was someone i would want my game to work well and fast so i would use a hardcoded one. I say no to sadscripts.
Reply
#11
genusis Wrote:sadscript. ................... LMAO Worthless. if i was someone i would want my game to work well and fast so i would use a hardcoded one. I say no to sadscripts.

You can convert sadscript codes to be hard coded.. Good god man, stop being retarded. You wanna see something worthless? Find a mirror and stare for awhile, shit.
Reply
#12
refrains from saying "What is wrong with the mirror."

Matt posted after me, and yet cursed someone else off!

Yea, so anyway, enough being stupid. VBScript (or sadscript) can basically, with little or no tweaks, just be copy pasted into vb6. If you really want it, what it does is have a report.txt serverside. When the server gets a message (because elysium has serverside command checking, you may move it to clientside if you want) it checks if the message starts with /report. If it does, then it takes all text after that, along with the player's name, and puts it in the report.txt. You simply check the report.txt, and see what people reported.
Reply
#13
Yeah, ignore and word censors will definitely be coded for the hell of it, when I get them done I'll make some tuts. I'm also converting most of my code to work with Elysium 3.3.2 for the hell of it...
Reply
#14
I spiffed up some of the code (fixed a few bugs), and it seems to work fine on the newest version on MS.
Reply
#15
genusis Wrote:sadscript. ................... LMAO Worthless. if i was someone i would want my game to work well and fast so i would use a hardcoded one. I say no to sadscripts.
Kid, you're a fucking moron. Any real game uses scripting for its events. Now sadscript may not be the best way to go, bt scripting is vital in any decent game. So don't go shouting stupid things in this section again, this section is for real men to discuss things.
Reply
#16
genusis Wrote:sadscript. ................... LMAO Worthless. if i was someone i would want my game to work well and fast so i would use a hardcoded one. I say no to sadscripts.

The way Elysium and all it's decendants use Sadscript is terrible, but using it properly it can be a very powerful tool.

Also, I laughed at 'Want my game to work well and fast'. Just look around at some of the code you've posted, son.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)