| Mirage Source http://miragesource.net/forums/ |
|
| Warn system http://miragesource.net/forums/viewtopic.php?f=201&t=4601 |
Page 1 of 2 |
| Author: | Nean [ Tue Oct 21, 2008 12:11 am ] |
| Post subject: | Warn system |
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.... |
|
| Author: | Lea [ Tue Oct 21, 2008 1:56 am ] |
| Post subject: | Re: Warn system |
getvar and putvar write to ini files, so if you dont want to use ini files you wont be using those functions. |
|
| Author: | Nean [ Tue Oct 21, 2008 2:30 am ] |
| Post subject: | Re: Warn system |
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? |
|
| Author: | Rian [ Tue Oct 21, 2008 3:06 am ] |
| Post subject: | Re: Warn system |
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. |
|
| Author: | Nean [ Tue Oct 21, 2008 3:30 am ] |
| Post subject: | Re: Warn system |
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. |
|
| Author: | Nean [ Tue Oct 21, 2008 7:13 am ] |
| Post subject: | Re: Warn system |
I have everything done server side, except for the select case. Where would I put the select case in? |
|
| Author: | deathknight [ Tue Oct 21, 2008 10:10 am ] |
| Post subject: | Re: Warn system |
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 |
|
| Author: | Forte [ Tue Oct 21, 2008 11:11 am ] |
| Post subject: | Re: Warn system |
you'd either have to delete accounts and remake them, or go into the ini and manually put in the 'warning = ' |
|
| Author: | deathknight [ Tue Oct 21, 2008 12:54 pm ] |
| Post subject: | Re: Warn system |
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. |
|
| Author: | Nean [ Tue Oct 21, 2008 2:00 pm ] |
| Post subject: | Re: Warn system |
I now have Server and Client side done, but no Select Case. Still dunno where to put it. |
|
| Author: | Rian [ Tue Oct 21, 2008 3:08 pm ] |
| Post subject: | Re: Warn system |
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. |
|
| Author: | Nean [ Tue Oct 21, 2008 3:13 pm ] |
| Post subject: | Re: Warn system |
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. |
|
| Author: | Nean [ Tue Oct 21, 2008 3:26 pm ] |
| Post subject: | Re: Warn system |
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: (click to show)
|
|
| Author: | GIAKEN [ Tue Oct 21, 2008 3:39 pm ] |
| Post subject: | Re: Warn system |
Go to PlayerRec and at the bottom add "Warning As Byte" then you need to delete your accounts. |
|
| Author: | Nean [ Tue Oct 21, 2008 3:49 pm ] |
| Post subject: | Re: Warn system |
RTE 9 on Code: GetPlayerWarning = Player(Index).Char(TempPlayer(Index).CharNum).Warning I'm getting closer... I thought I'd have to add something to the player rec, I added that to both the client and server side |
|
| Author: | Nean [ Tue Oct 21, 2008 4:40 pm ] |
| Post subject: | Re: Warn system |
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. =) |
|
| Author: | Nean [ Wed Oct 22, 2008 2:13 am ] |
| Post subject: | Re: Warn system |
With Giaken's help, I managed to get this working. I'll write a tutorial, when the new MS4 comes out. |
|
| Page 1 of 2 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|