• Allow only certain teams to enter SENT / Scripted Vehicle
    2 replies, posted
I want only certain teams to be able to enter in a Combine APC mod I downloaded from the workshop. I am able to edit it's code as I extracted it and unsubscribed.
You could use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/CanPlayerEnterVehicle]GM/CanPlayerEnterVehicle[/url] [editline]29th February 2016[/editline] E.g. [CODE] hook.Add( 'CanPlayerEnterVehicle', 'no_enter_APC', function( ply, veh, srole ) -- hook into canplayerentervehicle if ( ply:Team() == SOME_TEAM ) and ( veh:GetModel() == 'SOME_MODEL.mdl' ) then -- change SOME_TEAM to whatever team you want to be able to get in return true -- let them get in else return false -- don't let them get in end end ) [/CODE] I used GetModel to check the vehicle in the example there, but you could change that to check the class or whatever you want
The code given above should work. If you want to notify the player who can't enter the vehicle by using [URL="http://wiki.garrysmod.com/page/notification/AddLegacy"]http://wiki.garrysmod.com/page/notification/AddLegacy[/URL]
Sorry, you need to Log In to post a reply to this thread.