Ok...This code is for MS4, and what is does is if a admin with level 4 or higher access types "/kill (playernamehere)" they die, and get warped back to the starting area. I love MS4, it made making this code easier than it would have been in last MS. Anyway...
Difficulty: 1/5
::Client Side::In modGameLogic under the following code:
Code:
' // Commands //
' Help
If Mid$(MyText, 1, 5) = "/help" Then
Call AddText("Social Commands:", HelpColor)
Call AddText("'msghere = Broadcast Message", HelpColor)
Call AddText("-msghere = Emote Message", HelpColor)
Call AddText("!namehere msghere = Player Message", HelpColor)
Call AddText("Available Commands: /help, /info, /who, /fps, /inv, /stats, /train, /trade, /party, /join, /leave", HelpColor)
MyText = vbNullString
frmMirage.txtMyChat.Text = vbNullString
Exit Sub
End If
Add this:
Code:
' Kill player
If Mid$(MyText, 1, 5) = "/kill" Then
If Len(MyText) > 6 Then
MyText = Mid(MyText, 6, Len(MyText) - 5)
Call SendData(CKillPlayer & SEP_CHAR & MyText & END_CHAR)
End If
MyText = ""
Exit Sub
End If
Then in modEnumerations under the following code:
Code:
CGetClasses = 1
Add this:
Code:
CKillPlayer
::Server Side::In modHandleData at the bottom, but before "End Sub" and "End Select" add the following code:
Code:
' ::::::::::::::::::::::::
' :: Kill Player Packet ::
' ::::::::::::::::::::::::
Case CKillPlayer
' Prevent hacking...
If GetPlayerAccess(Index) < ADMIN_CREATOR Then
Call HackingAttempt(Index, "Admin Cloning")
Exit Sub
End If
n = FindPlayer(Parse(1))
If n <> Index Then
If n > 0 Then
'Sends messages out
Call PlayerMsg(n, "You have been killed by an admin.", BrightRed)
Call GlobalMsg(GetPlayerName(n) & " has been killed by an admin.", BrightRed)
'Warp to starting map
Call PlayerWarp(n, START_MAP, START_X, START_Y)
Call SetPlayerPK(Index, NO)
Else
Call PlayerMsg(Index, "Player is not online.", White)
End If
Else
Call PlayerMsg(Index, "You cannot kill yourself!", White)
End If
Exit Sub
Then in modEnumerations under the following code:
Code:
CGetClasses = 1
Add this:
Code:
CKillPlayer
All done!I tested this out, and it worked perfectly. If you find any problems or errors, I'll be more than happy to try to resolve them for you.
*update*
If you want it in button format use the code below. Just change the "Txtchar.Text" part to whatever text box name you want it to get the name of the player you want to kill.
Add this code rather than the "/kill" code above. Make sure you add ALL the other code in the tutorial above, you have to add everything else and it'll work.
Code:
Private Sub cmdkill_Click()
If GetPlayerAccess(MyIndex) >= ADMIN_MAPPER Then
Call SendData(CKillPlayer & SEP_CHAR & Txtchar.Text & END_CHAR)
End If
End Sub