Jump to content

[HELP] function


Spesso

Recommended Posts

hey guys, i wanna i little help, i created this function

function helloCommand ( playerSource, commandName )

local theTriggerer = getPlayerName ( playerSource )

triggerClientEvent ( "onHello", getRootElement() )

outputChatBox ( theTriggerer .. ": #00FF00Hello Man!", getRootElement(), 255, 255, 255, true )

end

but i wanna add this function works only for admin and donators, and idk how do it. anyone help me pls

Link to comment

For admins you can use:

getAccountName 
getPlayerAccount 
isObjectInACLGroup 
aclGetGroup 

For donators you have to make your own donators system which means every donator, you store them in an XML file or a database or something like that, afterwards you make a custom function to check whether a player is a donator and use it when needed.

Link to comment

Try this not tested

function helloCommand ( playerSource, commandName, acc ) 
local accName = getAccountName ( acc ) 
local theTriggerer = getPlayerName ( playerSource ) 
triggerClientEvent ( "onHello", getRootElement() ) 
    if isObjectInACLGroup ( "user." .. accName, aclGetGroup ( "Admin" )) then 
    outputChatBox ( theTriggerer .. ": #00FF00Hello Man!", getRootElement(), 255, 255, 255, true ) 
    else 
    outputChatBox ( "You can't use this command!", getRootElement(), 255, 0, 0, true) 
    end 
end 

Link to comment
  
function helloCommand ( playerSource, commandName, acc ) 
local account = getPlayerAccount( playerSource ) 
local accName = getAccountName( account ) 
local theTriggerer = getPlayerName ( playerSource ) 
triggerClientEvent ( "onHello", getRootElement() ) 
    if isObjectInACLGroup ( "user." .. accName, aclGetGroup ( "Admin" )) or isObjectInACLGroup ( "user." .. accName, aclGetGroup ( "SuperModerator" )) then 
    outputChatBox ( theTriggerer .. ": #00FF00Hello Man!", getRootElement(), 255, 255, 255, true ) 
    else 
    outputChatBox ( "You can't use this command!", getRootElement(), 255, 0, 0, true) 
    end 
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...