Jump to content

Issues replacing..


Azu

Recommended Posts

I'm having issue.

I'm trying to place the model, col and txd, but it's not working at all. I try typing replace in the command box, but it not work. Also, I need it to replace on the start of the map.=/

meta

  
<meta> 
    <info gamemodes="race" type="map" name="Special Stage" author="Random" version="1.0.0" /> 
    <map src="[DM] RND Special Stage.map" dimension="0" /> 
    <settings> 
        <setting name="#minplayers" value="[ 0 ]" /> 
        <setting name="#maxplayers" value="[ 32 ]" /> 
        <setting name="#gravity" value="[ 0.008000 ]" /> 
        <setting name="#weather" value="[ 0 ]" /> 
        <setting name="#time" value="12:0" /> 
        <setting name="#locked_time" value="[ false ]" /> 
        <setting name="#waveheight" value="[ 0 ]" /> 
        <setting name="#gamespeed" value="[ 1 ]" /> 
    </settings> 
    <script src="Lift.lua" type="server" /> 
    <script src="replace_cl.lua" type="client" /> 
    <file src="vgssland01.txd" /> 
    <file src="vgsSairportland06.dff" /> 
    <file src="vgsSairportland06.col" /> 
  
</meta> 
  
  

replace_cl

  
function ReplaceObject ( ) 
  
txd = engineLoadTXD( "vgssland01.txd" ) 
col = engineLoadCOL( "vgsSairportland06.dff" ) 
dff = engineLoadDFF( "vgsSairportland06.col", 0 ) --modelid is everytime 0, when you replace no vehicle 
  
engineImportTXD( txd, 1234 ) 
engineReplaceCOL( col, 1234 ) 
engineReplaceModel( dff, 1234 )-- replace the model at least 
  
end 
  
addEvent ( "replaceObj", true ) 
addEventHandler ( "replaceObj", getRootElement(), ReplaceObject ) 
  

replace_sv

  
function ReplaceCommand ( ) 
triggerClientEvent( "replaceObj", getRootElement(), replaceObj ) 
end 
addCommandHandler( "replace", ReplaceCommand ) 
  

Link to comment

In your meta.xml file, where are you mentioning 'replace_sv' script?

add this

<script src="replace_sv.lua" type="server"/> 

to the meta.

also mark

    <file src="vgssland01.txd" /> 
    <file src="vgsSairportland06.dff" /> 
    <file src="vgsSairportland06.col" /> 

files as client type.

oh and,

@

Also, I need it to replace on the start of the map.

You can use onClientResourceStart for that,

r_Root = getResourceRootElement(getThisResource()) 
addEventHandler("onClientResourceStart",r_Root,function() 
txd = engineLoadTXD( "vgssland01.txd" ) 
col = engineLoadCOL( "vgsSairportland06.dff" ) 
dff = engineLoadDFF( "vgsSairportland06.col", 0 ) 
engineImportTXD( txd, 1234 ) --- REPLACE TEXTURE 
engineReplaceCOL( col, 1234 ) --- REPLACE COLLISION 
engineReplaceModel( dff, 1234 ) --- REPLACE DFF 
    end 
) 

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