General > Developers Corner
stool and weapon restriction
JamminR:
After spending 20 minutes on writing a nice explanation of why it might not be working, I realized you're probably trying your 3 Cantool hooks, not just one like I thought at first.
One for each list of tools./group of admins.
You can't name your hook the same.
Rename your hooks, the 2nd in hook.Add(Hooktype, "unique name - this one", function name"
You can't name your functions the same.
Rename your functions, anything you want, but not "UseTool". Something like UseTool_<unique name> for each function.
saintmark:
Ok I renamed the functions to:
1st: UseTool_admin
2nd: UseTool_vip
3rd: Use Tool_respected
I do not understand how I should do the hooks, would you please show me an example using the information above?
Just to make sure we are all on the same page, I am making one lua file that has all the codes in it for stool restriction. This can be done right?
jay209015:
like this:
--- Code: ---function UseTool_admin( ply, toolmode )
contents....................
end
hood.Add( "CanTool", "UseTool_Admin_Hook", UseTool_admin)
function UseTool_vip( ply, toolmode )
contents....................
end
hood.Add( "CanTool", "UseTool_vip_Hook", UseTool_vip)
function UseTool_respected( ply, toolmode )
contents....................
end
hood.Add( "CanTool", "UseTool_respected_Hook", UseTool_respected)
--- End code ---
An Error Has Occurred!
array_keys(): Argument #1 ($array) must be of type array, null given
[0] Board index
Go to full version