Ulysses

General => Developers Corner => Topic started by: Bobby de Kok on March 22, 2015, 03:42:56 AM

Title: !kill command Help
Post by: Bobby de Kok 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!
Title: Re: !kill command Help
Post by: Zmaster on March 22, 2015, 04:57:10 AM
For your !Kill question, use http://wiki.garrysmod.com/page/string/lower (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 (http://wiki.garrysmod.com/page/Player/Alive)

See if you can input those into your code
Title: Re: !kill command Help
Post by: Bobby de Kok 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