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", "Lock car", lockcar ) -- bind the 'l' key to the 'lockcar' function
end
addEventHandler ( "onPlayerSpawn", getRootElement(), bindLockOnSpawn ) -- add an event handler for onPlayerSpawn
I made that into a lua script from the wiki but it doesnt work. i am a noob but i really want to learn what i am doing wrong. I have been modding gta sa with cleo for years but i want to start using lua. I am trying to make a lua script for moon loader for locking your vehicle using the L key for a cop wont be able to arrest you for example PLEASE HELP ME PLEASE.