Author Topic: !kill command Help  (Read 2264 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
!kill command Help
« on: March 22, 2015, 03:42:56 AM »
Hi all,
Im wondering if theres a way to only make players use !kill when they are alive.
this way they wont be able to spam !kill when they are dead.
Also is there a way to not only make players suiside when they type !kill but also when they type !Kill
this is the code im using:
Quote
function MyCommandF( ply, text )
   if ( string.sub( text, 1, 5 ) == "!kill" ) then
      ply:Kill()
    return false
   end
   
end
hook.Add( "PlayerSay", "MyCommandH", MyCommandF )

Thanks!

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: !kill command Help
« Reply #1 on: March 22, 2015, 04:57:10 AM »
For your !Kill question, use http://wiki.garrysmod.com/page/string/lower
For making it only run when the player is alive, use this in the if statement http://wiki.garrysmod.com/page/Player/Alive

See if you can input those into your code

Offline Bobby de Kok

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
  • Im a proud owner of SkorpionServers.tk
    • Most popular server
Re: !kill command Help
« Reply #2 on: April 23, 2015, 12:49:55 PM »
I guess im a noob in lua.. but i tried and tried and still can get things to work