Forum

> > CS2D > Scripts > strange bug with a Chat-command
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch strange bug with a Chat-command

5 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt strange bug with a Chat-command

Edik
User Off Offline

Zitieren
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

alt Re: strange bug with a Chat-command

Mami Tomoe
User Off Offline

Zitieren
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

alt Re: strange bug with a Chat-command

Edik
User Off Offline

Zitieren
@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.

alt Re: strange bug with a Chat-command

DC
Admin Off Offline

Zitieren
I will adjust the the message sending network code for the next update so it hopefully won't explode anymore when you do this.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht