Jump to content

ACL group can use command


JoZeFSvK

Recommended Posts

Hey i wanna create when player will in alc group etc. vip then he can use command. how i create it ? can you show me example ?

  
local restriction = {} 
function fck(player, cmd) 
    if (not restriction[player]) then restriction[player] = {} end 
    if not restriction[player][cmd] then 
        outputChatBox("#FFFFFF".. getPlayerName(player) .."#5DACD1 says: F*ck You! ", root, 255, 255, 255, true) 
        restriction[player][cmd] = true 
        setTimer(function () restriction[player][cmd] = false end, 5000, 1) 
    else 
        outputChatBox("#FF0000[Commands]: You must wait #FFFFFF5 seconds#FF0000 to write this command again.", player, 255, 255, 255, true) 
    end 
end 
addCommandHandler("fu", fck) 
  

how i add here "when player is acl gorup vip" ?

Link to comment
  
accountname = getAccountName (getPlayerAccount(playerElement)) 
      if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "vip" ) ) then 
local restriction = {} 
function fck(player, cmd) 
    if (not restriction[player]) then restriction[player] = {} end 
    if not restriction[player][cmd] then 
        outputChatBox("#FFFFFF".. getPlayerName(player) .."#5DACD1 says: F*ck You! ", root, 255, 255, 255, true) 
        restriction[player][cmd] = true 
        setTimer(function () restriction[player][cmd] = false end, 5000, 1) 
    else 
        outputChatBox("#FF0000[Commands]: You must wait #FFFFFF5 seconds#FF0000 to write this command again.", player, 255, 255, 255, true) 
    end 
end 
addCommandHandler("fu", fck) 
  

Link to comment
Apply this to your code:
      accountname = getAccountName (getPlayerAccount(playerElement)) 
      if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( vip" ) ) then 
  
 

You should edit the "playerElement" ofcourse, etc.

      accountname = getAccountName (getPlayerAccount(playerElement)) 
      if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "vip" ) ) then 
  

Fixed, you forgot the opening " to vip.

Link to comment
local restriction = {} 
  
function fck ( player, cmd ) 
    accountname = getAccountName ( getPlayerAccount ( player ) ); 
    if not isObjectInACLGroup ( 'user.' .. accountname, aclGetGroup ( 'vip' ) ) then return end 
    if not restriction[player] then restriction[player] = {} end 
    if not restriction[player][cmd] then 
        outputChatBox ( '#FFFFFF'.. getPlayerName(player) ..'#5DACD1 says: F*ck You! ', root, 255, 255, 255, true ); 
        restriction[player][cmd] = true 
        setTimer ( function ( ) restriction[player][cmd] = false end, 5000, 1 ); 
    else 
        outputChatBox ( '#FF0000[Commands]: You must wait #FFFFFF5 seconds#FF0000 to write this command again.', player, 255, 255, 255, true ); 
    end 
end 
addCommandHandler( 'fu', fck ); 

Link to comment

agrh i have problem again :( i dont know where is problem :(

Client

function hell ( onPlayerHell )  
    local sound = playSound("song/hell.mp3")  
    setSoundVolume(sound, 0.5)  
end 
addEventHandler("onPlayerHell", getLocalPlayer(), hell) 
addEventHandler("onPlayerHell", getRootElement(), hell) 
  

Server

local restriction = {} 
  
function fck ( player, cmd ) 
    accountname = getAccountName ( getPlayerAccount ( player ) ); 
    if not isObjectInACLGroup ( 'user.' .. accountname, aclGetGroup ( 'vip' ) ) then return end 
    if not restriction[player] then restriction[player] = {} end 
    if not restriction[player][cmd] then 
        
    triggerClientEvent("onPlayerHell",getRootElement()) 
  
        restriction[player][cmd] = true 
        setTimer ( function ( ) restriction[player][cmd] = false end, 5000, 1 ); 
    else 
        outputChatBox ( '#FF0000[Commands]: You must wait #FFFFFF5 seconds#FF0000 to write this command again.', player, 255, 255, 255, true ); 
    end 
end 
addCommandHandler( 'fu', fck ); 

Link to comment

Client ;

function hell (  )  
     local sound = playSound("song/hell.mp3") 
    setSoundVolume(sound, 0.5)  
end 
addEvent("onPlayerHell",true) 
addEventHandler("onPlayerHell", getRootElement(), hell) 
  

Server ;

local restriction = {} 
  
function fck ( player, cmd ) 
    accountname = getAccountName ( getPlayerAccount ( player ) ); 
    if not isObjectInACLGroup ( 'user.' .. accountname, aclGetGroup ( 'vip' ) ) then return end 
    if not restriction[player] then restriction[player] = {} end 
    if not restriction[player][cmd] then 
    triggerClientEvent("onPlayerHell",getRootElement()) 
        restriction[player][cmd] = true 
        setTimer ( function ( ) restriction[player][cmd] = false end, 5000, 1 ); 
    else 
        outputChatBox ( '#FF0000[Commands]: You must wait #FFFFFF5 seconds#FF0000 to write this command again.', player, 255, 255, 255, true ); 
    end 
end 
addCommandHandler( 'fu', fck ); 

All players will hear the sound .

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...