Forum

> > CS2D > Scripts > Script error.
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Script error.

10 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Script error.

Yates
Reviewer Off Offline

Zitieren
Lol, just started. Thought I should give it a try.
I get an error, server.lua:5: ')' expected near ','
I fail, and I know nothing about scripting and the commands, reading them now actually..
1
2
3
4
5
6
7
8
USGN = {21431}

addhook("fgspawn","spawn")
function spawn(id,usgn)
if (id,usgn) = USGN
then player spawn x==1 y==1
end
end
I'm humiliating myself now aren't I?
Spoiler >

I didn't know what to call the thread, so I did this oO
But, if there are more errors tell me what I did wrong, don't just give me a script I wouldn't learn.

alt Re: Script error.

Yates
Reviewer Off Offline

Zitieren
Yes, because I fail..
but, what I wanted to do was if you have a certain USGN you would spawn somewhere else..
I could fill in the x and y..

alt Re: Script error.

FiNEX
User Off Offline

Zitieren
this is totally wrong, i dont know but i think the hook "fgspawn" doesn't exists, try this for your script:
1
2
3
4
5
6
7
8
9
10
usgn = "21431" --your usgn
x = 1 --the xpos for spawn
y = 1 --the ypos for spawn

addhook("spawn,","fgspawn")
function fgspawn(id)
	if player(id,"usgn")==usgn then
		parse("setpos "..id.." "..x.." "..y)
	end
end
3× editiert, zuletzt 29.03.11 20:13:07

alt Re: Script error.

DC
Admin Off Offline

Zitieren
@Yates:
I'm sorry but I have to tell you that everything there is horribly wrong.

please read a Lua tutorial. just guessing how things work doesn't work. you need a basic understanding of how to write Lua scripts.

× the spawn hook has no USGN id parameter
× the expression "if (id,usgn) = USGN" doesn't make sense
× the expression "player spawn x==1 y==1" doesn't make any sense as well

leon7070's script is not fully correct either. in Lua you use "==" to compare if two values are equal. "=" is for assignments.

alt Re: Script error.

Yates
Reviewer Off Offline

Zitieren
Don't be sorry xP
I suck, and I know it..
I will read more about lua.
But for the time being it's fixed..

1
2
3
4
5
6
7
8
addhook("spawn","fgspawn")
function fgspawn(id)
 for id=1,32 do
  if player(id,"usgn")==21431 then
   parse("setpos "..id.." 100 100)
  end
 end
end
1× editiert, zuletzt 29.03.11 20:17:36

alt Re: Script error.

RAVENOUS
BANNED Off Offline

Zitieren
DC hat geschrieben
Long quote, short sense

I already told him the right answer, next time he's asking me

alt Re: Script error.

FiNEX
User Off Offline

Zitieren
Yates hat geschrieben
Don't be sorry xP
I suck, and I know it..
I will read more about lua.
But for the time being it's fixed..

1
2
3
4
5
6
7
8
addhook("spawn","fgspawn")
function fgspawn(id)
 for id=1,32 do
  if player(id,"usgn")==21431 then
   parse("setpos "..id.." 100 100)
  end
 end
end


you dont need "for id=1,32 do", its already in the function "fgspawn(id)".

alt Re: Script error.

Yasday
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
usgns = { 21431 }
the_x_value = 100
the_y_value = 100

addhook("spawn","fgspawn")
function fgspawn(id)
	for _, id in ipairs(player(0, "table")) do
		for __, us in ipairs(usgns) do
			if player(id,"usgn") == us then
				parse("setpos "..id.." "..(the_x_value * 32 + 16).." "..the_y_value * 32 + 16)
				return
			end
		end
	end
end
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht