Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

A Kill Button Ingame


Neth
 Share

Recommended Posts

I'm currently making some buttons for a GM ingame so it will make things easier for some things and I'm trying to make a kill button to where it finds the GM's target when he hits kill and kills the player.
I have tried it myself and since I'm new and don't know anything I can't get it to work.

Thanks.
Link to comment
Share on other sites

This is pretty simple to do, but right now, it's pretty late where I am, and I don't have time to make it work for a button. I've made it work as a command, though. Change the specific part of the Main.txt to look like this:

```
Case "/warpto"
If GetPlayerAccess(Index) > 0 Then
MapNum = TextSay(1)

If MapNum > 0 And MapNum <= MAX_MAPS Then
Call PlayerWarp(Index, MapNum, GetPlayerX(Index), GetPlayerY(Index))
Call PlayerMsg(Index, "You have been warped to map #" & MapNum & ".", BRIGHTBLUE)
Else
Call PlayerMsg(Index, "Invalid map number.", BRIGHTRED)
End If
End If
Exit Sub

Case "/kill"
If GetPlayerAccess(Index) > 1 Then
    PlayerID = FindPlayer(TextSay(1))

  If PlayerID > 0 Then

Call SetPlayerHP(PlayerID, 0)
                          Call SendStats(PlayerID)
  Else
Call PlayerMsg(Index, "Player is not online.", WHITE)
  End If
End If
Exit Sub
End Select
```
This makes it so that if you type "/kill (playerusername)" the player whose username you typed in would die. Here's an example:

"/kill Kimimaru"

In this case, my HP would be set to 0, therefore killing me. **Please note that I haven't tested this script out yet, but it should work fine.** I may be able to help you more tomorrow, but I'm not sure. You can use this for now until someone comes along and helps you program a button. If this script doesn't work but you like it, I can fix it up tomorrow.
Link to comment
Share on other sites

I've edited the code in my original post. I included a **Call SendStats** command so that it updates the player's hp when it gets set to 0.

As for the **Call KillPlayer** command, I looked and couldn't find anything of the sort. For the Kill tile on the mapeditor, they do the same thing that I did. Slowing down the HP regeneration rate on your Server may help. Additionally, if the player keeps regenerating HP and not dieing, we can add in a loop to ensure that their HP is set to 0.

EDIT: I'll try to help you with the actual button if I get any time. I'm currently busy working on something and having troubles of my own, sorry.
Link to comment
Share on other sites

  • 2 weeks later...
Okay, here's how to do the button:

Keep the "/kill" script that I posted on another post. Here we go:

Make a command button somewhere on your game. Name it whatever you want, but for now, we'll call it _Button_.

Double-click on the command button, and make its Sub look like this:

```
Public Sub Button_Click()
Call SendData("checkcommands" & SEP_CHAR & "/kill" & END_CHAR)
MyText = vbNullString
End Sub
```
You'd probably need to add in a system of typing who you want to kill, but tell me if you need help with that.

That should be all that you need to do. Please post any problems here. Also, both the "/kill" command and the button will work.

Good luck!

By the way, sorry for the long wait; I was pretty busy.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...