HelpLua help (am skrub)

Posts 1–11 of 11 · Page 1 of 1
Lua help (am skrub)
Code:
function Hi()
		timer.Simple(0.05, function()
		LocalPlayer():ConCommand("say /ooc hi")
	end)
print("hi in console")
concommand.Add("hi", Hi)
		timer.Simple(0.10, function()
		RunConsoleCommand("hi")
	end)
end
So it runs through the code and lets me run "hi" in console as a command that will say "hi" in ooc (out of character) chat, but it will not "RunConsoleCommand("hi"), it just like skips through it w/o running it, can someone explain to me why it will not run the line? i want it to set the concommand, than run it after, but i don't know how to make it actually do that. I'm a scrub, if anyone could help?
what the hell is this

i honestly hope this is a joke
Quote Originally Posted by holyhackdudelol View Post
what the hell is this

i honestly hope this is a joke
Its not, i'm a scrub lmfao.. This isn't what its actually going to be, i'm using it as a sample so-to-speak. I just need to figure out why this problem happens so i can continue what i wanna do.
first change the LocalPlayer():ConCommand("say /ooc hi") to RunConsoleCommand("say" , "/ooc hi")
and im not sure but you cant register a function in itself as a con command you cold do or something like that
function Hi()
timer.Simple(0.05, function()
RunConsoleCommand("say" , "/ooc hi")
end)

end

concommand.Add("hi", Hi)
print("hi in console")

timer.Simple(0.10, function()
RunConsoleCommand("hi")
end)
Quote Originally Posted by zombiiju View Post
first change the LocalPlayer():ConCommand("say /ooc hi") to RunConsoleCommand("say" , "/ooc hi")
and im not sure but you cant register a function in itself as a con command you cold do or something like that
function Hi()
timer.Simple(0.05, function()
RunConsoleCommand("say" , "/ooc hi")
end)

end

concommand.Add("hi", Hi)
print("hi in console")

timer.Simple(0.10, function()
RunConsoleCommand("hi")
end)
You can still use LocalPlayer():ConCommand("say /ooc hi"); theres nothing wrong with it
So, you're saying that doesn't change anythin and it will not work? I tried that before to use "RunConsoleCommand("Say", "/ooc hi"), but when i did it i got a lua error?
you are that admin who asked me how to make a chat spam script nice meme
Quote Originally Posted by p100 body shot View Post
you are that admin who asked me how to make a chat spam script nice meme
ayyy, and yea, thats what its gonna be, i know how to make one, i just need this error fixed. Once i get this solved the rest will be easy.
Quote Originally Posted by doctorpepper62 View Post
ayyy, and yea, thats what its gonna be, i know how to make one, i just need this error fixed. Once i get this solved the rest will be easy.
Code:
local spam = CreateClientConVar("spam", 0, true, false)
local spam_msg = CreateClientConVar("spam_msg", "/ooc spam", true, false)

local function spam_timer()
if !spam:GetBool() then return end
RunConsoleCommand("say", spam_msg:GetString())
end

timer.Create("spam", 1, 0, spam_timer)
done
Quote Originally Posted by cdr1za View Post
Code:
local spam = CreateClientConVar("spam", 0, true, false)
local spam_msg = CreateClientConVar("spam_msg", "/ooc spam", true, false)

local function spam_timer()
if !spam:GetBool() then return end
RunConsoleCommand("say", spam_msg:GetString())
end

timer.Create("spam", 1, 0, spam_timer)
done
Eww Convars -reperino
Posts 1–11 of 11 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us