• DarkRP OOC Chat Problem
    10 replies, posted
Anyone willing to help me with this? I am trying to make it so that the (OOC) tag when you talk in ooc is Green. i am getting this error [gamemodes\DarkRP\gamemode\main.lua:1643] ')' expected near 'col' [lua]local function OOC(ply, args) if GetConVarNumber("ooc") == 0 then Notify(ply, 1, 4, string.format(LANGUAGE.disabled, "OOC", "")) return "" end local DoSay = function(text) if text == "" then return "" end local col = team.GetColor(ply:Team()) local col2 = Color(255,255,255,255) local lol = Color(0,132,0,255) if not ply:Alive() then col2 = Color(255,255,255,255) col = col2 end for k,v in pairs(player.GetAll()) do TalkToPerson(v, lol, "(OOC) "col, ..ply:Name(), col2, text, ply) end end return args, DoSay end AddChatCommand("//", OOC, true) AddChatCommand("/a", OOC, true) AddChatCommand("/ooc", OOC, true)[/lua]
TalkToPerson(v, lol, "(OOC) "col, ..ply:Name(), col2, text, ply) Change to: TalkToPerson(v, lol, "(OOC) "..col, ..ply:Name(), col2, text, ply)
[B]Edit:[/B] -Chessnut got it I think-
[QUOTE=Chessnut;34269791]TalkToPerson(v, lol, "(OOC) "col, ..ply:Name(), col2, text, ply) Change to: TalkToPerson(v, lol, "(OOC) "..col, ..ply:Name(), col2, text, ply)[/QUOTE] tryed that but got this error [gamemodes\DarkRP\gamemode\main.lua:1643] unexpected symbol near '..'
[QUOTE=leet frog;34269898]I tryed [lua]local function OOC(ply, args) if GetConVarNumber("ooc") == 0 then Notify(ply, 1, 4, string.format(LANGUAGE.disabled, "OOC", "")) return "" end local DoSay = function(text) if text == "" then return "" end local col = team.GetColor(ply:Team()) local col2 = Color(255,255,255,255) local lol = Color(0,132,0,255) if not ply:Alive() then col2 = Color(255,255,255,255) col = col2 end for k,v in pairs(player.GetAll()) do TalkToPerson(v, lol, "(OOC) "team:GetColor(ply:Team()), ..ply:Name(), col2, text, ply) print(type(col)) end end return args, DoSay end AddChatCommand("//", OOC, true) AddChatCommand("/a", OOC, true) AddChatCommand("/ooc", OOC, true)[/lua] but i get this error [gamemodes\DarkRP\gamemode\main.lua:1643] ')' expected near 'team'[/QUOTE] I was wrong before, you used the function right. I didn't realize that team.GetColor() was correct. Just use your original code. Besides it wasn't even what was going on, according to the function source posted here: [url]http://www.facepunch.com/threads/1000149?p=24776113&viewfull=1#post24776113[/url], you need to add a ',' after the OOC string. "col" would be a parameter for the second color input for TalkToPerson(), so it needs to be formatted as a parameter.
[QUOTE=wizardsbane;34270065]I was wrong before, you used the function right. I didn't realize that team.GetColor() was correct. Just use your original code. Besides it wasn't even what was going on, according to the function source posted here: [url]http://www.facepunch.com/threads/1000149?p=24776113&viewfull=1#post24776113[/url], you need to add a ',' after the OOC string. "col" would be a parameter for the second color input for TalkToPerson(), so it needs to be formatted as a parameter.[/QUOTE] i tryed doing it and got this error [gamemodes\DarkRP\gamemode\main.lua:1643] unexpected symbol near '..' and i did [lua]TalkToPerson(v, lol, "(OOC) ", col, ..ply:Name(), col2, text, ply)[/lua]
[QUOTE=leet frog;34270139]i tryed doing it and got this error [gamemodes\DarkRP\gamemode\main.lua:1643] unexpected symbol near '..' and i did [lua]TalkToPerson(v, lol, "(OOC) ", col, ..ply:Name(), col2, text, ply)[/lua][/QUOTE] I don't see a string near ..ply:Name(). You can't concatenate blank space. Remove the "..".
[QUOTE=wizardsbane;34270219]I don't see a string near ..ply:Name(). You can't concatenate blank space. Remove the "..".[/QUOTE] Ok it kinda works. it looks like this tho [img]http://img266.imageshack.us/img266/118/85911200.png[/img] like if i type something it dosnt show up
[QUOTE=leet frog;34270304]like if i try something it dosnt show up[/QUOTE] What do you mean? Speak specifically, I cannot read your mind.
[QUOTE=wizardsbane;34270361]What do you mean? Speak specifically, I cannot read your mind.[/QUOTE] Sorry i ment to say type.
I honestly don't know what's causing that. Try building on the function again, this time only work with what's given (the "col" and "col2" variables should be enough for what you're trying to do). [url]http://code.google.com/codesearch#XR36vfyGThU/trunk/gamemode/main.lua&%20package:http://darkrp%5C.googlecode%5C.com&l=1631[/url] If it still breaks after that, I don't know what to tell you. I hope someone else will be able to figure it out.
Sorry, you need to Log In to post a reply to this thread.