iiv03 Posted August 15, 2018 Share Posted August 15, 2018 myImage = guiCreateStaticImage(100, 100, 100, 100, "skin1.png", false) addEventHandler("onClientGUIClick", myImage, function skincars() local txd = engineLoadTXD ( "skin1.txd" ) engineImportTXD ( txd, [411] ) local dff = engineLoadDFF ( "skin1.dff", [411] ) engineReplaceModel ( dff, [411] ) end addEventHandler("onClientResourceStart", getRootElement(), skincars) end) Is this true or not? What is the script if the player pressed the picture to give him a skin for a car? Link to comment
Discord Moderators Pirulax Posted August 15, 2018 Discord Moderators Share Posted August 15, 2018 (edited) addEventHandler("onClientGUIClick", guiCreateStaticImage(100, 100, 100, 100, "skin1.png", false), function() engineImportTXD(engineLoadTXD ("skin1.txd"), 411) engineReplaceModel(engineLoadDFF("skin1.dff"), 411) end, false) btw, what's the problem? Edit: Indentation is wrong.. again.. Edited August 15, 2018 by Pirulax Link to comment
iiv03 Posted August 15, 2018 Author Share Posted August 15, 2018 1 hour ago, Pirulax said: addEventHandler("onClientGUIClick", guiCreateStaticImage(100, 100, 100, 100, "skin1.png", false), function() engineImportTXD(engineLoadTXD ("skin1.txd"), 411) engineReplaceModel(engineLoadDFF("skin1.dff"), 411) end, false) btw, what's the problem? Edit: Indentation is wrong.. again.. its not working he say : ERROR: Loading script failed: skinecars\client.lua:28 ')' expected near 'false' And line : addEventHandler("onClientGUIClick", guiCreateStaticImage(100, 100, 100, 100, "skin1.png", false), Link to comment
VenomOG Posted August 15, 2018 Share Posted August 15, 2018 5 minutes ago, liwahadri said: its not working he say : ERROR: Loading script failed: skinecars\client.lua:28 ')' expected near 'false' And line : addEventHandler("onClientGUIClick", guiCreateStaticImage(100, 100, 100, 100, "skin1.png", false), wrong addEventHandler("onClientGUIClick", guiCreateStaticImage(100, 100, 100, 100, "skin1.png", false), heres fixed : addEventHandler("onClientGUIClick", whatevertheguiname, function() -----YOURCODES end) Link to comment
XaskeL Posted August 15, 2018 Share Posted August 15, 2018 myImage = guiCreateStaticImage(100, 100, 100, 100, "skin1.png", false) addEventHandler("onClientGUIClick", myImage, function() local txd = engineLoadTXD("skin1.txd") -- correct your path to model! (txd) engineImportTXD(txd,411) -- local dff = engineLoadDFF("skin1.dff",411) -- correct your path to model! (dff) engineReplaceModel(dff,411) end,false ); A script is a sequence of actions. Like in a movie. "The player pressed the picture -> a function has been called that has a body of actions -> replaces the model of the machine (ID 411) -> the event ends. Link to comment
iiv03 Posted August 15, 2018 Author Share Posted August 15, 2018 31 minutes ago, XaskeL said: myImage = guiCreateStaticImage(100, 100, 100, 100, "skin1.png", false) addEventHandler("onClientGUIClick", myImage, function() local txd = engineLoadTXD("skin1.txd") -- correct your path to model! (txd) engineImportTXD(txd,411) -- local dff = engineLoadDFF("skin1.dff",411) -- correct your path to model! (dff) engineReplaceModel(dff,411) end,false ); A script is a sequence of actions. Like in a movie. "The player pressed the picture -> a function has been called that has a body of actions -> replaces the model of the machine (ID 411) -> the event ends. Ok, but I want a script if I click on a player that gives him a skin for a car. Do you help me please? Link to comment
Keiichi1 Posted August 15, 2018 Share Posted August 15, 2018 Client: addEventHandler("onClientGUIClick", guiCreateStaticImage(100, 100, 100, 100, "skin1.png", false), function() engineImportTXD(engineLoadTXD("skin1.txd"), 411) engineReplaceModel(engineLoadDFF("skin1.dff"), 411) end) bindKey("m", "down", function() showCursor(not isCursorShowing()) end) Meta: <meta> <script src="client.lua" type="client" /> <file src="skin1.png" /> <file src="skin1.dff" /> <file src="skin1.txd" /> </meta> Works perfectly, press 'M' to show/hide cursor. Link to comment
iiv03 Posted August 15, 2018 Author Share Posted August 15, 2018 20 minutes ago, Keiichi1 said: Client: addEventHandler("onClientGUIClick", guiCreateStaticImage(100, 100, 100, 100, "skin1.png", false), function() engineImportTXD(engineLoadTXD("skin1.txd"), 411) engineReplaceModel(engineLoadDFF("skin1.dff"), 411) end) bindKey("m", "down", function() showCursor(not isCursorShowing()) end) Meta: <meta> <script src="client.lua" type="client" /> <file src="skin1.png" /> <file src="skin1.dff" /> <file src="skin1.txd" /> </meta> Works perfectly, press 'M' to show/hide cursor. I got error line:22 expeted (to close '(' at line 21) near 'engineImportTXD' please fix this My Client : GUIEditor = { button = {}, window = {}, staticimage = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(405, 73, 470, 574, "× [ Skins Cars ] ×", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) left = guiCreateButton(24, 508, 136, 47, "Left", false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(24, 508, 136, 47, "Left", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "default-bold-small") right = guiCreateButton(314, 508, 136, 47, "Right", false, GUIEditor.window[1]) guiSetFont(right, "default-bold-small") GUIEditor.staticimage[1] = guiCreateStaticImage(103, 58, 266, 412, "skin1.png", false, GUIEditor.window[1]) showCursor(false) end ) addEventHandler("onClientGUIClick", guiCreateStaticImage(103, 58, 266, 412, "skin1.png", false) engineImportTXD(engineLoadTXD("skin1.txd"), 411) engineReplaceModel(engineLoadDFF("skin1.txd"), 411) end) bindKey ("m", "down", function () showCursor(not isCursorShowing()) end) Link to comment
Keiichi1 Posted August 15, 2018 Share Posted August 15, 2018 My code doesn't even have line 22. Link to comment
iiv03 Posted August 15, 2018 Author Share Posted August 15, 2018 1 minute ago, Keiichi1 said: My code doesn't even have line 22. What is probleme? Link to comment
XaskeL Posted August 16, 2018 Share Posted August 16, 2018 8 hours ago, liwahadri said: Ok, but I want a script if I click on a player that gives him a skin for a car. Do you help me please? tell us more Link to comment
Discord Moderators Pirulax Posted August 16, 2018 Discord Moderators Share Posted August 16, 2018 Jesus Christ.. I don't know what kind of :~ habbit is to put a variable for a value that you only use ONCE. Please god, not, just no. Link to comment
JeViCo Posted August 16, 2018 Share Posted August 16, 2018 (edited) 12 hours ago, XaskeL said: tell us more i think this guy gave us enough information @liwahadri you should learn more because your second function is totally wrong Anyway, click here and have fun Edited August 16, 2018 by JeViCo Link to comment
iiv03 Posted August 16, 2018 Author Share Posted August 16, 2018 2 hours ago, JeViCo said: i think this guy gave us enough information @liwahadri you should learn more because your second function is totally wrong Anyway, click here and have fun Thhhhannnks 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