Jump to content

HELP


WASSIm.

Recommended Posts

Posted

hi guys

i have problem if spawn vehicle or start resource all vehicle he make 99999999999999999999999 vehicles

i want just double

local vehicleBackLight = {} 
  
  
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), 
    function () 
        for k, theVehicle in ipairs ( getElementsByType( "vehicle" ) ) do 
        if not ( vehicleBackLight[theVehicle] ) then 
                local x,y,z = getElementPosition( theVehicle ) 
                local id = getElementModel ( theVehicle ) 
                vehicleBackLight[theVehicle] = createVehicle ( id, x, y, z )  
                attachElements ( vehicleBackLight[theVehicle], theVehicle, 0, 0, 0, 0, 0, 180 ) 
            end 
        end 
    end 
) 
  
addEventHandler( "onClientElementStreamIn", root, 
    function() 
        if ( getElementType( source ) == "vehicle" ) then 
        if not ( vehicleBackLight[source] ) then 
                local x,y,z = getElementPosition( source ) 
                local id = getElementModel ( source ) 
                vehicleBackLight[source] = createVehicle ( id, x, y, z )  
                attachElements ( vehicleBackLight[source], source, 0, 0, 1, 0, 0, 180 ) 
            end 
        end 
    end 
) 

Posted

Replace line 20 with this:

if not (vehicleBackLight[source]) and not isElementAttached(source) then 

And don't forget to fix the offset of attachElements at line 11 to be like line 24.

And you have to find a way to get them out of the table when the vehicle destroyed.

Posted

If it was created client side you won't be able to enter it.

If it was server side vehicle, you can enter it but not drive because probably it will lose its gravity.

Posted

good

i have other problem

its not working and no error

addEventHandler ( "onClientResourceStart", getResourceRootElement( getThisResource() ), 
    function ( ) 
        for k, theVehicle in ipairs ( getElementsByType( "vehicle" ) ) do 
            if (getElementData(theVehicle,"BackLight")) then 
                local texture = dxCreateTexture ( "light.png", "dxt5" ) 
                local shader = dxCreateShader ( "texture.fx" ) 
                dxSetShaderValue ( shader, "gTexture", texture ) 
                --shader replaced 
                engineApplyShaderToWorldTexture ( shader, "headlight1", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "headlight", theVehicle ) 
                --shader removed 
                engineApplyShaderToWorldTexture ( shader, "coronastar", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "coronaringb", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "coronareflect", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "shad_bike", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "shad_car", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "shad_exp", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "shad_ped", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "shad_heli", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "shad_rcbaron", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "coronaheadlightline", theVehicle ) 
            end 
        end 
    end 
) 
  
addEventHandler ( "onClientResourceStart", root, 
    function ( ) 
        if (getElementType ( source ) == "vehicle" ) then 
            if (getElementData(source,"BackLight")) then 
                local texture = dxCreateTexture ( "light.png", "dxt5" ) 
                local shader = dxCreateShader ( "texture.fx" ) 
                dxSetShaderValue ( shader, "gTexture", texture ) 
                --shader replaced 
                engineApplyShaderToWorldTexture ( shader, "headlight1", source ) 
                engineApplyShaderToWorldTexture ( shader, "headlight", source ) 
                --shader removed 
                engineApplyShaderToWorldTexture ( shader, "coronastar", source ) 
                engineApplyShaderToWorldTexture ( shader, "coronaringb", source ) 
                engineApplyShaderToWorldTexture ( shader, "coronareflect", source ) 
                engineApplyShaderToWorldTexture ( shader, "shad_bike", source ) 
                engineApplyShaderToWorldTexture ( shader, "shad_car", source ) 
                engineApplyShaderToWorldTexture ( shader, "shad_exp", source ) 
                engineApplyShaderToWorldTexture ( shader, "shad_ped", source ) 
                engineApplyShaderToWorldTexture ( shader, "shad_heli", source ) 
                engineApplyShaderToWorldTexture ( shader, "shad_rcbaron", source )                 
                engineApplyShaderToWorldTexture ( shader, "coronaheadlightline", source ) 
            end 
        end 
    end 
) 

Posted
addEventHandler ( "onClientResourceStart", root, 
    function ( ) 
        if (getElementType ( source ) == "vehicle" ) then 

Are you kidding me !

Hows the source would be a vehicle ?!

Posted

oh opss

addEventHandler ( "onClientResourceStart", getResourceRootElement( getThisResource() ), 
    function ( ) 
        for k, theVehicle in ipairs ( getElementsByType( "vehicle" ) ) do 
            if (getElementData(theVehicle,"BackLight")) then 
                local texture = dxCreateTexture ( "light.png", "dxt5" ) 
                local shader = dxCreateShader ( "texture.fx" ) 
                dxSetShaderValue ( shader, "gTexture", texture ) 
                --shader replaced 
                engineApplyShaderToWorldTexture ( shader, "headlight1", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "headlight", theVehicle ) 
                --shader removed 
                engineApplyShaderToWorldTexture ( shader, "coronastar", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "coronaringb", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "coronareflect", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "shad_bike", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "shad_car", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "shad_exp", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "shad_ped", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "shad_heli", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "shad_rcbaron", theVehicle ) 
                engineApplyShaderToWorldTexture ( shader, "coronaheadlightline", theVehicle ) 
            end 
        end 
    end 
) 
  
addEventHandler ( "onClientElementStreamIn", root, 
    function ( ) 
        if (getElementType ( source ) == "vehicle" ) then 
            if (getElementData(source,"BackLight")) then 
                local texture = dxCreateTexture ( "light.png", "dxt5" ) 
                local shader = dxCreateShader ( "texture.fx" ) 
                dxSetShaderValue ( shader, "gTexture", texture ) 
                --shader replaced 
                engineApplyShaderToWorldTexture ( shader, "headlight1", source ) 
                engineApplyShaderToWorldTexture ( shader, "headlight", source ) 
                --shader removed 
                engineApplyShaderToWorldTexture ( shader, "coronastar", source ) 
                engineApplyShaderToWorldTexture ( shader, "coronaringb", source ) 
                engineApplyShaderToWorldTexture ( shader, "coronareflect", source ) 
                engineApplyShaderToWorldTexture ( shader, "shad_bike", source ) 
                engineApplyShaderToWorldTexture ( shader, "shad_car", source ) 
                engineApplyShaderToWorldTexture ( shader, "shad_exp", source ) 
                engineApplyShaderToWorldTexture ( shader, "shad_ped", source ) 
                engineApplyShaderToWorldTexture ( shader, "shad_heli", source ) 
                engineApplyShaderToWorldTexture ( shader, "shad_rcbaron", source )                 
                engineApplyShaderToWorldTexture ( shader, "coronaheadlightline", source ) 
            end 
        end 
    end 
) 

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