BorderLine Posted March 5, 2012 Share 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) Link to comment
Castillo Posted March 5, 2012 Share 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) Link to comment
BorderLine Posted March 5, 2012 Author Share Posted March 5, 2012 bad element pointer destroyelement(1) Link to comment
Kenix Posted March 5, 2012 Share 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 ) Link to comment
Castillo Posted March 5, 2012 Share 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. Link to comment
BorderLine Posted March 6, 2012 Author Share Posted March 6, 2012 working..! thx kenix Link to comment
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