Jump to content

is that true or no? (script)


iiv03

Recommended Posts

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
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 by Pirulax
Link to comment
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
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
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
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

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

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