Forum

> > CS2D > Scripts > Error in the Lua?
Forums overviewCS2D overview Scripts overviewLog in to reply

English Error in the Lua?

5 replies
To the start Previous 1 Next To the start

old Error in the Lua?

Axel340
User Off Offline

Quote
It seems to me that in this script error sound when killing the Soldier does not play.

1
2
3
4
5
6
addhook("objectkill","npckill") 
function npckill(id,ply)
 if object(id,"type") == 5 then 
  parse("sv_sound2 "..ply.." \"p-song/turret_disabled_1.wav\"")
 end
end

old Re: Error in the Lua?

Kel9290
User Off Offline

Quote
More >

It seems you stolen code from user Vectarrio's file cs2d Players vs NPC zombies |1.1.7| because when i saw his code it was same.

old Re: Error in the Lua?

Kel9290
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
function convert(p)
	return math.floor(p/32)
end

addhook("objectkill","npckill")
function npckill(id,ply)
	if object(id,"type") == 30 then -- NPC?
		if entity(convert(object(id,"x")),convert(object(id,"y")),"int1") == 5 then
			parse("sv_sound2 "..ply.." /fun/thats_the_way.wav")
		end
	end
end
Tested.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview