Jump to content

Script de trancar carro


Recommended Posts

Opa, então man, como eu disse, não funcionou, acho pq eu n sei mexer em script,  mas ele está aqui:


    function lockcar ( thePlayer )
        playervehicle = getPlayerOccupiedVehicle ( thePlayer )   -- define 'playervehicle' as the vehicle the player is in
        if ( playervehicle ) then                                -- if a player is in a vehicle
            if isVehicleLocked ( playervehicle ) then            -- and if the vehicle is already locked
                setVehicleLocked ( playervehicle, false )        -- unlock it
            else                                                 -- otherwise (if it isn't locked) 
                setVehicleLocked ( playervehicle, true )         -- lock it
            end
        end
    end

    function bindLockOnSpawn ( theSpawnpoint )                     -- when a player spawns
        bindKey ( source, "l", "down", lockcar )                   -- bind the 'l' key to the 'lockcar' function
    end
    addEventHandler ( "onPlayerSpawn", getRootElement(), bindLockOnSpawn )

    -- call 'stopVehicleEntry' whenever hunterPlayer is about to enter a vehicle:
    function stopVehicleEntry ( theplayer, seat, jacked )
       cancelEvent() -- stop the event, the player will can't enter in vehicle 
    end
    addEventHandler("onVehicleStartEnter", getRootElement(), stopVehicleEntry)

    function exitVehicle (thePlayer, seat, jacked)
        if (isVehicleLocked (source)) then 
            outputChatBox ("The door is locked! You can't exit the vehicle!", thePlayer)  
            cancelEvent()
        end
    end
    addEventHandler ("onVehicleStartExit", root, exitVehicle)

Caso queira arrumar, está aí, se conseguir, me fale onde errei

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