Mirage Source
Warn system - 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: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17)
+---- Thread: Warn system (/showthread.php?tid=2278)



Warn system - Nean - 21-10-2008

So, I know how to make a warning system out of getvars and putvars, however, without INI files, how would I do this? With Elysium's, sadscripting, it's easy enough. Anyone care to post a short example, or possibly explain it? Like I said, i think I could do it with putvars and getvars from an .ini file....


Re: Warn system - Nean - 21-10-2008

Lea Wrote:getvar and putvar write to ini files, so if you dont want to use ini files you wont be using those functions.

Gah. You're right. It's just that in Elysium, all the chars are stored in an .ini file, so that it's easy to make a warn system. So how would I make one, without the getvar and putvar?


Re: Warn system - Rian - 21-10-2008

Use these functions to Set and Retrieve a players warning level.

Code:
Function GetPlayerWarning(ByVal Index As Long) As Long
    GetPlayerWarning = Player(Index).Char(TempPlayer(Index).CharNum).Warning
End Function

Sub SetPlayerWarning(ByVal Index As Long, ByVal Warning As Byte)
    Player(Index).Char(TempPlayer(Index).CharNum).Warning = Warning
End Sub

Use a text command or something client side to warn a player. The server side packet should have something like:

Code:
Call SetPlayerWarning(Index, GetPlayerWarning(Index) + 1)

Then after that you could use a select case:

Code:
Select Case GetPlayerWarning(Index)
    Case 1
    ' Send them a message alerting them of their first warning

    Case 2
    ' They're second warning, kick them

    Case 3
    ' They're third warning, ban them
End Select

Don't forget to add the proper checks to the packet making sure the player giving the warning is an admin.


Re: Warn system - Nean - 21-10-2008

Sonire Wrote:Use these functions to Set and Retrieve a players warning level.

Code:
Function GetPlayerWarning(ByVal Index As Long) As Long
    GetPlayerWarning = Player(Index).Char(TempPlayer(Index).CharNum).Warning
End Function

Sub SetPlayerWarning(ByVal Index As Long, ByVal Warning As Byte)
    Player(Index).Char(TempPlayer(Index).CharNum).Warning = Warning
End Sub

Use a text command or something client side to warn a player. The server side packet should have something like:

Code:
Call SetPlayerWarning(Index, GetPlayerWarning(Index) + 1)

Then after that you could use a select case:

Code:
Select Case GetPlayerWarning(Index)
    Case 1
    ' Send them a message alerting them of their first warning

    Case 2
    ' They're second warning, kick them

    Case 3
    ' They're third warning, ban them
End Select

Don't forget to add the proper checks to the packet making sure the player giving the warning is an admin.


Awesome thanks. I'll start working on this tomorrow, and see what I can do.


Re: Warn system - Nean - 21-10-2008

I have everything done server side, except for the select case. Where would I put the select case in?


Re: Warn system - deathknight - 21-10-2008

If i added something like this, I'd need to delete my account and remake it so it would have a .warning in the account, correct? Is there any way around this?

Code:
Code: Select all
Function GetPlayerWarning(ByVal Index As Long) As Long
    GetPlayerWarning = Player(Index).Char(TempPlayer(Index).CharNum).Warning
End Function

Sub SetPlayerWarning(ByVal Index As Long, ByVal Warning As Byte)
    Player(Index).Char(TempPlayer(Index).CharNum).Warning = Warning
End Sub



Re: Warn system - Forte - 21-10-2008

you'd either have to delete accounts and remake them, or go into the ini and manually put in the 'warning = '


Re: Warn system - deathknight - 21-10-2008

Well, the big problem for me is I plan on using MS4 (eventually) so I'm trying to build the codes now so I can switch it over to the final version, whatever it happens to be, that I decide to use for my game, and MS4 saves in a .bin format. I'm clueless at how I'd make an editor. I could probably figure out how to edit it myself if i had the source for an editor for a vanilla MS4, but I doubt anyone has that or would be willing to get it.

So I figured it may be easier (if possible) to and an if statement on the sub that logs in the player to check to see if a certain part is in there, and if not add it. I haven't studied to much into the binary system, so I wouldn't know how to add this at all.


Re: Warn system - Nean - 21-10-2008

I now have Server and Client side done, but no Select Case. Still dunno where to put it. :|, should I put that in the packet itself?


Re: Warn system - Rian - 21-10-2008

Well, you don't exactly need the select case, I was just saying that's how I would do it.

Pseudo Code
Code:
Client side:

Text Command:
/WarnPlayer
Packet = "WARN" & SEP_CHAR & END_CHAR
Call SendData(Packet)

Server Side:

If LCase(Parse(0)) = "warn" Then

Select Case


So basically, I was talking about placing the Select Case in the server side packet that handles warning a player.


Re: Warn system - Nean - 21-10-2008

Sonire Wrote:Well, you don't exactly need the select case, I was just saying that's how I would do it.

Pseudo Code
Code:
Client side:

Text Command:
/WarnPlayer
Packet = "WARN" & SEP_CHAR & END_CHAR
Call SendData(Packet)

Server Side:

If LCase(Parse(0)) = "warn" Then

Select Case


So basically, I was talking about placing the Select Case in the server side packet that handles warning a player.
Ohhh, I see. Sounds good. Thanks. I'll try it out. Smile


Re: Warn system - Nean - 21-10-2008

Hmmm :/

Method or data member not found

Code:
Function GetPlayerWarning(ByVal Index As Long) As Long
    GetPlayerWarning = Player(Index).Char(TempPlayer(Index).CharNum).Warning
End Function

Here's my code:
[spoiler]Server Side
Code:
Function GetPlayerWarning(ByVal Index As Long) As Long
    GetPlayerWarning = Player(Index).Char(TempPlayer(Index).CharNum).Warning
End Function

Sub SetPlayerWarning(ByVal Index As Long, ByVal Warning As Byte)
    Player(Index).Char(TempPlayer(Index).CharNum).Warning = Warning
End Sub

Code:
Case CWarnPlayer
            HandleWarnPlayer Index, Parse

[code]' ::::::::::::::::::::::::
' :: Warn player packet ::
' ::::::::::::::::::::::::
Sub HandleWarnPlayer(ByVal Index As Long, ByRef Parse() As String)
Dim n As Long

' Prevent hacking
If GetPlayerAccess(Index)


Re: Warn system - GIAKEN - 21-10-2008

Go to PlayerRec and at the bottom add "Warning As Byte" then you need to delete your accounts.


Re: Warn system - Nean - 21-10-2008

RTE 9 on
Code:
GetPlayerWarning = Player(Index).Char(TempPlayer(Index).CharNum).Warning

I'm getting closer... :|. Thanks for bearing with my inability to get anything right Wink

I thought I'd have to add something to the player rec, I added that to both the client and server side


Re: Warn system - Nean - 21-10-2008

DFA Wrote:Neon, find all the confirmed bugs on the forum for the latest version of MS4, test em out make sure its actually a bug, then link that thread into
viewtopic.php?f=120&t=4549

when we got a hefty "to-do" list and these lazy fuckers wont help, i'll get to it eventually.

Done. =)


Re: Warn system - Nean - 22-10-2008

With Giaken's help, I managed to get this working. I'll write a tutorial, when the new MS4 comes out.