Talk:Useful Functions: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Function not useful at all and wrongly located)
Line 2: Line 2:
enjoy
enjoy
[[User:Drline|Drline]] 04:44, 30 October 2012 (UTC)
[[User:Drline|Drline]] 04:44, 30 October 2012 (UTC)
== addAccountToConsole ==
{{Useful Function}}
__NOTOC__
This function add Account Console<br>
==Syntax==
<syntaxhighlight lang="lua">* accName addAccountToConsole ( thePlayer, accountName )</syntaxhighlight>
===Required Arguments===
* '''thePlayer''': Name the player who wants calculation mode .
* '''accountName''': The account you want to add .
==Example==
This example center the window.
<syntaxhighlight lang="lua">
    addAccountToConsole = function ( plr , name )
        if name and tostring ( name ) and plr and isElement ( plr ) and getElementType ( plr ) == 'player' then
            local acc = getPlayerAccount ( plr )
                if not acc or isGuestAccount ( acc ) then return end
                    if isObjectInACLGroup ( 'user.'.. getAccountName ( acc ) , aclGetGroup ( 'Console' ) ) then
                        if not isObjectInACLGroup ( 'user.'.. name , aclGetGroup ( 'Console' ) ) then
                            aclGroupAddObject ( aclGetGroup( 'Console' ), 'user.' .. name )
                else
                    return false
                end
            else 
                    return false
                end
        else
                return false
            end
        return name or false
    end
   
    addCommandHandler ( 'add_', function ( plr , _, name )
        local name = addAccountToConsole ( plr, name )
            if not name then return false end
                outputChatBox ( 'Warning ! the account : '.. name .. ' was added to console group !', root )
        end
    )</syntaxhighlight>
Author: The Best
==See Also==
{{Useful_Functions}}

Revision as of 13:38, 8 December 2014

there i wrote isElementInPhotograph() enjoy Drline 04:44, 30 October 2012 (UTC)