Help:How to calculate the refire rate and the weight of a weapon (Counter-Strike 2D)

From Unreal Software English Wiki
(Redirected from Help:RRWW)
Jump to: navigation, search

Should you want to create a weapon page, please refer to this page to get the weight and refire rate values.

Contents

Refire rate

Process

  1. Press left mouse button after the script has been executed
  2. Hold left mouse button until two shots are made
  3. Use the data printed out on your screen

Code

tt=0
fps=50

addhook("log","getfps")
function getfps(text)
	if text:sub(1,11)=="Current FPS" then
		for n in string.gmatch(text,"(%d+)") do
			fps=tonumber(n)
			break
		end
	end
end

addhook("attack","getatk")
addhook("attack2","getatk")
function getatk(id)
	if not timer then timer=true else
		timer=false
		parse("fps")
		local rr=tt/fps
		msg2(id,"The refire rate of the weapon is "..rr.." sec ("..tt.." frames)")
		msg2(id,"The shots per second value of the weapon is "..(1/rr))
		tt=0
	end
end

addhook("always","getspeed")
function getspeed(id)
	if timer then
		tt=tt+1
	end
end

Weight

Process

  1. Make sure you have plenty of room for running
  2. Take the desired weapon in your hand
  3. Hold W, A, S or D, depending on the direction in which you want to run
  4. Press F4
  5. Do not let go of the movement button until you've stopped on your own
  6. Use the data printed to you

Notes

Code

dist=0
weight=0
parse("speedmod "..player(0,"table")[1].." -100")
sm=0

addhook("serveraction","runst")
function runst(id,a)
	if a==3 then
		timer2=true
		pos={player(id,"x"),player(id,"y")}
		parse("speedmod "..id.." "..sm)
		timer(1000,"parse","speedmod "..id.." -100")
		timer(1000,"parse","lua \"msg2("..id..",'The weight of your weapon is '..weight..' K')\"")
	end
end

addhook("move","runcalc")
function runcalc(id,x,y)
	dist=math.sqrt((pos[1]-x)^2+(pos[2]-y)^2)
	weight=(164+(0.06*player(id,"speedmod")*100))/dist
end
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox