IsTransferBoxActive: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
 
(12 intermediate revisions by 7 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Client function}}
{{Client function}}
This function returns whether the transferbox is visible or not.
This function returns whether the file downloading dialog box is active or not. This appears when a resource is started and the client doesn't have all the files that resource requires the client to have.
 
It's important to note that resources aren't started on the client until they're completely downloaded, so a resource cannot use this function to detect if it's own files are downloaded. A client-side resource triggers the [[onClientResourceStart]] event when the files it requires are downloaded.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool isTransferBoxActive ()
bool isTransferBoxActive ()
</syntaxhighlight>  
</syntaxhighlight>
{{OOP||[[GUI widgets|GuiElement]].isTransferBoxActive||}}


===Returns===
===Returns===
Returns ''true'' if the transferbox is visible, ''false'' if not.
Returns ''true'' if the file transfer box is visible, ''false'' if not.


==Example==  
==Example==  
 
This makes the camera fade in, once all resource downloads are finished.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function OnClientResrcStart(resourcename)
function checkTransfer()
if(resourcename==getThisResource()) then
    if isTransferBoxActive() then
CheckTransfere()
        setTimer(checkTransfer, 2000, 1) -- TransferBox is still active, check again after 2 seconds.
end
    else  
end
        fadeCamera(true) -- TransferBox isn't active, fade in camera.
function CheckTransfere()
    end
if isTransferBoxActive() == true then
setTimer(CheckTransfere,2000,1) -- Check again after 2 seconds
else fadeCamera(true) -- TransferBox isnt active, fade in camera
end
end
end
addEventHandler("onClientResourceStart",getRootElement(),OnClientResrcStart)
addEventHandler("onClientResourceStart", resourceRoot, checkTransfer)
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{GUI_functions}}
{{GUI_functions}}
[[Category:Needs Example]]
{{GUI_events}}

Latest revision as of 12:02, 4 October 2020

This function returns whether the file downloading dialog box is active or not. This appears when a resource is started and the client doesn't have all the files that resource requires the client to have.

It's important to note that resources aren't started on the client until they're completely downloaded, so a resource cannot use this function to detect if it's own files are downloaded. A client-side resource triggers the onClientResourceStart event when the files it requires are downloaded.

Syntax

bool isTransferBoxActive ()

OOP Syntax Help! I don't understand this!

Method: GuiElement.isTransferBoxActive(...)


Returns

Returns true if the file transfer box is visible, false if not.

Example

This makes the camera fade in, once all resource downloads are finished.

function checkTransfer()
    if isTransferBoxActive() then
        setTimer(checkTransfer, 2000, 1) -- TransferBox is still active, check again after 2 seconds.
    else 
        fadeCamera(true) -- TransferBox isn't active, fade in camera.
    end
end
addEventHandler("onClientResourceStart", resourceRoot, checkTransfer)

See Also

General functions

Browsers

Buttons

Checkboxes

Comboboxes

Edit Boxes

Gridlists

Memos

Progressbars

Radio Buttons

Scrollbars

Scrollpanes

Static Images

Tab Panels

Tabs

Text Labels

Windows

Input

GUI