Forum
News CS2D Beta 0.1.2.2 Obviously Exactly Myself has written
@ Infinite Rain: I was also hoping for sv_sound3.
You can use this "fake" sv_sound3 function though.
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
function dist(x1, y1, x2, y2) 	return math.sqrt((x2 - x1) ^ 2 + (y2 - y1) ^ 2) end function sv_sound3(x, y, radius, sound) 	local _, i 	for _ i in pairs(player(i, "table")) do 		if not player(i, "bot") then 			if dist(x, y, player(i, "x"), player(i, "y")) <= radius then 				parse("sv_sound2 " .. i .. " \"" .. sound .. "\"") 			end 		end 	end end
This function can combined with spawnprojectile along with Alistaire's idea to create new weapons people cry on these forums about.
Example: You stop the rocket launcher from shooting an RPG and instead let it shoot a laser instead. There, you just created a super duper awesome epic low ammo weapon for your disposal.
Plus if this were to be done, I just solved three problems for you (Mine, Alistaire's & kids).
Or am I completely insane? (Don't answer that).
Lua scripts run on the server though. Impossible to stop the client from rendering the shot effects because they appear instantly. There is no time for the server to receive the shot message, to parse the Lua script and to send a message like "hey stop, there is a return! don't shoot!". Well at least impossible using the return system.
Of course there could be a command which disables attacking but it wouldn't work with the attack/attack2 hook and the return value of it because I would have to delay everything to make that work.
Edit: Does the attack hook still get called even if you have no ammo? - I could work around yours and my problem by setting ammo if this would be added (Or is added, not sure). Then create my own ammo using Lua and bam, I still have a super duper awesome epic weapon. Seems legit; but for it to work my first question must be a yes.
Edit 2: I suddenly and only just now noticed this is not the ideas thread. And now I feel stupid.
edited 1×, last 18.02.13 09:20:25 pm