Author Topic: HELP: !kill, !unstuck commands not working properly  (Read 2202 times)

0 Members and 1 Guest are viewing this topic.

Offline Bobby de Kok

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
  • Im a proud owner of SkorpionServers.tk
    • Most popular server
HELP: !kill, !unstuck commands not working properly
« on: March 01, 2015, 05:54:17 AM »
Hi all, im new to this forum, bu so far it has helped me alot!
My server is always on Motel_Blacke_V3.
The ploblem is that there is room under the map, so sometimes when players use !unstuck it places them under the map :(
So i made an ulx command for !kill so when players glitch under the map they can kill themselfs.
somehow it works but when its working it disables all the other commands like !untsuck and autorejoin.
Then it is the only command thats working.
This is the code im using:

function MyCommandF( ply, text )
   if ( string.sub( text, 1, 8 ) == "!kill" ) then
      ply:Kill()
   end
   return false
end
hook.Add( "PlayerSay", "MyCommandH", MyCommandF )

Help?

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: HELP: !kill, !unstuck commands not working properly
« Reply #1 on: March 01, 2015, 09:02:34 AM »
Put the "return false" inside the if statement (line 3)

The way you have it now, it will show what you typed in chat if you typed !kill
And if you typed something else, it will not show it no matter what

Also, on line 2 of that code (where the if statement starts), you can change the 8 to a 5 because !kill is only 5 characters

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: HELP: !kill, !unstuck commands not working properly
« Reply #2 on: March 01, 2015, 09:54:07 AM »
Additionally, that's not a ulx command.
It's a chat command yes, but ulx has no control over it.
No big deal, just pointing that out.

I'd also consider it a command that isn't necessary.
Gmod (and source servers in general) have a 'kill' command that people can type in console to do the same thing.

Seems to me so many people are uneducated about using game console even though so much can be done from there (including ULX's autocomplete feature)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Bobby de Kok

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
  • Im a proud owner of SkorpionServers.tk
    • Most popular server
Re: HELP: !kill, !unstuck commands not working properly
« Reply #3 on: March 02, 2015, 10:52:27 AM »
Thanks! It works now :)