Jump to content

[HELP]I can't make barrier


Recommended Posts

Posted (edited)
local maxBarriers = 4 
local barriers = {} 
  
function createBarrier(player) 
    if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Armed Force")) then 
    if not barriers[player] then 
        barriers[player] = {} 
    end 
    if #barriers[player] >= maxBarriers then 
        destroyElement(barriers[player][1]) 
        table.remove(barriers[player],1) 
    end 
    local x,y,z = getElementPosition(player) 
    local xR,yR,zR = getElementRotation(player) 
    local obj = createObject(3091,x,y,z,xR,yR,zR) 
    table.insert(barriers[player], obj) 
end 
addCommandHandler("ab",createBarrier) 

Like this?

Edited by Guest
Guest Guest4401
Posted

No its wrong.

Press page 1 of this topic, you will get the answer.

Posted
local maxBarriers = 4 
local barriers = {} 
  
function createBarrier(player) 
    if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Armed Force")) then 
    if not barriers[player] then 
        barriers[player] = {} 
    end 
    if #barriers[player] >= maxBarriers then 
        destroyElement(barriers[player][1]) 
        table.remove(barriers[player],1) 
    end 
    local x,y,z = getElementPosition(player) 
    local xR,yR,zR = getElementRotation(player) 
    local obj = createObject(3091,x,y,z,xR,yR,zR) 
    table.insert(barriers[player], obj) 
end 
addCommandHandler("ab",createBarrier) 

this?

Posted

You want to let him place barriers if he's on the "Armed Force" team? if so then use this:

local maxBarriers = 4 
local barriers = { } 
  
function createBarrier ( player ) 
    if ( getPlayerTeam ( player ) and getTeamName ( getPlayerTeam ( player ) ) == "Armed Force" ) then 
        if ( not barriers [ player ] ) then 
            barriers [ player ] = { } 
        end 
        if ( #barriers [ player ] >= maxBarriers ) then 
            destroyElement ( barriers [ player ] [ 1 ] ) 
            table.remove ( barriers [ player ], 1 ) 
        end 
  
        local x, y, z = getElementPosition ( player ) 
        local xR, yR, zR = getElementRotation ( player ) 
        local obj = createObject ( 3091, x, y, z, xR, yR, zR ) 
        table.insert ( barriers [ player ], obj ) 
    end 
end 
addCommandHandler ( "ab", createBarrier ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
You want to let him place barriers if he's on the "Armed Force" team? if so then use this:
local maxBarriers = 4 
local barriers = { } 
  
function createBarrier ( player ) 
    if ( getPlayerTeam ( player ) and getTeamName ( getPlayerTeam ( player ) ) == "Armed Force" ) then 
        if ( not barriers [ player ] ) then 
            barriers [ player ] = { } 
        end 
        if ( #barriers [ player ] >= maxBarriers ) then 
            destroyElement ( barriers [ player ] [ 1 ] ) 
            table.remove ( barriers [ player ], 1 ) 
        end 
  
        local x, y, z = getElementPosition ( player ) 
        local xR, yR, zR = getElementRotation ( player ) 
        local obj = createObject ( 3091, x, y, z, xR, yR, zR ) 
        table.insert ( barriers [ player ], obj ) 
    end 
end 
addCommandHandler ( "ab", createBarrier ) 

This can use only Armed Force Team?

Posted

Yes, only "Armed Force" team can use that command.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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