BorderLine Posted March 5, 2012 Posted March 5, 2012 I dont know very much how use the toogle fuction i have this.. how i can do to enable or disable mod with f6 for example function replaceModel() txd = engineLoadTXD("models/fbi.txd", 490 ) engineImportTXD(txd, 490) dff = engineLoadDFF("models/fbi.dff", 490 ) engineReplaceModel(dff, 490) end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel)
Castillo Posted March 5, 2012 Posted March 5, 2012 function replaceModel() if (txd and dff) then destroyElement(txd) destroyElement(dff) else txd = engineLoadTXD("models/fbi.txd", 490 ) engineImportTXD(txd, 490) dff = engineLoadDFF("models/fbi.dff", 490 ) engineReplaceModel(dff, 490) end end bindKey("F6","down",replaceModel) addEventHandler ( "onClientResourceStart", resourceRoot, replaceModel)
Kenix Posted March 5, 2012 Posted March 5, 2012 local txd, dff, state bindKey( 'F6', 'down', function( ) state = not state if state then txd = engineLoadTXD( 'models/fbi.txd', 490 ) engineImportTXD( txd, 490 ) dff = engineLoadDFF( 'models/fbi.dff', 490 ) engineReplaceModel( dff, 490 ) else destroyElement( txd ) destroyElement( dff ) end end )
Castillo Posted March 5, 2012 Posted March 5, 2012 I don't know, but I think my code should also work, I could have used a variable like you did, but I wanted to see if it was possible to make it without it.
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