How would i go about this:
when a player press's use on a car the cars use function wont be called. Instead my own custom use function gets called.
So far i've tried:
PlayerUse
Ent:OnUse
Ent:use
to try and overwrite the cars functions for use.
What im trying to do is make it so that with VU mod when you use the car if thier isnt a driver then your set as driver. Otherwise it will find an empty passanger seat and stick you in that.
Here is one of the things iver tryed plz note its in the format of a wolf admin plugin.
[code]
function Plugin:PlayerUse(ply,ent)
if not ent:IsVehicle() then return true end
Msg("\n Used Car")
if not ent:GetDriver() then
ply:EnterVehicle(ent)
Msg("\n Car Driver")
return false
end
if not ent.VehicleTable then return end
if not ent.VehicleTable.Passengers then return end
for key,value in pairs(ent.VehicleTable.Passengers) do
if value.Ent then
if not value.Ent:GetDriver() then
ply:EnterVehicle(value.Ent)
Msg("\n Car Passanger")
return false
end
end
end
return true
end
[/code]
You need to hook your function for it to do anything.
[b][url=http://wiki.garrysmod.com/?title=Hook.Add]Hook.Add [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
As i said thats in the form of a wolf admin plugin. Plugin:HookName autohooks.
[QUOTE=goluch;21736866]As i said thats in the form of a wolf admin plugin. Plugin:HookName autohooks.[/QUOTE]
You need to hook to [URL="http://wiki.garrysmod.com/?title=Gamemode.PlayerUs"]PlayerUse[/URL] else it will not run.
[QUOTE=Jake1305;21737129]You need to hook to [URL="http://wiki.garrysmod.com/?title=Gamemode.PlayerUs"]PlayerUse[/URL] else it will not run.[/QUOTE]
Read before posting, he use it has a plugin for his adminmod which hooks it auto
Sorry, you need to Log In to post a reply to this thread.