Jump to content

Car lock help


johhnhd

Recommended Posts

function lockTheVeh ( thePlayer ) 
local player = getPlayerFromName(Username) 
playervehicle = getPlayerOccupiedVehicle ( thePlayer ) 
        if ( playervehicle ) then 
            if (Username) then 
                if not isVehicleLocked ( playervehicle ) then 
                setVehicleLocked ( playervehicle, true )  
            end 
        end 
    end 
end 
addCommandHandler ( "lock", lockTheVeh ) 

Not tested

Link to comment
function lockTheVeh ( thePlayer ) 
local player = getPlayerFromName(Username) 
playervehicle = getPlayerOccupiedVehicle ( thePlayer ) 
        if ( playervehicle ) then 
            if (Username) then 
                if not isVehicleLocked ( playervehicle ) then 
                setVehicleLocked ( playervehicle, true )  
            end 
        end 
    end 
end 
addCommandHandler ( "lock", lockTheVeh ) 

Not tested

getPlayerFromName gets a player by his name, Not his username ..

you should use getPlayerAccount and getAccountName ..

Link to comment
function lockTheVeh ( thePlayer ) 
local player = getPlayerFromName(Username) 
playervehicle = getPlayerOccupiedVehicle ( thePlayer ) 
        if ( playervehicle ) then 
            if (Username) then 
                if not isVehicleLocked ( playervehicle ) then 
                setVehicleLocked ( playervehicle, true )  
            end 
        end 
    end 
end 
addCommandHandler ( "lock", lockTheVeh ) 

Not tested

Is this /lock or like when you spawn and go up to it you can only enter if youre that user

Link to comment
function lockTheVeh ( thePlayer ) 
local player = getPlayerFromName(Username) 
playervehicle = getPlayerOccupiedVehicle ( thePlayer ) 
        if ( playervehicle ) then 
            if (Username) then 
                if not isVehicleLocked ( playervehicle ) then 
                setVehicleLocked ( playervehicle, true )  
            end 
        end 
    end 
end 
addCommandHandler ( "lock", lockTheVeh ) 

Not tested

Is this /lock or like when you spawn and go up to it you can only enter if youre that user

If there's a guy called: "Username" and you type /lock the car he's in will be locked.

Link to comment
function lockTheVeh ( thePlayer ) 
local player = getPlayerFromName(Username) 
playervehicle = getPlayerOccupiedVehicle ( thePlayer ) 
        if ( playervehicle ) then 
            if (Username) then 
                if not isVehicleLocked ( playervehicle ) then 
                setVehicleLocked ( playervehicle, true )  
            end 
        end 
    end 
end 
addCommandHandler ( "lock", lockTheVeh ) 

Not tested

Is this /lock or like when you spawn and go up to it you can only enter if youre that user

If there's a guy called: "Username" and you type /lock the car he's in will be locked.

You can also add people's usernames and get the data. Like

setElementData ( thePlayer, "Username", "TheUsername" ) 
  
or 
  
local TheUsername = etc.. 
setElementData ( thePlayer, "Username", ..TheUsername 

When the player logs in from the login panel his data will be set, make sure you define: TheUsername or enter the players username..

then for the locker script you could use:

function lockTheVeh ( thePlayer ) 
local player = getPlayerFromName(Username) 
playervehicle = getPlayerOccupiedVehicle ( thePlayer ) 
        if ( playervehicle ) then 
            if (getElementData (thePlayer, "Username") == "TheUsername" ) then 
                if not isVehicleLocked ( playervehicle ) then 
                setVehicleLocked ( playervehicle, true )  
            end 
        end 
    end 
end 
addCommandHandler ( "lock", lockTheVeh ) 
  

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