I've been trying to figure it out for a while, but I'm basically trying to figure out how I can make my script check if a player is currently in a vehicle, in order to disable certain functions of the script.
Is there even a way for it to return true/false is a player is in a vehicle? Does any info about the player change when they are in a vehicle?
[lua]if ply:InVehicle() then
--Stuff happens
end[/lua]
The wiki is your friend!:buddy:
[url=http://wiki.garrysmod.com/?search=Player.InVehicle][I]Player.InVehicle[/I] [img]http://wiki.garrysmod.com/favicon.ico[/img][/url]
You can also use these hooks to find out when the player enters or leaves a vehicle.
[url=http://wiki.garrysmod.com/?search=Gamemode.PlayerEnteredVehicle][I]Gamemode.PlayerEnteredVehicle[/I] [img]http://wiki.garrysmod.com/favicon.ico[/img][/url]
[url=http://wiki.garrysmod.com/?search=Gamemode.PlayerLeaveVehicle][I]Gamemode.PlayerLeaveVehicle[/I] [img]http://wiki.garrysmod.com/favicon.ico[/img][/url]
[url=http://wiki.garrysmod.com/?search=hook.Add][I]hook.Add[/I] [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] <-- This one is for using hooks.
Sorry, you need to Log In to post a reply to this thread.