• LITTLE HELP chat print read
    2 replies, posted
want it to read this "There is already a vote in progress. Please wait for the current one to end." in chat then run a console command but cant get it right. Client side [lua] debug.getregistry().Player.ChatPrint = function() if string.find("There is already a vote in progress. Please wait for the current one to end.") then timer.Create("yes", 1, 1, function() RunConsoleCommand("say", "hi") end) end end [/lua]
If this isn't some kind of satire that's going over my head... [code] if (some conditional for your vote system) then chat.AddText(Color( 100, 100, 255 ), "There is already a vote in progress. Wait!") chat.PlaySound() RunConsoleCommand("say", "hi") end [/code]
Thats a bizarre way of doing it lol. Let me give you the run down of what you should do. Step 1: Scrap everything 2: Create a function with Player being one of the arguments 3: In that function, use Player:ChatPrint to send your message 4: Create a timer and write up the code that runs when the timer ends 5: End your function 6: Hook it to something or call the function elsewhere like in a console command And to elaborate on what you are doing wrong... That first line is just strange, where is Player declared and why are you grabbing a registery?? You are using string.find but not telling it where to look, its like just saying "find 'hello'" instead of "in variable Text find 'hello'", if that makes sense. If your timer is 1 second long and you dont reference it elsewhere, try using timer.Simple instead. Lastly read up more on Lua, you attempted which sets you higher than quite a few people but your code is wacky
Sorry, you need to Log In to post a reply to this thread.