Hello,
I made some Entities that Ignite and get Destroyed after loosing a certain amount of HP for StarWarsRP now i want to make something that blocks /comms
This is what i have it works mostly only problem is that instead of blocking only /comms it blocks everything so you cant type at all
function ENT:OnTakeDamage(dmg)
if (self:Health() <= 0) then return end
self:SetHealth( self:Health() - dmg:GetDamage() )
print( self:Health() )
if(self:Health() <= 0) then
self:Ignite( 999 )
self:SetNWBool("off", true)
hook.Add("PlayerSay", "PlayerSayComms", function(ply, text)
text = string.lower(text)
if(self:Health() <= 0) then
if not (text == "/comms") then return ""
end
end end)
local x = DarkRP.chatCommands
for k, ply in pairs( player.GetAll() ) do
ply:ChatPrint( "[Comms] are Offline" )
end
end
end
Try removing the not in
if not (text == "/comms") then return ""
When i do that everything works doesnt matter if destroyed or not so that doesnt work
Try:
if string.StartWith(text, "/comms") then return ""
Works like a charm thank you!
You can make something like that.
when some one try to type your "blocking command" it's close his chat. And he need to open the chat again to type something else.
if ( string.StartWith(text, "/comms") ) then
chat.Close()
end
try this too . i hope that helps you !
Sorry, you need to Log In to post a reply to this thread.