• Lua Codeing
    4 replies, posted
Hello I'm in some DarkRp code trying to make it so that "/advert" can only be used by a class i made.. TEAM_NEWS. this code is from cl_init.lua I don't know if you can't use functions in this file, because whenever i run this it says: "ERROR: GAMEMODE:'ChatTextChanged' Failed: DarkRP/gamemode/cl_init.lua:842: attempt to call method 'Team' (a nil value)" [code] if GetGlobalInt("alltalk") == 0 then if string.sub(text, 1, 2) == "//" or string.sub(string.lower(text), 1, 4) == "/ooc" or string.sub(string.lower(text), 1, 4) == "/a" then HearMode = "talk through OOC" elseif string.sub(string.lower(text), 1, 7) == "/advert" and ply:Team() == TEAM_NEWS then HearMode = "advert" else print (ply:Team()) /I'm using this to check... if it would work this far :( end end [/code] this code has really been bothering me and i could really use anyone's help I have never coded or used lua beside the occasional modding a SWEP to output 100000 damage. :D Thanks for anyone who helps. [highlight](User was banned for this post ("Wrong Section, try asking in the Lua section." - mm3guy))[/highlight]
Huh, I didn't know people still played Gmod. v:v:v
Go to the programming section for help.
Might get better results here: [url]http://www.facepunch.com/forumdisplay.php?f=65[/url]
You should just use this to print the advert: [code]sendcmds: say "Your text here"[/code] Much more simple.
Sorry, you need to Log In to post a reply to this thread.