Jump to content

How to..


kuba90pl

Recommended Posts

  
function checkAttachedElement(player) 
    local veh = getPedOccupiedVehicle(player) 
    if veh then 
        if getElementModel(veh) == 515 then 
            if isElementAttached(veh) then 
                local attachedElement = getElementAttachedTo(veh) 
                if getElementType(attachedElement) == "vehicle" then 
                    outputChatBox(tostring(getElementModel(attachedElement)) 
                end 
            end 
        end 
    end 
end 
addCommandHandler("check",checkAttachedElement) 
         
  

Link to comment

Why not use the trailer functions instead?

function checkAttachedElement(player) 
    local veh = getPedOccupiedVehicle(player) 
    if veh then 
        local trailer = getVehicleTowedByVehicle(veh) 
        if getElementModel(veh) == 515 and trailer then 
            outputChatBox(tostring(getElementModel(trailer)), player) 
        end 
    end 
end 
addCommandHandler("check",checkAttachedElement) 

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