OnClientFileDownloadComplete: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "my test example until I get a chance to document properly <syntaxhighlight lang="lua"> function onStart ( ) outputChatBox ( "downloading test.mp3" ) downloadFile ( "test.mp3" ) end addEventH...")
 
No edit summary
Line 1: Line 1:
__NOTOC__
{{Client event}}
my test example until I get a chance to document properly
my test example until I get a chance to document properly


Line 23: Line 26:
addEventHandler ( "onFileDownloadComplete", getRootElement(), onDownloadFinish )
addEventHandler ( "onFileDownloadComplete", getRootElement(), onDownloadFinish )
</syntaxhighlight>
</syntaxhighlight>
==See Also==
===Other client events===
{{Client_other_events}}

Revision as of 11:20, 22 February 2012

my test example until I get a chance to document properly

function onStart ( )
	outputChatBox ( "downloading test.mp3" )
	downloadFile ( "test.mp3" )
end
addEventHandler ( "onClientResourceStart", getRootElement(), onStart )

function onDownloadFinish ( file, success )
	if ( success ) then
		if ( file == "test.mp3" ) then
			outputChatBox ( "test.mp3 downloaded successfully" )
			playSound ( "test.mp3" )
			outputChatBox ( "playing test.mp3" )
		end
	else
		if ( file == "test.mp3" ) then
			outputChatBox ( "test.mp3 failed to download" )
		end
	end
end
addEventHandler ( "onFileDownloadComplete", getRootElement(), onDownloadFinish )

See Also

Other client events