Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Software developped by Grex - sa-rl.de
- 'It's a RCON Tool for SAMP to administrate your SAMP-Server outside the game.
- 'This Software is free, changes on this program only for yourself. No release without my assent.
- 'Programm can be downloaded on http://files.sa-rl.de
- Public Class Main
- Sub rcon(ByVal cmd)
- If checksettings() = True Then
- txtPort.Text = CInt(txtPort.Text)
- Dim udpClient As New System.Net.Sockets.UdpClient
- udpClient.Connect(txtIP.Text, txtPort.Text)
- Dim newip() As String = Split(txtIP.Text, ".")
- Dim paket As String
- Dim newport, newrcon, newcmd As Integer
- newport = txtPort.Text / 2 ^ 8
- newrcon = txtRCON.TextLength / 2 ^ 8
- newcmd = Len(cmd) / 2 ^ 8
- paket = "SAMP" & Chr(newip(0)) & Chr(newip(1)) & Chr(newip(2)) & Chr(newip(3))
- paket = paket & Chr(CByte(txtPort.Text Mod 256)) & Chr(CByte(newport Mod 256))
- paket = paket & "x" & Chr(CByte(txtRCON.TextLength Mod 256)) & Chr(CByte(newrcon Mod 256)) & txtRCON.Text
- paket = paket & Chr(CByte(Len(cmd) Mod 256)) & Chr(CByte(newcmd Mod 256)) & cmd
- Dim sendBytes As [Byte]() = System.Text.Encoding.ASCII.GetBytes(paket)
- udpClient.Send(sendBytes, sendBytes.Length)
- udpClient.Close()
- MsgBox("Befehl erfolgreich gesendet")
- End If
- End Sub
- Public Function IsValidIP(ByVal addr As String) As Boolean
- Dim pattern As String = "^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\." & _
- "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$"
- Dim check As New System.Text.RegularExpressions.Regex(pattern)
- Dim valid As Boolean = False
- If addr = "" Then
- valid = False
- Else
- valid = check.IsMatch(addr, 0)
- End If
- Return valid
- End Function
- Private Sub btBan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btBan.Click
- If Ban.Checked = True Then
- rcon("banip " & txtBanIP.Text)
- ElseIf Unban.Checked = True Then
- rcon("unbanip " & txtBanIP.Text)
- Else
- MsgBox("Bitte Aktion auswählen")
- Exit Sub
- End If
- End Sub
- Private Sub btCheck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btCheck.Click
- If checksettings() = True Then
- MsgBox("Einstellungen sind im richtigem Format")
- txtServerIP.Text = txtIP.Text & ":" & txtPort.Text
- Servercontrol.Enabled = True
- IPControl.Enabled = True
- PlayerControl.Enabled = True
- GroupChangeRCON.Enabled = True
- End If
- End Sub
- Function checksettings()
- If IsValidIP(txtIP.Text) = False Then
- MsgBox("Die angegeben IP Adresse ist nicht gültig")
- Return False
- ElseIf txtPort.TextLength = 0 Or txtPort.Text > 65535 Then
- MsgBox("Der angegebene Port ist ungültig")
- Return False
- ElseIf txtRCON.TextLength = 0 Then
- MsgBox("Bitte geben Sie ein RCON Passwort ein")
- Return False
- End If
- Return True
- End Function
- Private Sub btRestart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btRestart.Click
- rcon("gmx")
- End Sub
- Private Sub btStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btStop.Click
- rcon("exit")
- End Sub
- Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- disable()
- End Sub
- Private Sub btChangeHostname_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btChangeHostname.Click
- If txtHostname.TextLength > 0 Then
- rcon("hostname " & txtHostname.Text)
- Else
- MsgBox("Bitte zuerst einen Hostnamen angeben")
- End If
- End Sub
- Private Sub btChangeMapname_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btChangeMapname.Click
- If txtMapname.TextLength > 0 Then
- rcon("mapname " & txtMapname.Text)
- Else
- MsgBox("Bitte zuerst einen Mapnamen angeben")
- End If
- End Sub
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- If txtGamemode.TextLength > 0 Then
- rcon("changemode " & txtGamemode.Text)
- Else
- MsgBox("Bitte zuerst einen Gamemode angeben")
- End If
- End Sub
- Private Sub btFilterscript_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btFilterscript.Click
- If txtFilterscript.TextLength > 0 Then
- If FilterscriptLoad.Checked = True Then
- rcon("loadfs " & txtFilterscript.Text)
- ElseIf FilterscriptReload.Checked = True Then
- rcon("reloadfs " & txtFilterscript.Text)
- ElseIf FilterscriptUnload.Checked = True Then
- rcon("unloadfs " & txtFilterscript.Text)
- Else : MsgBox("Bitte zuerst eine Aktion auswählen")
- End If
- End If
- End Sub
- Private Sub btWeatherChange_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btWeatherChange.Click
- If txtWeather.Text > 0 Then
- rcon("weather " & txtWeather.Text)
- End If
- End Sub
- Private Sub btChangeRCON_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btChangeRCON.Click
- If txtNewRcon.TextLength > 0 Then
- If txtNewRcon.Text = txtNewRconReply.Text Then
- rcon("rcon_password " & txtNewRcon.Text)
- disable()
- txtNewRcon.Text = ""
- txtNewRconReply.Text = ""
- End If
- End If
- End Sub
- Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
- Process.Start("http://sa-rl.de")
- End Sub
- Private Sub btClearServerlog_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btClearServerlog.Click
- rcon("reloadlog")
- End Sub
- Private Sub btRealoadbans_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btRealoadbans.Click
- rcon("reloadbans")
- End Sub
- Private Sub btHandlePlayer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btHandlePlayer.Click
- If txtPlayerid.TextLength > 0 Then
- If Kick.Checked = True Then
- rcon("kick " & txtPlayerid.Text)
- ElseIf IPBan.Checked = True Then
- rcon("ban " & txtPlayerid.Text)
- End If
- End If
- End Sub
- Sub disable()
- Servercontrol.Enabled = False
- IPControl.Enabled = False
- PlayerControl.Enabled = False
- GroupChangeRCON.Enabled = False
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement