Forum

> > CS2D > Scripts > msg bug [Solved]
Forums overviewCS2D overview Scripts overviewLog in to reply

English msg bug [Solved]

8 replies
To the start Previous 1 Next To the start

old msg bug [Solved]

Ridho
User Off Offline

Quote
hi all, I found a bug in my script (maybe) , I've made this:
1
2
3
4
5
6
7
8
9
addhook("say","say_")
function say_(id,txt)
	if string.lower(txt)=="rank" then
		return 0
	else
		msg(color.."000255000"..player(id,"name")..":  "..txt)
	return 1
	end
end

initially it works, but after I edit that and test it, I just found a bug, although It's same with the beginning

I think this picture can explain it

IMG:https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-xap1/t31.0-8/p526x395/1911286_958837834146150_6531689324869838954_o.jpg


Ignore about my bad english
thank you
edited 1×, last 20.12.14 11:13:08 am

old Re: msg bug [Solved]

Joni And Friends
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
color="\169"
addhook("say","say_")
function say_(id,txt)
     if string.lower(txt)=="rank" then
          return 0
     else
          msg(color.."000255000"..player(id,"name")..":  "..txt)
     return 1
     end
end
Check is you adding "msg" variable?
edited 1×, last 20.12.14 09:52:29 am

old Re: msg bug [Solved]

Ridho
User Off Offline

Quote
I just make one say hook, btw by using
1
color="\169"

is that different with this?
1
color=string.char(169)

old Re: msg bug [Solved]

Joni And Friends
User Off Offline

Quote
No, but that error is on the msg variable, is you adding msg variable? check it, that error will coming if you put this code on your script
1
msg()
because you forgot to adding (")

old Re: msg bug [Solved]

Ridho
User Off Offline

Quote
I dont really understand but there is only 1 "msg", but a lot of "msg2" in my script

I've changed the string.char(169) to "\169" but the same thing appeared (again)
IMG:https://i62.tinypic.com/15s6j3a.png

old Re: msg bug [Solved]

DC
Admin Off Offline

Quote
The message looks like "msg" is a table in your script. So at some point you probably declare a table called "msg". E.g. this way:
1
msg = {}
This overwrites the msg function so you can't use it anymore. This can either happen in your script or in any other script you load.

Search for all occurrences of "msg" in all used scripts to find the problem.

old Re: msg bug [Solved]

Ridho
User Off Offline

Quote
[Edit]

I've searched "msg" as user DC: suggested me, finally Problem Solved thanks
edited 1×, last 20.12.14 11:12:42 am

old Re: msg bug [Solved]

DC
Admin Off Offline

Quote
No... this CAUSES the problem! DO NOT add it. You probaly already have something like this in your code otherwise you wouldn't get the error message.

Edit: Glad to hear that it helped
Please note that simply removing a table declaration probably causes new problems at another point... unless the table wasn't used at all.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview