Forum

> > CS2D > Scripts > How to Fix This?
Forums overviewCS2D overview Scripts overviewLog in to reply

English How to Fix This?

2 replies
To the start Previous 1 Next To the start

old How to Fix This?

Rygna
User Off Offline

Quote
Anyone? Please can you fix my Lua?

• This is my Lua (Line 80)
1
2
3
4
5
6
7
8
function join(id)
	GodMode[id] = 0
	for _, usgn in ipairs(Test[2].Owner) do
		if player(id,"usgn") == usgn then
			UserGroupColor[id] = 0
		end
	end
end

• This table will Connect to that Command
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Test = {
	--- ## Server Config ## --
	[1] = {servername = "FurtyServer",
		   maxplayer = "32",
		   hudplayer = "127",
		   idleaction = "4",
		   antispeeder = "2", -- set 0 for desabled it.
		   rconusers = "110594", -- Give Permissions for Rcon Command.
		   
		   -- ## Deathmatch Config ## --
		   respawndelay = "6", -- Likely 5second.
		   randomspawn = "0", -- You can enabled it by set 1.
		   
		   -- ## Construction Config ## --
		   dispensermoney = "5000",
		   
		   -- ## Lua Config ##
		   require = "sys/lua/SampleAdmin",
		   tag = "[Server]"
	},
	
	-- ## User Group ## (Place USGN for Config it.) --
	-- P.S: You can use (Comma)-(,) for add more player in User group --
	[2] = {Owner = "110594",
		   SuperAdmin = "USGN",
		   Admin = "USGN",
		   Moderator = "USGN",
		   VIP = "USGN",
		   Banned = "USGN"
	},
	
	-- ## User Group Prefix ## --
	[3] = {Owner = "[Owner]",
		   SuperAdmin = "[Super Admin]",
		   Admin = "[Admin]",
		   Moderator = "[Moderator]",
		   VIP = "[VIP]"
	}
}

• Error Output says :
1
2
3
4
LUA ERROR: sys/lua/autorun/server.lua:82: bad argument #1 to 'ipairs' (table expected, got string)
 -> [C]: in function 'ipairs'
 -> sys/lua/autorun/server.lua:82: in function <sys/lua/autorun/server.lua:80>
 -> in Lua hook 'join', params: 6

old Re: How to Fix This?

Yates
Reviewer Off Offline

Quote
You have:
1
[2] = {Owner = "110594"}

The error says it should be:
1
[2] = {Owner = {110594}}

Wrapping in {} means it is a table, wrapping in "" means it is a string.
edited 1×, last 15.04.16 08:09:51 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview