Jump to content

Working car indicators


Rolplay

Recommended Posts

20 minutes ago, Rolplay said:

It is good? 

You actually just need this on the clientside:

addEvent("onClientVehicleTurnOnIndicator", true);
addEventHandler("onClientVehicleTurnOnIndicator", root, function(left_indicator)
  end
);

addEvent("onClientVehicleTurnOffIndicator", true);
addEventHandler("onClientVehicleTurnOffIndicator", root, function(left_indicator)
  end
);

;) 

On the server-side you have to replace playerSource with client, replace localPlayer with client. Then you also used the wrong client event in the second event handler.

Link to comment

Like this? 

addEvent("onVehicleTurnOnIndicator", true);
addEventHandler("onVehicleTurnOnIndicator", root, function(rightindicator)
        local vehicle = getPedOccupiedVehicle (client)
        if vehicle then
            triggerClientEvent ( client, "onClientVehicleTurnOnIndicator", client)
        end
  end
);

addEvent("onVehicleTurnOffIndicator", true);
addEventHandler("onVehicleTurnOffIndicator", root, function(right_indicator)
     local vehicle = getPedOccupiedVehicle (client)
     if vehicle then
        triggerClientEvent ( client, "onClientVehicleTurnOffIndicator", client)
     end
  end
);


 

Link to comment

You really seem to do baby steps, don't you? ? I hope you do learn Lua this way, but I did a tiny mistake: remove the first argument to triggerClientEvent and set the (now) second argument to (in your case) vehicle. Honestly, I just try to play along with your code, even if you invent things! I helped you by putting the indicator type into the triggerClientEvent.

addEvent("onVehicleTurnOnIndicator", true);
addEventHandler("onVehicleTurnOnIndicator", root, function(rightindicator)
        local vehicle = getPedOccupiedVehicle (client)
        if vehicle then
            triggerClientEvent ( "onClientVehicleTurnOnIndicator", vehicle, rightindicator)
        end
  end
);

addEvent("onVehicleTurnOffIndicator", true);
addEventHandler("onVehicleTurnOffIndicator", root, function(right_indicator)
     local vehicle = getPedOccupiedVehicle (client)
     if vehicle then
        triggerClientEvent ( "onClientVehicleTurnOffIndicator", vehicle, right_indicator)
     end
  end
);

So this is the server-side portion of the script. Look at my advice again and try looking into the triggerServerEvent function for the client-side. ;) 

I am going to sleep now and will most likely be back tomorrow evening.

Edited by The_GTA
  • Like 1
Link to comment

I tryed this, but didn't work. 

addEvent("onClientVehicleTurnOnIndicator", true);
addEventHandler("onClientVehicleTurnOnIndicator", root, function(right_indicator)
	local vehicle = getPedOccupiedVehicle (client)
		if vehicle then
			triggerServerEvent ( "onVehicleTurnOnIndicator", vehicle, right_indicator)
		end
	end
);

addEvent("onClientVehicleTurnOffIndicator", true);
addEventHandler("onClientVehicleTurnOffIndicator", root, function(right_indicator)
	local vehicle = getPedOccupiedVehicle (client)
		if vehicle then
			triggerServerEvent ( "onVehicleTurnOffIndicator", vehicle, right_indicator)
		end
	end
);

GN :)

Link to comment
19 hours ago, Rolplay said:

I tryed this, but didn't work. 


addEvent("onClientVehicleTurnOnIndicator", true);
addEventHandler("onClientVehicleTurnOnIndicator", root, function(right_indicator)
	local vehicle = getPedOccupiedVehicle (client)
		if vehicle then
			triggerServerEvent ( "onVehicleTurnOnIndicator", vehicle, right_indicator)
		end
	end
);

addEvent("onClientVehicleTurnOffIndicator", true);
addEventHandler("onClientVehicleTurnOffIndicator", root, function(right_indicator)
	local vehicle = getPedOccupiedVehicle (client)
		if vehicle then
			triggerServerEvent ( "onVehicleTurnOffIndicator", vehicle, right_indicator)
		end
	end
);

GN :)

Haha, no no! That is not what you should do xD 

Let me explain. Inside the client events you should do what you previously did inside of the vehicle_left, vehicle_right key handlers! This is how your vehicle indicator scripts is executed on every game client on the server if one of them steers the vehicle left or right. Then you have to use triggerServerEvent inside of the vehicle_left and vehicle_right key handlers to send either onVehicleTurnOnIndicator or onVehicleTurnOffIndicator events, depending on if the key is pressed down or not. Imagine it like this:

8UpUnaq.png

So try moving around the code on the client-side. What is now inside the key handlers should be put into the onClientVehicleTurnOn/OffIndicator event handlers. Then add new code into the bind key handlers to call the server events.

  • Like 3
Link to comment

Ohh, thank you! I try to understand that.

I copied the server-side from here, and make this on client side: 

function right_indicator()
        local now = getTickCount();
		seat = getPedOccupiedVehicleSeat(localPlayer)
			if (indicator_right_on) then
				local passed_time_ms =--
				local period = --
				local vehicle = --
				if vehicle then
					dxSetShaderValue(shader_right, "intensity", 1,vehicle);
					triggerServerEvent("onVehicleTurnOnIndicator", root,right_indicator)
				end
				if (period == 0) then
					 dxSetShaderValue(shader_right, "intensity", 0,vehicle);
					 triggerServerEvent("onVehicleTurnOffIndicator", root,right_indicator)
				end
			end
    end
addEventHandler("onClientRender", root, right_indicator)
addEvent("onClientVehicleTurnOnIndicator", true);
addEventHandler("onClientVehicleTurnOnIndicator", root, function(right_indicator)
	function right_indicator()
        local now = getTickCount();
		seat = getPedOccupiedVehicleSeat(localPlayer)
			if (indicator_right_on) then
				local passed_time_ms =--
				local period = --
				local vehicle = --
				if vehicle then
					dxSetShaderValue(shader_right, "intensity", 1,vehicle);
					triggerServerEvent("onVehicleTurnOnIndicator", root,right_indicator)
				end
				if (period == 0) then
					 dxSetShaderValue(shader_right, "intensity", 0,vehicle);
					 triggerServerEvent("onVehicleTurnOffIndicator", root,right_indicator)
				end
			end
    end
);

 

Link to comment
51 minutes ago, Rolplay said:

Ohh, thank you! I try to understand that.

I copied the server-side from here, and make this on client side: 


function right_indicator()
        local now = getTickCount();
		seat = getPedOccupiedVehicleSeat(localPlayer)
			if (indicator_right_on) then
				local passed_time_ms =--
				local period = --
				local vehicle = --
				if vehicle then
					dxSetShaderValue(shader_right, "intensity", 1,vehicle);
					triggerServerEvent("onVehicleTurnOnIndicator", root,right_indicator)
				end
				if (period == 0) then
					 dxSetShaderValue(shader_right, "intensity", 0,vehicle);
					 triggerServerEvent("onVehicleTurnOffIndicator", root,right_indicator)
				end
			end
    end
addEventHandler("onClientRender", root, right_indicator)
addEvent("onClientVehicleTurnOnIndicator", true);
addEventHandler("onClientVehicleTurnOnIndicator", root, function(right_indicator)
	function right_indicator()
        local now = getTickCount();
		seat = getPedOccupiedVehicleSeat(localPlayer)
			if (indicator_right_on) then
				local passed_time_ms =--
				local period = --
				local vehicle = --
				if vehicle then
					dxSetShaderValue(shader_right, "intensity", 1,vehicle);
					triggerServerEvent("onVehicleTurnOnIndicator", root,right_indicator)
				end
				if (period == 0) then
					 dxSetShaderValue(shader_right, "intensity", 0,vehicle);
					 triggerServerEvent("onVehicleTurnOffIndicator", root,right_indicator)
				end
			end
    end
);

 

I found a lot of mistakes, and i recreate, this is my script now: 

Server-side of right indicator:

addEvent("onVehicleTurnOnIndicator", true);
addEventHandler("onVehicleTurnOnIndicator", root, function(right_indicator)
        local vehicle = getPedOccupiedVehicle (client)
        if vehicle then
            triggerClientEvent ( "onClientVehicleTurnOnIndicator", vehicle, right_indicator)
        end
  end
);

addEvent("onVehicleTurnOffIndicator", true);
addEventHandler("onVehicleTurnOffIndicator", root, function(right_indicator)
     local vehicle = getPedOccupiedVehicle (client)
     if vehicle then
        triggerClientEvent ( "onClientVehicleTurnOffIndicator", vehicle, right_indicator)
     end
  end
);

Client-side of left indicator event:

addEvent("onClientVehicleTurnOnIndicator", true);
addEventHandler("onClientVehicleTurnOnIndicator", root, function(right_indicator)
	local now = getTickCount();
			if (indicator_right_on) then
				local passed_time_ms = ...
				local period = 1 - ...
				local vehicle = getPedOccupiedVehicle (localPlayer)
				if vehicle then
					dxSetShaderValue(shader_right, "intensity", 1);
				end
			end
	end
);

addEvent("onClientVehicleTurnOffIndicator", true);
addEventHandler("onClientVehicleTurnOffIndicator", root, function(right_indicator)
    local vehicle = getPedOccupiedVehicle (client)
           if (indicator_right_on) then
				local passed_time_ms = ...
				local period = 1 - ....
				if (period == 0) then
					dxSetShaderValue(shader_right, "intensity", 0);
				end
			end
    end
);

 

Link to comment
8 hours ago, Rolplay said:

I found a lot of mistakes, and i recreate, this is my script now: 

Server-side of right indicator:

Client-side of left indicator event:

What is now [= the code you created in the quoted post above] inside of the client event handlers of onClientVehicleTurnOn/OffIndicator should go back into the onClientRender like we had when we finished the first two steps. The reason is: you must update the shader each game frame which is executed by onClientRender. I never said that you should copy the code out of the onClientRender event but the key handlers (the code inside of bindKey( a, b, function() CODE end ) ).

The idea is that you enable the shader by execution of the events. When you set the variable "indicator_right_on" to true and set the start time of the right indicator then you enabled the shader, in the script that we had after the first two points. Then to disable the shader you simply set indicator_right_on to false.

So I am going to repeat myself here... but:

9 hours ago, The_GTA said:

What is now [= after we finished the first two points] inside the key handlers should be put into the onClientVehicleTurnOn/OffIndicator event handlers. Then add new code into the bind key handlers [= where we moved the code out of] to call the server events.

 

Edited by The_GTA
Link to comment

Ohh, i think i understand but not 100% from this ?

Server: 

addEvent("onVehicleTurnOnIndicator", true);
addEventHandler("onVehicleTurnOnIndicator", root, function(right_indicator)
        local vehicle = getPedOccupiedVehicle (client)
        if vehicle then
            triggerClientEvent ( "onClientVehicleTurnOnIndicator", vehicle, right_indicator)
        end
  end
);

addEvent("onVehicleTurnOffIndicator", true);
addEventHandler("onVehicleTurnOffIndicator", root, function(right_indicator)
     local vehicle = getPedOccupiedVehicle (client)
     if vehicle then
        triggerClientEvent ( "onClientVehicleTurnOffIndicator", vehicle, right_indicator)
	end
  end
);

Client(key handler): 

local function vehicle_right_down()
	triggerServerEvent("onVehicleTurnOnIndicator", root,right_indicator)
end
bindKey("mouse2", "down", vehicle_right_down)


local function vehicle_right_up()
    triggerServerEvent("onVehicleTurnOffIndicator", root,right_indicator)
end
bindKey("mouse2", "up", vehicle_right_up)

Client(event):

addEvent("onClientVehicleTurnOnIndicator", true);
addEventHandler("onClientVehicleTurnOnIndicator", root, function(right_indicator)
	indicator_right_on = true;
	indicator_right_start = getTickCount();
end
);

addEvent("onClientVehicleTurnOffIndicator", true);
addEventHandler("onClientVehicleTurnOffIndicator", root, function(right_indicator)
	dxSetShaderValue(shader_right, "intensity", 0);
	indicator_right_on = false;
  end
);

Buuuuut, it is not working, so i failed again ?

  • Like 1
Link to comment
6 hours ago, Rolplay said:

Ohh, i think i understand but not 100% from this ?

Buuuuut, it is not working, so i failed again ?

Very good job! That is exactly the code that we need. You actually understood what I said a 100% ;) 

So the missing code on the clientside is just this:

addEventHandler("onClientRender", root, function()
        local now = getTickCount();

        if (indicator_right_on) then
            local passed_time_ms = now - indicator_right_start;
            local period = 1 - math.floor(( passed_time_ms / indicator_blink_duration_ms ) % 2);
            
            dxSetShaderValue(shader_right, "intensity", period);
        end
        
        -- TODO: add the same for the left indicator.
    end
);

This is code that was adjusted for the right blinker because you seem to have written logic for that one. By the way, I recommend you to pass the indicator side as first argument to the onClientVehicleTurnOn/OffIndicator event, like this...

local function vehicle_right_down()
	triggerServerEvent("onVehicleTurnOnIndicator", root, "right")
end
bindKey("mouse2", "down", vehicle_right_down)


local function vehicle_right_up()
    triggerServerEvent("onVehicleTurnOffIndicator", root, "right")
end
bindKey("mouse2", "up", vehicle_right_up)

because then we can use the same event for both the left and right hand side vehicle indicator lights. Good job so far! I tested the script and it works fine. Now try adding support for the left side indicator aswell.

To check if the event was triggered for the right indicator, do...

if (right_indicator == "right") then

and use "left" for the other side.

Edited by The_GTA
Link to comment
6 minutes ago, The_GTA said:

Very good job! That is exactly the code that we need. You actually understood what I said a 100% ;) 

So the missing code on the clientside is just this:


addEventHandler("onClientRender", root, function()
        local now = getTickCount();

        if (indicator_right_on) then
            local passed_time_ms = now - indicator_right_start;
            local period = 1 - math.floor(( passed_time_ms / indicator_blink_duration_ms ) % 2);
            
            dxSetShaderValue(shader_right, "intensity", period);
        end
        
        -- TODO: add the same for the left indicator.
    end
);

This is code that was adjusted for the right blinker because you seem to have written logic for that one. By the way, I recommend you to pass the indicator side as first argument to the onClientVehicleTurnOn/OffIndicator event, like this...


local function vehicle_right_down()
	triggerServerEvent("onVehicleTurnOnIndicator", root, "right")
end
bindKey("mouse2", "down", vehicle_right_down)


local function vehicle_right_up()
    triggerServerEvent("onVehicleTurnOffIndicator", root, "right")
end
bindKey("mouse2", "up", vehicle_right_up)

because then we can use the same event for both the left and right hand side vehicle indicator lights. Good job so far! I tested the script and it works fine. Now try adding support for the left side indicator aswell.

To check if the event was triggered for the right indicator, do...


if (right_indicator == "right") then

and use "left" for the other side.

I need to complete my original onclientrender with this, or i need to write an another?

addEventHandler("onClientRender", root, function()
        local now = getTickCount();

        if (indicator_right_on) then
            local passed_time_ms = now - indicator_right_start;
            local period = 1 - math.floor(( passed_time_ms / indicator_blink_duration_ms ) % 2);
            
            dxSetShaderValue(shader_right, "intensity", period);
        end
        
        -- TODO: add the same for the left indicator.
    end
);

 

Link to comment
Just now, Rolplay said:

I need to complete my original onclientrender with this, or i need to write an another?

It is always a good idea to compact your code as much as possible. But it does not matter if you use two onClientRender event handlers in this case ;) 

  • Like 1
Link to comment

So, the syncing is technically finished, right? :D I dont know, because i'm waiting my friend to check.

For now, please can you help me in "how to allow indicator lights for each vehicle separately?" :)

+1

local enabledVehicleMod = {}

addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function ()
    for index, value in ipairs (elements) do
        if tostring(index) ~= tostring(value) then 
            changeVehicleMod (value[1], value[2])
        end
    end
    for i=1 , 10000 do
        if not enabledVehicleMod[i] then
            enabledVehicleMod[i] = 1
        end
    end
end)

function changeVehicleMod (filename,id)
    if id and filename then
        if getVehicleNameFromModel(id) then
            if fileExists("vehicle/"..filename..".txd") then
                txd = engineLoadTXD("vehicle/"..filename..".txd", id )
                engineImportTXD(txd, id)
            end
            if fileExists("vehicle/"..filename..".dff") then
              dff = engineLoadDFF("vehicle/"..filename..".dff", id )
              engineReplaceModel(dff, id)
            end
        else
            outputChatBox("asd")
        end
    end
end

I have this vecihle import and works perfectly whit all cars, but if i want to import my own car it is not working

Error code: https://imgur.com/ytasGYP

Link to comment
11 minutes ago, Rolplay said:

So, the syncing is technically finished, right? :D I dont know, because i'm waiting my friend to check.

You should post the entire code so we can see what you have done. I cannot really tell what is missing otherwise. But have you added the check for left/right indicators in the event handlers, etc? We should first make sure that is working because the other step is much more difficult.

13 minutes ago, Rolplay said:

I have this vecihle import and works perfectly whit all cars, but if i want to import my own car it is not working

Please open a new thread for this topic because it seems unrelated to this.

Link to comment
2 minutes ago, The_GTA said:

You should post the entire code so we can see what you have done. I cannot really tell what is missing otherwise. But have you added the check for left/right indicators in the event handlers, etc? We should first make sure that is working because the other step is much more difficult.

local indicator_blink_duration_ms = 333;    -- time in milliseconds that the indicator should blink.
local indicator_left_on = false;    -- is the left indicator on?
local indicator_left_start;
local indicator_right_on = false;
local indicator_right_start;

local function vehicle_left_down()

	triggerServerEvent("onVehicleTurnOnIndicator", root, "left")
end
bindKey("mouse1", "down", vehicle_left_down)


local function vehicle_left_up()

	triggerServerEvent("onVehicleTurnOffIndicator", root, "left")
end
bindKey("mouse1", "up", vehicle_left_up)

function left_indicator()
        local now = getTickCount();
		seat = getPedOccupiedVehicleSeat(localPlayer)
		if seat and seat==0 then
			if (indicator_left_on) then
				local passed_time_ms = now - indicator_left_start;
				local period = 1 - math.floor(( passed_time_ms / indicator_blink_duration_ms ) % 2);
				local vehicle = getPedOccupiedVehicle (localPlayer)
				if vehicle then
					dxSetShaderValue(shader_left, "intensity", 1);
				end
				if (period == 0) then
					dxSetShaderValue(shader_left, "intensity", 0);
				end
			end
		else
			dxSetShaderValue(shader_left, "intensity", 0);
		end
        -- TODO: add the same for the right indicator.
    end
addEventHandler("onClientRender", root, left_indicator)
addEvent("onClientVehicleTurnOnIndicator", true);
addEventHandler("onClientVehicleTurnOnIndicator", root, function(left_indicator)
		if (left_indicator == "left") then
		indicator_left_on = true;
		indicator_left_start = getTickCount();
		end
		end
);

addEvent("onClientVehicleTurnOffIndicator", true);
addEventHandler("onClientVehicleTurnOffIndicator", root, function(left_indicator)
		if (left_indicator == "left") then
		dxSetShaderValue(shader_left, "intensity", 0);
		indicator_left_on = false;
		end
  end
);

This is the code of left side.

Link to comment
17 minutes ago, Rolplay said:

This is the code of left side.

Alright. So let's recall what I said last time:

Quote

here we require more book-keeping than previously: for every vehicle we should store the parameters left indicator on, right indicator on, left indicator start time, right indicator start time, left indicator shader, right indicator shader (shaders only on the clientside). Thus we need to create a table called "vehicle_indicator_lights" on both the server-side and the client-side. Using the events we created in point 1 we write data directly into the table instead of global variables.

We should start off with changing the client-side only. Here is an idea:

local vehicle_indicator_lights = {};

local function getVehicleIndicatorLights(vehicle)
  if (vehicle_indicator_lights[vehicle]) then
    return vehicle_indicator_lights[vehicle];
  end
  
  local info = {};
  info.indicator_left_on = false;
  info.indicator_left_start = false;
  info.indicator_right_on = false;
  info.indicator.right_start = false;
  info.vehicle = vehicle;
  -- TODO: create the left and right shaders and put them into the table.
  
  vehicle_indicator_lights[vehicle] = info;
  return info;
end

addEventHandler("onClientElementDestroy", root, function()
    if (getElementType(source) == "vehicle") then
      -- TODO: destroy the left and right shaders if vehicle_indicator_lights[source] is a table.
      
      vehicle_indicator_lights[source] = nil;
    end
  end
);

addEventHandler("onClientRender", root, function()
      for _,info in pairs(vehicle_indicator_lights) do
        local vehicle = info.vehicle;
      
        -- TODO: update the left and right vehicle indicator light shaders.
      end
    end
  end
);

-- TODO: update the remainder of the code to use the getVehicleIndicatorLights function: our onClient(...) events use the source global variable as vehicle element.

 

Edited by The_GTA
Link to comment
11 minutes ago, The_GTA said:

Alright. So let's recall what I said last time:

We should start off with changing the client-side only. Here is an idea:


local vehicle_indicator_lights = {};

local function getVehicleIndicatorLights(vehicle)
  if (vehicle_indicator_lights[vehicle]) then
    return vehicle_indicator_lights[vehicle];
  end
  
  local info = {};
  info.indicator_left_on = false;
  info.indicator_left_start = false;
  info.indicator_right_on = false;
  info.indicator.right_start = false;
  info.vehicle = vehicle;
  -- TODO: create the left and right shaders and put them into the table.
  
  vehicle_indicator_lights[vehicle] = info;
  return info;
end

addEventHandler("onClientElementDestroy", root, function()
    if (getElementType(source) == "vehicle") then
      -- TODO: destroy the left and right shaders if vehicle_indicator_lights[source] is a table.
      
      vehicle_indicator_lights[source] = nil;
    end
  end
);

addEventHandler("onClientRender", root, function()
      for _,info in pairs(vehicle_indicator_lights) do
        local vehicle = info.vehicle;
      
        -- TODO: update the left and right vehicle indicator light shaders.
      end
    end
  end
);

-- TODO: update the remainder of the code to use the getVehicleIndicatorLights function: our onClient(...) events use the source global variable as vehicle element.

 

I dont really understand what i need to do,so i updated my indicator_left and indicator_right code with this:

addEventHandler("onClientRender", root, function()
      for _,info in pairs(vehicle_indicator_lights) do
        local vehicle = info.vehicle;
      
        -- TODO: update the left and right vehicle indicator light shaders.
      end
    end
  end
);

And this is what i got: 

function left_indicator()
        local now = getTickCount();
		seat = getPedOccupiedVehicleSeat(localPlayer)
		for _,info in pairs(vehicle_indicator_lights) do
			local vehicle = info.vehicle;
			if seat and seat==0 then
				if (indicator_left_on) then
					--functions
				end
			else
				dxSetShaderValue(shader_left, "intensity", 0);
			end
		end
    end

It is good?

And if i add this to my code:

local info = {};
  info.indicator_left_on = false;
  info.indicator_left_start = false;
  info.indicator_right_on = false;
  info.indicator.right_start = false;
  info.vehicle = vehicle;

I need to delete this? 

local indicator_blink_duration_ms = 333;    -- time in milliseconds that the indicator should blink.
local indicator_left_on = false;    -- is the left indicator on?
local indicator_left_start;
local indicator_right_on = false;
local indicator_right_start;

And what do you mean in this? -- TODO: create the left and right shaders and put them into the table.

-- TODO: destroy the left and right shaders if vehicle_indicator_lights[source] is a table.

I dont really understand how tables are working :/

Link to comment
5 minutes ago, Rolplay said:

And this is what i got: 


function left_indicator()        local now = getTickCount();		seat = getPedOccupiedVehicleSeat(localPlayer)		for _,info in pairs(vehicle_indicator_lights) do			local vehicle = info.vehicle;			if seat and seat==0 then				if (indicator_left_on) then					--functions				end			else				dxSetShaderValue(shader_left, "intensity", 0);			end		end    end

It is good?

You have to remove lines 3 and 6 because they don't belong here, but this seat-checking logic does belong into the bind key handler. Idea: you should only trigger the onVehicleTurn(...) events if the localPlayer is the driver of his vehicle.

8 minutes ago, Rolplay said:

I need to delete this? 

Well, you have to delete it, of course. You should replace that portion with the getVehicleIndicatorLights function as well as that global table as well as that onClientElementDestroy handler. You have to fill in the blanks of course.

 

9 minutes ago, Rolplay said:

-- TODO: create the left and right shaders and put them into the table.

Take a look at the top of the script. You should see the code that creates the shaders. Use that code but put the shaders into the table instead (fieldsnames: shader_left, shader_right).

  • Like 1
Link to comment
4 hours ago, Rolplay said:

EDIT: We tested it again, and its visible, but only visible for other car drivers and passengers.

Did you use the code template that I posted for the left indicator lights (onClientRender)? And then modified it like you did before to include the for-pairs loop? Because you did some changes to it regarding vehicle seats and stuff that are buggy.

Link to comment

I found the bug, i have a line what i made for debug a bug. Without this if i left the car, and dont release the key button, the indicator is working.

seat = getPedOccupiedVehicleSeat(localPlayer)
		if seat then

So my idea is this: Turn on with mouse click and turn off with click again. Can u give me a function for this?

And now, i try to make the car indicator logic separated :D

Link to comment
10 minutes ago, Rolplay said:

So my idea is this: Turn on with mouse click and turn off with click again. Can u give me a function for this?

Hint: we need to move the code from the key "up" handler into the key "down" handler somehow.

  • Like 1
Link to comment
16 minutes ago, The_GTA said:

Hint: we need to move the code from the key "up" handler into the key "down" handler somehow.

Thank you, i made it :D The last part is the separate

+1: can you help me edit the shader, for fade in and fade out effect? Is that possible? I mean the texture appears smooth.

Edited by Rolplay
Link to comment
24 minutes ago, Rolplay said:

Thank you, i made it :D The last part is the separate

+1: can you help me edit the shader, for fade in and fade out effect? Is that possible? I mean the texture appears smooth.

Hint: you can calculate 1/2 plus the half of cosinus of a time-fraction multiplied by 2PI to get a wave-function between 0 and 1; by setting this value to the intensity shader variable you will get a "smooth" animation.

  • Like 1
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...