Jump to content

Problem with gates and with replacing cars


Eagler

Recommended Posts

Client   

gate = createObject( 3055, 2335.1005859375, 2443.7001953125, 7 ) 
   setElementRotation ( gate, 0, 0, 59.996337890625 )  
   gatecol = createColCircle ( 15, 15, 15 ) 
  
function openagates(thePlayer) 
        if getElementModel( thePlayer ) == 217 then 
        moveObject ( gate, 3055, 2335.1005859375, 2443.7001953125, 12 ) 
        end 
end 
addEventHandler( "onColShapeHit", gatecol, openagates ) 
  
function closeagates(thePlayer) 
        if getElementModel( thePlayer ) == 217 then 
       moveObject (gate1, 5000, 2335.1005859375, 2443.7001953125, 7) 
        end 
end 
addEventHandler( "onColShapeLeave", gatecol, closeagates ) 

Meta

<meta> 
<info type="script" name="LVPD" author="." version="1.0.0" />  
<script src="client.lua" type="server" /> 
</meta>

 

Car problem

function replaceModel()
txd = engineLoadTXD('car.txd',596)
engineImportTXD(txd,596)
dff = engineLoadDFF('car.dff',596)
engineReplaceModel(dff,596)
end
addEventHandler ( 'onClientResourceStart', getResourceRootElement(getThisResource()), replaceModel)
addCommandHandler ( 'reloadcar', replaceModel )

 

<meta>
<info author="." description="LSP" version="1.3" type="script" />
<script src="client.lua" type="server"/>
<file src="car.txd" type="client"/>
<file src="car.dff" type="client"/>
</meta> 

 

Link to comment

Here's my car replace script, just replace the car ID and file names.

client.lua

function CarModel() 	
txd = engineLoadTXD ( "BMW.txd" )                 
engineImportTXD ( txd, 451 ) 
dff = engineLoadDFF ( "BMW.dff", 451 )          
engineReplaceModel ( dff, 451 ) 
end
addEventHandler('onClientResourceStart', resourceRoot, CarModel)
addCommandHandler ( 'reloadcar', CarModel )

function Timer()
setTimer(CarModel, 500, 1)
end
addEventHandler('onClientResourceStart', resourceRoot, Timer)

meta.xml

<meta>
<file src="BMW.txd" />
<file src="BMW.dff" />
<script src="BMW.lua" type="client" />
</meta>

 

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