Forum

> > CS2D > Scripts > strange bug with a Chat-command
Forums overviewCS2D overview Scripts overviewLog in to reply

English strange bug with a Chat-command

5 replies
To the start Previous 1 Next To the start

old strange bug with a Chat-command

Edik
User Off Offline

Quote
Hello,
I did write a code, which results in freezing the game till leaving the server for the guy, who writes it.
The strange thing is, if I check the info of only 1 Player, I get (with a similar code) the same Infos below correctly shown. The Game only freezes for the "id", and doesnt show anything in the server/console.
PLAYERS[id].money
PLAYERSTEMP[id].lvl
are correct, and do exist.
I tried it with ~5-6 people playing.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("say", "msgcommands")
function msgcommands(id,msg)
	if msg == "!infoall"  then
		for _, i in pairs(player(0, "table")) do
			msg2(id,"\169000128255#"..player(i,"name"))
			msg2(id,"\169000128255ID: "..i)
			msg2(id,"\169000128255UID: "..player(i, "usgn"))
			msg2(id,"\169000128255SID: "..player(i, "steamid"))
			msg2(id,"\169000128255$"..PLAYERS[i].money)
			msg2(id,"\169000128255LVL: "..PLAYERSTEMP[i].lvl)
			msg2(id,"\169000128255-------------------")
		end
		return 1
	end
end

old Re: strange bug with a Chat-command

Mami Tomoe
User Off Offline

Quote
I had to edit the code a little because I don't have the main script.
Your code works, maybe the problem is somewhere else?
Also I would recommend to show the information about players in a different way, what about a menu?

My edited code. Lines changed: 10,11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("say", "msgcommands")
function msgcommands(id,msg)
     if msg == "!infoall"  then
          for _, i in pairs(player(0, "table")) do
               msg2(id,"\169000128255#"..player(i,"name"))
               msg2(id,"\169000128255ID: "..i)
               msg2(id,"\169000128255UID: "..player(i, "usgn"))
               msg2(id,"\169000128255SID: "..player(i, "steamid"))
               msg2(id,"\169000128255$"..player(id,"money"))
               msg2(id,"\169000128255LVL: "..player(id,"speedmod"))
               msg2(id,"\169000128255-------------------")
          end
          return 1
     end
end

old Re: strange bug with a Chat-command

Edik
User Off Offline

Quote
@user Mami Tomoe: this works if im playing alone or with a couple of people, but after some playing and after more people join, it freezes. Maybe VADemon and Waldin are right. Feels bad beeing so much limited in LUA
so many ideas, but only half of them can be realized.
Still thank you for your help.

old Re: strange bug with a Chat-command

DC
Admin Off Offline

Quote
I will adjust the the message sending network code for the next update so it hopefully won't explode anymore when you do this.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview