Jump to content

Problem with script


healLV

Recommended Posts

Hello. So I have this problem: I bind arrow keys to 4 different function but only one appear to be working and only adds to y. What am I doing wrong?

local screenWidth,screenHeight = guiGetScreenSize()
local y = 150
local x = 8

function replace()
	local playerWeapon = getPedWeapon(localPlayer)
	if playerWeapon == 30 or playerWeapon == 31 then
		if getControlState("aim_weapon") then
				dxDrawImage ( screenWidth/2 + x, screenHeight/2 - y, 100, 100, "crosshair.png")
		end
	end
end
addEventHandler("onClientRender", root, replace)

function hminus()
	y = y - 1
end

function hplus()
	y = y + 1
end

function wminus()
	x = x - 1
end

function wplus()
	x = x + 1
end

function outputchatbox()
	outputChatBox("elseif screenWidth == "..x.." and screenHeight == "..y.." then")
end


function bindkey()
bindKey("arrow_d", "down", hminus)
bindKey("arrow_u", "down", hminus)
bindKey("arrow_l", "down", hminus)
bindKey("arrow_r", "down", hminus)
bindKey("m", "down", outputchatbox)
end
addEventHandler("onClientResourceStart", root, bindkey)

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...