Forum

> > Stranded II > Scripts > [SOLVED] LUA Error
Forums overviewStranded II overview Scripts overviewLog in to reply

English [SOLVED] LUA Error

2 replies
To the start Previous 1 Next To the start

moved [SOLVED] LUA Error

Baloon
GAME BANNED Off Offline

Quote
Hi us SGN Users,Moderators,Admin.
I don't know why my LUA error every i do attack
it says :

LUA ERROR: sys/lua/p5_Hero Adventure/funcs.lua:318: attempt to compare number with boolean

The error line is in this
1
if (player(some,"x")>=688) then

In the hook "attack" ON LINE 25
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
40
41
42
43
function p_attack(id)
if player(id,"tilex")>=21 then
if player(id,"tilex")<=26 then
if player(id,"tiley")>=71 then
if player(id,"tiley")<=79 then
if croco == 1 then
crocohealth=crocohealth-p_damage[id]/crocoprotect
p_inscore[id]=p_inscore[id]+1
parse('hudtxt2 '..id..' 11 "©000255000Crocodile Health : '..crocohealth..'/'..crocomaxhp..'" 300 318')
parse('hudtxtalphafade 0 11 5000 0.0')
parse ("effect \"smoke\" "..player(id,"x").." "..player(id,"y").." 3 3")
if crocohealth<=0 then
p_coin[id]=p_coin[id]+p_inscore[id]*10
croco = 0
p_inscore[id] = 0
freeimage(crocodilepic)
end
end
end
end
end
end
for some = 1, 32 do
if crocohealth>=1 then
if (player(some,"x")>=688) then
if (player(some,"x")<=848) then
if (player(some,"y")>=2288) then
if (player(some,"y")<=2544) then
local cr = math.random(1,100)
if cr<=crocofire then						p_health[some]=p_health[some]-crocodmg					tween_move(crocodilepic,5,player(some,"x"),player(some,"y"))						tween_scale(crocodilepic,10,0.5/2.0,0.5/2.0)
parse ("explosion "..player(some,"x").." "..player(some,"y").." 50 1")
parse ("effect \"fire\" "..player(some,"x").." "..player(id,"y").." 48 48")
if p_health[some]<=0 then
parse ("customkill 0 Crocodile "..some)
end
end
end
end
end
end
end
end
end
edited 1×, last 18.05.15 12:11:25 pm

Admin/mod comment

Please choose the right section (Script ins this case) next time. Moved /DC

old Re: [SOLVED] LUA Error

Flacko
User Off Offline

Quote
You should add the following before that line:
1
if player(some, "exists") then

Otherwise, you are trying to read the position of a player that doesn't exist!

old Re: [SOLVED] LUA Error

Ridho
User Off Offline

Quote
1
2
3
4
5
6
7
8
for some = 1, 32 do
	if player(some,"exist") then
		if crocohealth>=1 then

		--your code here

	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview