Sign in to follow this  
Spesso

[HELP] function

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

Share this post


Link to post

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.

Share this post


Link to post

if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ))

this?

Share this post


Link to post
For donators you have to make your own donators system

No you can create a donator group in the ACL just like for the admins and manually put the donators in that group.

Share this post


Link to post
if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ))

this?

if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" )) then 

Share this post


Link to post

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 

Share this post


Link to post
  
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 

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.