2× editiert, zuletzt 02.08.18 11:27:01
Forum
 
 
Scripts 
 Incorrect code message
 Incorrect code message
23 Antworten1
local wrong = 'message'
 Gaios: thx but i can not write 1× editiert, zuletzt 01.08.18 18:58:00
 phalenkO: You should definitely change your translation provider. 
 Avo: i do not have enough english to tell the situation, but i do not look at the translator. im serious and i do not use it a lot because there are too many mistakes in translation from turkish to english, just looking at the words i do not know. But now i look 
 https://www.lua.org/pil/8.4.html 
 Gaios: can u give an example? 
 phalenkO: Go check my profile and see the Discord ID of mine. You can contact me from there for translating, I'm a Turkish person. 
 Gaios: even if i writee normal text in this code i get an error message, can you find the error?1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
admin = {142925}
addhook("say","kck")
function kck(id,txt)
for _, usgn in ipairs(admin) do 
if txt:sub(1,5) == "!kick" then 
kid = txt:sub(6)
parse("kick "..kid)
msg("kicked!!!")
else 
end
msg("code is wrong!")
return 1
end
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
admin = {142925}
addhook("say","kck")
function kck(id,txt)
	for _, usgn in ipairs(admin) do 
		if txt:sub(1,5) == "!kick" then 
			kid = txt:sub(6)
			parse("kick "..kid) -- results in "kick  <id>" (one space too many, provided you write '!kick <id>')
			msg("kicked!!!") -- Global message that the kicked player won't see because he'd be kicked
		else -- what is this? 
		end -- did you misplace this 'end' ?
		msg("code is wrong!")
		return 1
	end
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("say","kck")
function kck(id,txt)
	for _, usgn in ipairs(admin) do 
		if txt:sub(1,5) == "!kick" then 
			kid = txt:sub(6)
			parse("kick "..kid)
			msg("kicked!!!")
		else 
			-- nothing...
		end
		msg("code is wrong!") -- this is written always cuz its not in the if
	return 1
	end
end
So you gotta replace line 11 and 12 in your code
  
 Bowlinghead: how is it going to be? will this happen? i probably misunderstood1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
admin = {142925}
addhook("say","kck")
function kck(id,txt)
     for _, usgn in ipairs(admin) do 
          if txt:sub(1,5) == "!kick" then 
               kid = txt:sub(6)
               parse("kick "..kid)
               msg("kicked!!!")
          else 
               -- nothing...
          end
          return 1
          msg("code is wrong!") 
          end
end
 Bowlinghead hat geschriebenSo you gotta replace line 11 and 12 in your code
In your code that you posted, not on mine :3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
admin = {142925}
addhook("say","kck")
function kck(id,txt)
	for _, usgn in ipairs(admin) do 
		if txt:sub(1,5) == "!kick" then 
			kid = txt:sub(6)
			parse("kick "..kid)
			msg("kicked!!!")
		else
			msg("code is wrong!")
			return 1
			end
		end
	end
end
 Bowlinghead: i get an error code even when i write a regular article 2× editiert, zuletzt 04.08.18 11:39:54
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
d = 50 for i = 1, d
if player(1,'exists')then if player(1,'team')==1 then
if player(1,'health')>0 then
if player(1,'health')<50 then msg2(1,'this is a nice piece of new generation style code') end var = 'kids are stupid'
end 
parse('restart')
end msg(var) end return
end
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
d = 50
for i = 1, d do
	if player(1,'exists') then
		if player(1,'team')==1 then
			if player(1,'health')>0 then
				if player(1,'health')<50 then
					msg2(1,'this is a nice piece of new generation style code')
				end
			var = 'kids are stupid'
			end 
		parse('restart')
		end
	msg(var)
	end
return
end
@
 Quattro:you missed the do after the for-statement (line 2)
this code will throw an error message, if player 1 is dead and it is executed, because the variable var is unknown.
But why do you use a for-Loop, in this case it is pointless.
please tab your code
@
 phalenkO:you get the error-message because your message wasn't "!kick <id>"
remove the else-statement to avoid this
2× editiert, zuletzt 04.08.18 16:44:40
 Cebra hat geschriebenplease tab your code
You either don't know how to tab.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
d = 50
for i = 1, d do
	if player(1,'exists') then
		if player(1,'team')==1 then
			if player(1,'health')>0 then
				if player(1,'health')<50 then
					msg2(1,'this is a nice piece of new generation style code')
				end
				var = 'kids are stupid'
			end 
			parse('restart')
		end
		msg(var)
	end
	return
end
 Cebra: Sorry, but couldd u please give me an example? 
 Masea: yes, you are right, my fault@
 phalenkO: based on this code:
if you write "hello" as a message,
the if-statement in line 4 returns false so that the else-statement is executed.
btw:
The return 1 is executed every time, that's why on your server no message are shown
and every body can kick players, because you don't test the identity of the player
 
 1 
 Offline
