Jump to content

Command restriction for just people in an acl group


novo

Recommended Posts

Hi all.

I need to make commands what just can use the people of a specific acl group.

I tryed to make the code, but idk what is wrong;

function pushHisFreakingAss (playerSource, command, arg1) 
    if (arg1 == nil ) or arg1 == false then 
        outputChatBox ("You must to insert a valid player name.", playerSource, 255, 12, 15, false) 
    else 
    if if isObjectInACLGroup("user." .. playerElement, aclGetGroup("VIP")) == false then 
        outputChatBox ("You aren't VIP. You can't use that command.", playerSource, 255, 12, 15, false) 
    else 
if isObjectInACLGroup("user." .. playerElement, aclGetGroup("VIP")) == true then 
    local playerElement = getPlayerFromName(arg1) 
    if playerElement then 
      local name = getPlayerName(playerElement) 
      local sourceName = getPlayerName(playerElement) 
      local theVehicle = getPedOccupiedVehicle(playerElement) 
      local hisCar = getPedOccupiedVehicle(playerElement) 
      local x, y, z = getElementVelocity ( hisCar ) 
      setElementVelocity ( hisCar, x , y, z + 0.3 ) 
outputChatBox ("#0082D8" .. getPlayerName(playerElement) .." pushes "..getPlayerName(playerSource).."!", getRootElement(), 255, 255, 255, true) 
      end 
   end 
end  
addCommandHandler("push", pushHisFreakingAss) 

I'ts the command for "push"

Please help me.

¡Bye!

Edited by Guest
Link to comment

Try

function pushHisFreakingAss (playerSource, command, arg1) 
    if (arg1 == nil ) or ( arg1 == false ) then 
        outputChatBox ("You must to insert a valid player name.", playerSource, 255, 12, 15, false) 
    else 
        if isObjectInACLGroup("user." .. playerElement, aclGetGroup("VIP"))  == false then 
            outputChatBox ("You aren't VIP. You can't use that command.", playerSource, 255, 12, 15, false) 
        else 
            if isObjectInACLGroup("user." .. playerElement, aclGetGroup("VIP")) == true then 
                local playerElement = getPlayerFromName(arg1) 
                if playerElement then 
                    local name = getPlayerName(playerElement) 
                    local sourceName = getPlayerName(playerElement) 
                    local theVehicle = getPedOccupiedVehicle(playerElement) 
                    local hisCar = getPedOccupiedVehicle(playerElement) 
                    local x, y, z = getElementVelocity ( hisCar ) 
                    setElementVelocity ( hisCar, x , y, z + 0.3 ) 
                    outputChatBox ("#0082D8" .. getPlayerName(playerElement) .." pushes "..getPlayerName(playerSource).."!", getRootElement(), 255, 255, 255, true) 
                end 
            end 
        end      
    end 
end  
addCommandHandler("push", pushHisFreakingAss) 

Link to comment
Can i know what did you changed ?

I wanna learn ^^

Sure.

First

Wrong

  
if if isObjectInACLGroup("user." .. playerElement, aclGetGroup("VIP")) == false then 
  

Correct

  
if isObjectInACLGroup("user." .. playerElement, aclGetGroup("VIP")) == false then 
  

Second.You forgot 2 end`s

Use an editor that shows the errors in the code example: viewtopic.php?t=24834&f=91

Link to comment

I have now a problem, i used the code what you gave to me, but "playerElement" is a nill value.

Then i'm using now this code, i added some more commands too;

-------------------------- 
--    PUSH CMD start    -- 
-------------------------- 
function pushHisFreakingAss (playerSource, command, arg1) 
if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == false then 
            outputChatBox ("You aren't VIP. You can't use that command.", playerSource, 255, 12, 15, false) 
    else 
    if (arg1 == nil ) or ( arg1 == false ) then 
        outputChatBox ("You must to insert a valid player name.", playerSource, 255, 12, 15, false) 
    else 
if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == true then 
                local playerElement = getPlayerFromName(arg1) 
                if playerElement then 
                    local name = getPlayerName(playerElement) 
                    local sourceName = getPlayerName(playerElement) 
                    local theVehicle = getPedOccupiedVehicle(playerElement) 
                    local hisCar = getPedOccupiedVehicle(playerElement) 
                    local x, y, z = getElementVelocity ( hisCar ) 
                    setElementVelocity ( hisCar, x , y, z + 0.3 ) 
                    outputChatBox ("#0082D8" .. getPlayerName(playerElement) .." pushes "..getPlayerName(playerSource).."!", getRootElement(), 255, 255, 255, true) 
                end 
            end 
        end     
    end 
end 
addCommandHandler("push", pushHisFreakingAss) 
-------------------------- 
--    PUSH CMD end  -- 
-------------------------- 
  
-------------------------- 
--    FIX CMD start -- 
-------------------------- 
  
function fixx ( playerSource, command ) 
if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == false then 
            outputChatBox ("You aren't VIP. You can't use that command.", playerSource, 255, 12, 15, false) 
else 
if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == false then 
                    outputChatBox ("#0082D8" .. getPlayerName(playerElement) .." has fixed his self !", getRootElement(), 255, 255, 255, true) 
player=getLocalPlayer(playerSource) 
    if isPedInVehicle(player) then 
        local vehicle=getPedOccupiedVehicle(player) 
  
  fixVehicle(vehicle) 
end 
end 
end 
end 
addCommandHandler ( "fix", fixx ) 
  
-------------------------- 
--    FIX CMD end   -- 
-------------------------- 
  
-------------------------- 
--    NOS CMD start -- 
-------------------------- 
  
function nitro1 ( playerSource, command ) 
if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == false then 
            outputChatBox ("You aren't VIP. You can't use that command.", playerSource, 255, 12, 15, false) 
else 
if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == false then 
                    outputChatBox ("#0082D8" .. getPlayerName(playerElement) .." gives nos to his self !", getRootElement(), 255, 255, 255, true) 
player=getLocalPlayer(playerSource) 
    if isPedInVehicle(player) then 
        local vehicle=getPedOccupiedVehicle(player) 
  
  addVehicleUpgrade(vehicle,1010) 
end 
end 
end 
end 
addCommandHandler ( "nos", nitro1 ) 
  
-------------------------- 
--    NOS CMD end   -- 
-------------------------- 
  
-------------------------- 
--    WARP CMD start    -- 
-------------------------- 
  
function warpuj2(command,nazwa) 
if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == false then 
            outputChatBox ("You aren't VIP. You can't use that command.", playerSource, 255, 12, 15, false) 
else 
if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == false then 
                    outputChatBox ("#0082D8" .. getPlayerName(playerElement) .." warps to "..getPlayerName(playerSource).."!", getRootElement(), 255, 255, 255, true) 
nazwa=tostring(nazwa) 
if (nazwa) then 
player2=getPlayerFromName(nazwa) 
      vehicle=getPedOccupiedVehicle(player2) 
    x,y,z=getElementPosition(vehicle) 
    vehicle2=getPedOccupiedVehicle(player) 
    setElementPosition(vehicle2,x,y,z+4) 
end 
end 
end 
end 
addCommandHandler("warp",warpuj2) 
  
-------------------------- 
--    WARP CMD end  -- 
-------------------------- 

Plz help :S

Link to comment

this for push

  
function pushHisFreakingAss (playerSource, cmd, arg1) 
if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("VIP"))  == false then 
            outputChatBox ("You aren't VIP. You can't use that command.", playerSource, 255, 12, 15, false) 
    else 
    if (arg1 == nil ) or ( arg1 == false ) then 
        outputChatBox ("You must to insert a valid player name.", playerSource, 255, 12, 15, false) 
    else 
if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount (playerSource)), aclGetGroup("VIP"))  == true then 
                local playerElement = getPlayerFromName(arg1) 
                local hisCar = getPedOccupiedVehicle(playerElement) 
                if playerElement and hisCar then 
                    local name = getPlayerName(playerElement) 
                    local sourceName = getPlayerName(playerSource) 
                    local hisCar = getPedOccupiedVehicle(playerElement) 
                    local x, y, z = getElementVelocity ( hisCar ) 
                    setElementVelocity ( hisCar, x , y, z + 0.3 ) 
                    outputChatBox ("#0082D8"..name.." pushes "..sourceName.."!", root, 255, 255, 255, true) 
                end 
            end 
        end     
    end 
end 
addCommandHandler("push", pushHisFreakingAss) 
  

and this for fix cmd

function fixx ( playerSource, cmd ) 
if not isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("VIP")) then 
        outputChatBox ("You aren't VIP. You can't use that command.", playerSource, 255, 12, 15, false) 
    else 
        if isPedInVehicle(playerSource) then 
                    local veh = getPedOccupiedVehicle(playerSource) 
        fixVehicle(veh) 
        outputChatBox ("#0082D8" .. getPlayerName(playerSource) .." has fixed his self !", root, 255, 255, 255, true) 
        end 
    end 
end 
addCommandHandler ( "fix", fixx ) 

and this for nos cmd

function nitro1 ( playerSource, command ) 
if not isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("VIP")) then 
        outputChatBox ("You aren't VIP. You can't use that command.", playerSource, 255, 12, 15, false) 
    else 
        if isPedInVehicle(playerSource) then 
                    local veh = getPedOccupiedVehicle(playerSource) 
        addVehicleUpgrade(veh,1010) 
        outputChatBox ("#0082D8" .. getPlayerName(playerSource) .." gives nos to his self !", root, 255, 255, 255, true) 
        end 
    end 
end 
addCommandHandler ( "nos", nitro1 )  

Link to comment

Try

-------------------------- 
--    PUSH CMD start    -- 
-------------------------- 
function pushHisFreakingAss (playerSource, command, arg1) 
    local account = getPlayerAccount( playerSource ) 
    if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == false then 
        outputChatBox ("You aren't VIP. You can't use that command.", playerSource, 255, 12, 15, false) 
    else 
        if (arg1 == nil ) or ( arg1 == false ) then 
            outputChatBox ("You must to insert a valid player name.", playerSource, 255, 12, 15, false) 
        else 
            if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == true then 
                local playerElement = getPlayerFromName(arg1) 
                if playerElement then 
                  local name = getPlayerName(playerElement) 
                     local sourceName = getPlayerName(playerElement) 
                     local theVehicle = getPedOccupiedVehicle(playerElement) 
                    local hisCar = getPedOccupiedVehicle(playerElement) 
                    local x, y, z = getElementVelocity ( hisCar ) 
                    setElementVelocity ( hisCar, x , y, z + 0.3 ) 
                    outputChatBox ("#0082D8" .. getPlayerName(playerElement) .." pushes "..getPlayerName(playerSource).."!", getRootElement(), 255, 255, 255, true) 
                end 
            end     
        end 
    end 
end 
addCommandHandler("push", pushHisFreakingAss) 
-------------------------- 
--    PUSH CMD end  -- 
-------------------------- 
  
-------------------------- 
--    FIX CMD start -- 
-------------------------- 
  
function fixx ( playerSource, command ) 
    local account = getPlayerAccount( playerSource ) 
    if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == false then 
        outputChatBox ("You aren't VIP. You can't use that command.", playerSource, 255, 12, 15, false) 
    else 
        if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == false then 
            outputChatBox ("#0082D8" .. getPlayerName(playerElement) .." has fixed his self !", getRootElement(), 255, 255, 255, true) 
          if isPedInVehicle(playerSource) then 
                local vehicle = getPedOccupiedVehicle(playerSource) 
               fixVehicle(vehicle) 
            end 
        end 
    end 
end 
addCommandHandler ( "fix", fixx ) 
  
-------------------------- 
--    FIX CMD end   -- 
-------------------------- 
  
-------------------------- 
--    NOS CMD start -- 
-------------------------- 
  
function nitro1 ( playerSource, command ) 
    local account = getPlayerAccount( playerSource ) 
    if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == false then 
        outputChatBox ("You aren't VIP. You can't use that command.", playerSource, 255, 12, 15, false) 
    else 
        if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == false then 
           outputChatBox ("#0082D8" .. getPlayerName(playerElement) .." gives nos to his self !", getRootElement(), 255, 255, 255, true) 
          if isPedInVehicle(playerSource) then 
                local vehicle = getPedOccupiedVehicle(playerSource) 
               addVehicleUpgrade(vehicle,1010) 
            end 
        end 
    end 
end 
addCommandHandler ( "nos", nitro1 ) 
  
-------------------------- 
--    NOS CMD end   -- 
-------------------------- 
  
-------------------------- 
--    WARP CMD start    -- 
-------------------------- 
  
function warpuj2(playerSource,command,nazwa) 
    local account = getPlayerAccount( playerSource ) 
    if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == false then 
      outputChatBox ("You aren't VIP. You can't use that command.", playerSource, 255, 12, 15, false) 
    else 
        if isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("VIP"))  == false then 
            outputChatBox ("#0082D8" .. getPlayerName(playerElement) .." warps to "..getPlayerName(playerSource).."!", getRootElement(), 255, 255, 255, true) 
            nazwa=tostring(nazwa) 
            if (nazwa) then 
                player2=getPlayerFromName(nazwa) 
                 vehicle=getPedOccupiedVehicle(player2) 
                  local x,y,z=getElementPosition(vehicle) 
                  vehicle2=getPedOccupiedVehicle(player) 
              setElementPosition(vehicle2,x,y,z+4) 
            end 
        end 
    end 
end 
addCommandHandler("warp",warpuj2) 
  
-------------------------- 
--    WARP CMD 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...