• Where to paste it? :O PLEASE HELP!
    8 replies, posted
Hello internet! I would like to know if i should make a .lua file with this code in it: function GM:CanTool( ply, tr, tool ) if ( tool == "material" and IsValid( tr.Entity ) and tr.Entity:GetClass() == "prop_vehicle_jeep" ) then return false end end First of all. Does it work? And where should i put the lua?
If its for sandbox then make a file in lua/autorun/server paste it in there If its for a custom gamemode then put it in a serverside file.
serverside file? :O sry for being such newbie. im sry :/
[QUOTE=Dexyer;44058821]serverside file? :O sry for being such newbie. im sry :/[/QUOTE] Just create the file in lua/autorun/, name it whatever you want, with .lua extension and put the code in it.
[QUOTE=Robotboy655;44059053]Just create the file in lua/autorun/, name it whatever you want, with .lua extension and put the code in it.[/QUOTE] Well. I get lua errors that says that "GM" is a nil value. please help
Oh, right, you gotta make it a hook, using hook.Add function.
[QUOTE=Robotboy655;44059155]Oh, right, you gotta make it a hook, using hook.Add function.[/QUOTE] could you show me please?
Here you have a Code from a Remove on Job Change code, see how you hook it, hope could help! Its not the code you want to use! [CODE]hook.Add("OnPlayerChangedTeam", "asdf", function(ply) for k,v in pairs(ents.FindByClass("07sgmcrownviccvpi", "07sgmcrownvicuc", "c5500ambulance")) do if v.allowed and type(v.allowed) == "table" and table.HasValue(v.allowed, t) then continue end if v.SID == ply.SID then v:Remove() end end end)[/CODE]
[code]hook.Add("CanTool", "Dayruleisanidiot", function( ply, tr, tool ) if ( tool == "material" and IsValid( tr.Entity ) and tr.Entity:GetClass() == "prop_vehicle_jeep" ) then return false end end)[/code]
Sorry, you need to Log In to post a reply to this thread.