WASSIm. Posted July 21, 2013 Posted July 21, 2013 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 )
TAPL Posted July 21, 2013 Posted July 21, 2013 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.
WASSIm. Posted July 21, 2013 Author Posted July 21, 2013 thank you i want ask. exm if setElementCollisionsEnabled(vehicle,false) can entred vehicle ?
TAPL Posted July 21, 2013 Posted July 21, 2013 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.
WASSIm. Posted July 21, 2013 Author Posted July 21, 2013 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 )
Blaawee Posted July 21, 2013 Posted July 21, 2013 addEventHandler ( "onClientResourceStart", root, function ( ) if (getElementType ( source ) == "vehicle" ) then Are you kidding me ! Hows the source would be a vehicle ?!
WASSIm. Posted July 22, 2013 Author Posted July 22, 2013 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 )
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now