Jump to content

easy script help


joedajoester

Recommended Posts

I tried making this script for when someone goes up to the admin base gate and it outputs a client side message.

g_base_col = createColCuboid ( 3109.0913085938, -842.58416748047, 28.436388015747, 250, 280, 20 ) 
  
if isObjectInACLGroup ( "user." .. playername, aclGetGroup ( "Admin" ) ) then 
function hit ( pla, dim ) 
    if getElementType ( pla ) == "player" then 
    local vehicle = getPedOccupiedVehicle ( pla ) 
        if vehicle or not vehicle then 
localPlayerName = getPlayerName(getLocalPlayer()) 
                outputChatBox ( "Welcome to the admin base,"..localPlayerName ) 
            else 
                setElementData ( pla, "inArea", "true" ) 
                triggerClientEvent ( pla, "destroyTrepassor", g_root, pla ) 
                outputChatBox ( "You must be part of the staff to enter", pla, 255, 0, 0 ) 
            end 
        end 
    end 
  
addEventHandler ( "onColShapeHit", g_base_col, hit ) 
  
function leave ( pla, dim ) 
    if getElementType ( pla ) == "player" then 
    local vehicle = getPedOccupiedVehicle ( pla ) 
        if vehicle or not vehicle then 
                outputChatBox ( "Good Bye!", pla, 0, 250, 0 ) 
            else 
                setElementData ( pla, "inRestrictedArea", "false" ) 
                triggerClientEvent ( pla, "destroyTimers", g_root, pla ) 
                outputDebugString ( "*"..getPlayername(pla).." has left col shape" ) 
            end 
        end 
    end 
end 
addEventHandler ( "onColShapeLeave", g_base_col, leave ) 

The error i get is: attempt to concatenate global'playerName' a nil value

Thanks for any help :D

Link to comment
g_base_col = createColCuboid ( 3109.0913085938, -842.58416748047, 28.436388015747, 250, 280, 20 ) 
  
function hit ( pla, dim ) 
    if getElementType ( pla ) == "player" then 
local playername = getPlayerName(player) 
if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then 
    local vehicle = getPedOccupiedVehicle ( pla ) 
        if vehicle then 
                outputChatBox ( "Welcome to the admin base,"..playername ) 
        end 
        setElementData ( pla, "inArea", "true" ) 
         triggerClientEvent ( pla, "destroyTrepassor", g_root, pla ) 
          outputChatBox ( "You must be part of the staff to enter", pla, 255, 0, 0 ) 
       end 
    end 
end 
  
addEventHandler ( "onColShapeHit", g_base_col, hit ) 
  
function leave ( pla, dim ) 
    if getElementType ( pla ) == "player" then 
if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then 
    local vehicle = getPedOccupiedVehicle ( pla ) 
        if vehicle or not vehicle then 
                outputChatBox ( "Good Bye!", pla, 0, 250, 0 ) 
        end 
    else 
                setElementData ( pla, "inRestrictedArea", "false" ) 
                triggerClientEvent ( pla, "destroyTimers", g_root, pla ) 
                outputDebugString ( "*"..getPlayerName(pla).." has left col shape" ) 
            end 
        end 
    end 
addEventHandler ( "onColShapeLeave", g_base_col, leave ) 

Link to comment
g_base_col = createColCuboid ( 3109.0913085938, -842.58416748047, 28.436388015747, 250, 280, 20 ) 
  
  
function hit ( pla, dim, thePlayer ) 
  
    if isObjectInACLGroup ( "user." .. thePlayer, aclGetGroup ( "Admin" ) ) then 
         getElementType ( pla ) == "player" 
         local vehicle = getPedOccupiedVehicle ( pla ) 
        if vehicle or not vehicle then 
localPlayerName = getPlayerName(getLocalPlayer()) 
                outputChatBox ( "Welcome to the admin base,"..localPlayerName ) 
            else 
                setElementData ( pla, "inArea", "true" ) 
                triggerClientEvent ( pla, "destroyTrepassor", g_root, pla ) 
                outputChatBox ( "You must be part of the staff to enter", pla, 255, 0, 0 ) 
            end 
        end 
    end 
  
addEventHandler ( "onColShapeHit", g_base_col, hit ) 
  
function leave ( pla, dim ) 
    if getElementType ( pla ) == "player" then 
    local vehicle = getPedOccupiedVehicle ( pla ) 
        if vehicle or not vehicle then 
                outputChatBox ( "Good Bye!", pla, 0, 250, 0 ) 
            else 
                setElementData ( pla, "inRestrictedArea", "false" ) 
                triggerClientEvent ( pla, "destroyTimers", g_root, pla ) 
                outputDebugString ( "*"..getPlayername(pla).." has left col shape" ) 
            end 
        end 
    end 
end 
addEventHandler ( "onColShapeLeave", g_base_col, leave ) 

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