Hello everyone!
This lua working only with ground vehicles.
I tested it and it also works with addon ground vehicles but it's not working with ship's vehicles like example Tie Fighter or another ship's vehicles.
Please help me!
local function vehicleEnterExit(ply, ent)
local whitelistedGroups = {
["admin"] = true,
["superadmin"] = true,
["pilot"] = true
}
if not whitelistedGroups[ply:GetUserGroup()] then
return false
end
end
hook.Add("CanPlayerEnterVehicle", "AllowPilotsEnterVehicle", vehicleEnterExit)
Can you provide a link to the addon and the code where you added this?
I add this lua file into gmod/garrysmod/lua/autorun/server
The addon on ships:
https://steamcommunity.com/sharedfiles/filedetails/?id=495762961
I had this issue a while ago with these vehicles, do the same checks within the GM/PlayerUse hook (return false if not allowed to enter) alongside the CanPlayerEnterVehicle hook. I never had time to check through their vehicle base, so there is probably a better way of doing this.
It's can't set up it.
I need only this lua file and i'am done with lua programming, please help me
i need only this working lua file.
I figure it but it's doesnt work. Please help
local function vehicleEnterExit(ply, ent)
local whitelistedGroups = {
["admin"] = true,
["superadmin"] = true,
["piloci"] = true
}
if not whitelistedGroups[ply:GetUserGroup()] then
return false
end
end
hook.Add("CanPlayerEnterVehicle", "AllowPilotsEnterVehicle", "PlayerUse", vehicleEnterExit)
hook.Add
read the arguments and try again.
I read that and again doesn't work.
local function PlayerUse(ply, ent)
local whitelistedGroups = {
["admin"] = true,
["superadmin"] = true,
["piloci"] = true
}
if not whitelistedGroups[ply:GetUserGroup()] then
return false
end
end
hook.Add("CanPlayerEnterVehicle", "AllowPilotsEnterVehicle", "PlayerUse", PlayerUse)
You obviously haven't understood it then.
First of all, it doesn't accept 4 arguments.
Secondly, you are hooking CanPlayerEnterVehicle.
yes, i'am noob with lua.
I'am only here on this forum to solve only that one problem.
Sorry, you need to Log In to post a reply to this thread.