Neth Posted July 25, 2009 Author Share Posted July 25, 2009 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 More sharing options...
Kimimaru Posted July 25, 2009 Share Posted July 25, 2009 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 IfExit SubCase "/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 IfExit SubEnd 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 More sharing options...
Jed Posted July 25, 2009 Share Posted July 25, 2009 I'm not sure that would work, it might just set your HP to 0, but it may just recover or something. best to try like "Call KillPlayer(Index)" or something. Link to comment Share on other sites More sharing options...
Neth Posted July 25, 2009 Author Share Posted July 25, 2009 Alright thanks. Link to comment Share on other sites More sharing options...
Kimimaru Posted July 25, 2009 Share Posted July 25, 2009 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 More sharing options...
Kimimaru Posted August 4, 2009 Share Posted August 4, 2009 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 = vbNullStringEnd 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now