Jump to content

couple questions (Help)


jkub

Recommended Posts

1) Is there any way I could make the in game screen render black and white ?(Maybe even control brightness or contrast)

2) I suppose the best route to render static effects on screen is to use dxLine functions. If so then what would be a good way to do so?

3) Is there a way to make a vehicle accelerate and follow a path without a player or ped being present to drive it? (Without forcing it using velocity changes)

I would greatly appreciate any help :)

Thanks

Link to comment
1. If you mean changing to grayscale color: no.

2. Unclear question. What do you mean, best way? "Static effects?"

3. No.

#2 I mean like static of an old tv. Sorry I coulden't find a good example but this just about sums up what I mean. This guy put this visual static effect on his video.VV

Link to comment

Would it be too much stress on the server or client to use onClientRender to draw the dxLines?

I usually use that for a lot of things now days and I am never able to remove the even right. even though I use

removeEventHandler ( "onClientRender", getRootElement(getLocalPlayer()), whateverTheFunctionIs )

Later in the debug it always seems to stay and it says that onClientRender is already handled. any thoughts?

Link to comment
Would it be too much stress on the server or client to use onClientRender to draw the dxLines?

I usually use that for a lot of things now days and I am never able to remove the even right. even though I use

removeEventHandler ( "onClientRender", getRootElement(getLocalPlayer()), whateverTheFunctionIs )

Later in the debug it always seems to stay and it says that onClientRender is already handled. any thoughts?

You have to use onClientRender to draw the lines, because it only draws them for one frame. It won't be any stress for the server, since it's clientside. The Client however may loose a considerable amount of fps, depending on how much static you draw and how.

I just made a quick test:

local w,h = guiGetScreenSize()
local startX = 1
local time = 0
local previousTime = nil
local direction = 1
local waitFor = 0
local static = {}
local amountOfStatic = 2
local waitChance = 1
function draw()
local amount = w/10
if not previousTime then
	previousTime = getTickCount()
return
end
 
 
if math.random(0,1000) == 0 then
return
end
time = time + getTickCount() - previousTime
previousTime = getTickCount()
 
for i=1,amountOfStatic do
if static[i] == nil then
		static[i] = {
			direction=1,
			waitFor=0,
			startX=0
}
end
if math.random(1,100*i*waitChance) == 1 then
		static[i].waitFor = getTickCount() + math.random(100,2000)
end
if static[i].waitFor > getTickCount() then
break
end
if math.random(1,20) == 1 and time > 1*1000 then
		static[i].startX = math.random(1,w)
time = 0
else
if math.random(1,20) == 1 then
			static[i].direction = math.random(-4,4)
end
		static[i].startX = static[i].startX + static[i].direction
end
local startX = static[i].startX
local startY = 1
while startY < h do
local length = math.random(1,6)
if math.random(1,4) == 1 then
local x = startX + math.random(1,2)
dxDrawLine(x,startY,x,startY+length,tocolor(255,255,255,math.random(80,150)))
end
if math.random(1,4) == 1 then
local x = startX + math.random(-30,30)
dxDrawLine(x,startY,x,startY+1,tocolor(255,255,255,math.random(100,255)))
end
		startY = startY + length
end
end
for i=1,amountOfStatic*10 do
local x = math.random(1,w)
local y = math.random(1,h)
local length = 1
local color = tocolor(255,255,255,math.random(100,255))
--dxDrawLine(x,y,x+1,y+length,color,1,true)
end
end
 
local showStatic = true
addCommandHandler("static",function()
if showStatic then
addEventHandler("onClientRender",getRootElement(),draw)
else
removeEventHandler("onClientRender",getRootElement(),draw)
end
showStatic = not showStatic
end)

Maybe it is useful for you, just play with it a bit. There may be better way to do it though. It also shows the addEventHandler/removeEventHandler which works fine for me.

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