Forum

> > CS2D > Scripts > lua error D:
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch lua error D:

10 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt lua error D:

Angel Montez
BANNED Off Offline

Zitieren
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 Kommentar

Placed script in more tag /user useigor

alt Re: lua error D:

CaneCorso
User Off Offline

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

alt Re: lua error D:

Infinite Rain
Reviewer Off Offline

Zitieren
user CaneCorso hat geschrieben
USE FUCKING SPOILER .

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

alt Re: lua error D:

VADemon
User Off Offline

Zitieren
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

alt Re: lua error D:

VADemon
User Off Offline

Zitieren
@user Baloon: It's a shame to be the author of this piece of... code. Read my comment and improve your masterpiece
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht