Forum

> > CS2D > Scripts > lua error D:
Forums overviewCS2D overview Scripts overviewLog in to reply

English lua error D:

10 replies
To the start Previous 1 Next To the start

old lua error D:

Angel Montez
BANNED Off Offline

Quote
LUA ERROR: sys/lua/server.lua:614: 'end' expected (to close 'function' at line 217) near
'<eof>'

Lua script >


IMG:https://i.imgur.com/CVxp0Op.jpg?1

Admin/mod comment

Placed script in more tag /user useigor

old Re: lua error D:

CaneCorso
User Off Offline

Quote
USE FUCKING SPOILER . Btw , u didnt close the function at line 217 , add an new end near line 247 .

old Re: lua error D:

Infinite Rain
Reviewer Off Offline

Quote
user CaneCorso has written
USE FUCKING SPOILER .

Which is a wrong tag to use. Read the usage of tags before complaining about people misusing them.

old Re: lua error D:

VADemon
User Off Offline

Quote
user Angel Montez as answered above, line 241. You gotta fix it yourself in the code below.
Code with your tabbing >

Secondly, your message function is made poorly. You loop 32 times for each existing command which will hurt your server's performance really, really hard:
1
2
3
4
5
6
7
for target = 1, 32 do
		if (txt=="!goto "..target) then
			if (a[id]>=1) then
				parse ("setpos "..id.." "..(player(target,"x")).." "..(player(target,"y")))
			end
		end
	end
What you want to do is to extract the part of the message where the target ID is expected to be. Example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
if string.sub(txt, 1, 5) == "!goto" then -- take the first 5 characters and compare them

	local targetID = tonumber(string.sub(txt, 7, 8)) -- 6th character is space; 7 and 8 are ID numbers for the target; tonumber() turns text into a number
	
	if type(targetID) == "number" then	-- else you'll get an error when a user doesn't write a proper number
	
		if (targetID > 0) and (targetID < 33) and (targetID ~= id) then -- 1) validate the number (must be a value between 1 and 32). 2) check to make sure targetID isn't the player who is executing this command
			if (player(targetID, "exists") == true) and player(targetID, "health") ~= 0 then -- check if target player is on the server. 2) is that player alive?
				parse ("setpos "..id.." "..(player(target,"x")).." "..(player(target,"y")))
			else
				msg("Player ".. targetID .." is dead or not on the server")
			end
		else
			msg("You entered a wrong ID!")
		end
	end
end

Finally, update TMW: file cs2d [ADMN] TooManyWeapons 1.3b

old Re: lua error D:

VADemon
User Off Offline

Quote
@user Baloon: It's a shame to be the author of this piece of... code. Read my comment and improve your masterpiece
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview