• Am i using lua correctly?
    4 replies, posted
I have used Lua in a different game, but Lua differs in alot of different games, so i need someone to check if this code is working right. [code] function PlayerPlltxe(Player, Text) if aconcmd = poop then print("Text") else return false end hook.Add("PlayerSay", "PlayerPlltxe", PlayerPlltxe) concommand.Add("Set_aconcmd",aconcmd) [/code]
Your concommand.Add line is messed up, call the function instead.
Why are you using a hook and a console command?
What exactly are you trying to do with that code? It looks completely buggered up.
[QUOTE=chaser-the-wolf;19067244]I have used Lua in a different game, but Lua differs in alot of different games, so i need someone to check if this code is working right. [code] function PlayerPlltxe(Player, Text) if aconcmd = poop then print("Text") else return false end hook.Add("PlayerSay", "PlayerPlltxe", PlayerPlltxe) concommand.Add("Set_aconcmd",aconcmd) [/code][/QUOTE] [lua] hook.Add("PlayerSay", "PlayerPLLTXE", function(p,t) if( t == "poop" ) then print("HE SAID POOP! OMG HE TOTALLY SAID POOP! :\)"); end end) [/lua] Shouldn't return false in the player say hook or no text will get through to the chat except "poop".
Sorry, you need to Log In to post a reply to this thread.