PUBG压枪脚本

lock=0
state=0
alltime=0
function OnEvent(event, arg)
	if(event=="PROFILE_ACTIVATED")then
		EnablePrimaryMouseButtonEvents(true)
	end

	OutputLogMessage("Event: "..event.." Arg: "..arg.."\n")
	if(event=="MOUSE_BUTTON_PRESSED" and arg==7  )then
	        OutputLogMessage("已解锁\n")
		lock=1
	end
	if(event=="MOUSE_BUTTON_PRESSED" and arg==8  )then
	        OutputLogMessage("已上锁\n")
		lock=0
	end
--***********************************************************
--***********************************************************
--choose gun*************************************************
--***********************************************************
--***********************************************************
	if(event=="MOUSE_BUTTON_PRESSED" and arg==6 )then
		px, py = GetMousePosition()
		OutputLogMessage("选枪键点击位置坐标: %d, %d\n", px, py)
		
		if(px<30000)and(py<16500)then
			alltime=180
			y_stand={12,13,14,15,16,20,21,19,19,19,19}
			y_crouch={15,15,17,20,22,24,26,25,24,23,23}
			OutputLogMessage("已选择M762\n")
		end
		if(px>30000)and(py>16500)then
			alltime=180
			y_stand={12,13,14,15,16,20,21,19,19,19,19}
			y_crouch={15,15,17,20,22,24,26,25,24,23,23}
                 OutputLogMessage("已选择M416\n")
		end
		if(px<30000)and(py>16500)then
			alltime=180
			y_stand={12,13,14,15,16,20,21,19,19,19,19}
			y_crouch={15,15,17,20,22,24,26,25,24,23,23}
                 OutputLogMessage("已选择AKM\n")
		end
		if(px>30000)and(py>16500)then
			alltime=180
			y_stand={12,13,14,15,16,20,21,19,19,19,19}
			y_crouch={15,15,17,20,22,24,26,25,24,23,23}
                 OutputLogMessage("已选择SCAR\n")
		end
		cx_array={
			math.ceil(alltime/10*1),
			math.ceil(alltime/10*2),
			math.ceil(alltime/10*3),
			math.ceil(alltime/10*4),
			math.ceil(alltime/10*5),
			math.ceil(alltime/10*6),
			math.ceil(alltime/10*7),
			math.ceil(alltime/10*8),
			math.ceil(alltime/10*9),
			math.ceil(alltime/10*10),
			math.ceil(alltime/3*4) }
	end
--***********************************************************
--***********************************************************
--stand state************************************************
--***********************************************************
--***********************************************************
	if(event=="MOUSE_BUTTON_PRESSED" and arg==1 and lock==1 and not( IsKeyLockOn("capslock")))then
		cx=0
		OutputLogMessage("开启站立模式自动压枪\n")
		for i=1,11 do
			while IsMouseButtonPressed(1)and IsMouseButtonPressed(3) and cx<cx_array[i] do
			MoveMouseRelative(0,y_stand[i])			
			Sleep(10)
			cx=cx+1
			OutputLogMessage("计数器:%d\n",cx)
			end		
		end
	end
--***********************************************************
--***********************************************************
--crouch state***********************************************
--***********************************************************
--***********************************************************
	if(event=="MOUSE_BUTTON_PRESSED" and arg==1 and lock==1 and IsKeyLockOn("capslock"))then
		cx=0
		OutputLogMessage("开启下蹲模式自动压枪\n")
		for i=1,11 do
			while IsMouseButtonPressed(1)and IsMouseButtonPressed(3) and cx<cx_array[i] do
			MoveMouseRelative(0,y_crouch[i])			
			Sleep(10)
			cx=cx+1
			OutputLogMessage("计数器:%d\n",cx)
			end		
		end
	end
end

你可能感兴趣的:(脚本,c++)