Jump to content

Recommended Posts

Estou fazendo um painel "gráfico" para poder mexer em algumas configurações comuns do jogo de forma mais rápida..

Entretanto, as minhas funções das scrollbars estão duplicando uma na outra. 

 

local maxFarClip = 70
local maxVLodDistance = 500
local Farclip = getFarClipDistance()
local VLodDistance, PFLoddistance = getVehiclesLODDistance()

local screenW, screenH = guiGetScreenSize()
Window = guiCreateWindow((screenW - 470) / 2, (screenH - 643) / 2, 470, 643, "Graphics Painel", false)
DrawDistanceLabel = guiCreateLabel(20, 40, 140, 18, "World Draw Distance: " ..Farclip, false, Window)
DrawDistanceScroll = guiCreateScrollBar(180, 40, 290, 18, true, false, Window)

VDrawDistanceLabel = guiCreateLabel(20, 70, 140, 18, "Vehicles Draw Distance: " ..VLodDistance, false, Window)
VDrawDistanceScroll = guiCreateScrollBar(180, 70, 290, 18, true, false, Window)

function ToggleDrawDistance(scrollBar)
	--outputChatBox("The new scroll position is "..guiScrollBarGetScrollPosition(DrawDistanceScroll))
	setFarClipDistance( guiScrollBarGetScrollPosition(DrawDistanceScroll)* maxFarClip )
	Farclip = guiScrollBarGetScrollPosition(DrawDistanceScroll)* maxFarClip
	guiSetText (DrawDistanceLabel, "World Draw Distance: " ..Farclip)
end
addEventHandler("onClientGUIScroll", getRootElement(), ToggleDrawDistance)

function ToggleVDrawDistance(scrollBar)
	outputChatBox("The new scroll position is "..guiScrollBarGetScrollPosition(VDrawDistanceScroll))
	setVehiclesLODDistance( guiScrollBarGetScrollPosition(vDrawDistanceScroll)* maxVLodDistance )
	VLodDistance = guiScrollBarGetScrollPosition(vDrawDistanceScroll)* maxVLodDistance
	guiSetText (vDrawDistanceLabel, "Vehicles Draw Distance: " ..VLodDistance)
end
addEventHandler("onClientGUIScroll", getRootElement(), ToggleVDrawDistance)

Ainda que eu coloque no argumento das funções o elemento scrollBar, exemplo..

function ToggleDrawDistance(DrawDistanceScroll)

e na segunda

function ToggleVDrawDistance(vDrawDistanceScroll)

O erro continua e fica bugadão inclusive rs

O único erro apontado no debug é 
"Bad argument @ 'guiScrollBarGetScrollPosition'[Expected gui-element at argument 1, got nil] [DUP x8]"

Que afinal não faz sentindo por que também estão corretos, creio eu!

 

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