OnClientFileDownloadComplete

From Multi Theft Auto: Wiki
Revision as of 23:31, 21 February 2012 by OpenIDUser34 (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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 )