Jump to content

[HELP] Why not working this script?


Tokio

Recommended Posts

Posted (edited)
function onClientClick(button, state)
	if button == "left" and state == "down" then
		for k, v in ipairs(fegyverek) do
			if isInBox(screenW * 0.5703, screenH * 0.2700+(elem * 49.5), screenW * 0.0656, screenH * 0.0269) then
				fegyver = k
			end
		end
		if isInBox(screenW * 0.5703, screenH * 0.2700+(elem * 49.5), screenW * 0.0656, screenH * 0.0269) then
			if fegyver == 3 then
				outputChatBox("asd")
			end
		end
	end
end
addEventHandler("onClientClick", root, onClientClick)

function isInBox(xS,yS,wS,hS)
	if(isCursorShowing()) then
		local cursorX, cursorY = getCursorPosition()
		cursorX, cursorY = cursorX*sX, cursorY*sY
		if(cursorX >= xS and cursorX <= xS+wS and cursorY >= yS and cursorY <= yS+hS) then
			return true
		else
			return false
		end
	end	
end

What wrong in this? No error/warning in debugscript.. 

Edited by Nerve

My servers:

Fun:

n-560x95_FFFFFF_FFFFFF_000000_000000.png

Derby(DD):

n-560x95_FFFFFF_FFFFFF_000000_000000.png

Posted

identifier this (fegyverek)

  • Like 1

RPG/CnR servers Developer , You want help ? contact me on discord >>>lilDawage#8508<<< i'm at your Service 10/24 hours 7/7 days , >>>Welcome<<<

Asking Discord Channel JOIN US ON here , you are welcome 10/24 active

Posted

Try this

[client-side]

function onClientClick(button, state)
	if button == "left" and state == "down" then
		for k, v in ipairs(fegyverek) do
			if isInBox(screenW * 0.5703, screenH * 0.2700+(elem * 49.5), screenW * 0.0656, screenH * 0.0269) then
				fegyver = k
			end
		end
		if isInBox(screenW * 0.5703, screenH * 0.2700+(elem * 49.5), screenW * 0.0656, screenH * 0.0269) then
			if fegyver == 3 then
				outputChatBox("asd")
			end
		end
	end
end
addEventHandler("onClientClick", root, onClientClick)

function isInBox(xS,yS,wS,hS)
    local sx,sy = getCursorPosition ()
    local fx,fy = guiGetScreenSize()
    
    cursorx,cursory = sx*fx,sy*fy

    if cursorx > xS and cursorx < xS + wS and cursory > yS and cursory < yS + hS then
        return true
    else
        return false
    end
end

EDIT: Not tested

  • Like 1

? DID I HELP YOU? 

Tsd6e1t.png

________________________________________________________________________

ム MY STEAM

76561198321211115.png

________________________________________________________________________

? MY SITE

cGejgxz.png

www.tommy.br.com

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...