Poll

Good idea ?

<censor> Yea Will Be Usefull
9 (60%)
Yea
6 (40%)
Maybe
0 (0%)
Not sure
0 (0%)
No
0 (0%)

Total Members Voted: 15

Author Topic: ULXToolRestricter  (Read 9518 times)

0 Members and 1 Guest are viewing this topic.

Offline RecoX

  • Newbie
  • *
  • Posts: 18
  • Karma: 4
  • Hey, Yea im not the best at lua but im lerning
ULXToolRestricter
« on: July 05, 2008, 11:53:19 AM »
WARNING!: If you have ASpam installed You must update it to latest !

New Name: ULX Anti-Stool
Version: 1.1.2
Author: Reco / With Help from Jay209015
Purpose:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------This Module will stop normal users from using a certen tool EG; Anti-NoClip Stool will be restirected to Allowed list and admins
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
How To Install:
-----------------------------------------------------------
Simply drop the lua file in your lua/autorun-
-----------------------------------------------------------

How to add users:

Open up garrysmod/data/antistool_palyers.txt and add the steam ids that you want.

Download--------------------
http://one.xthost.info/AnstiStool/Anti-Stool%20Version%201.1.zip]http://one.xthost.info/AnstiStool/Anti-Stool%20Version%201.1.zip]http://one.xthost.info/AnstiStool/Anti-Stool%20Version%201.1.zip
-------------------------------


« Last Edit: July 12, 2008, 04:18:19 AM by RecoX »

Reco Will Allways Help!

Offline RecoX

  • Newbie
  • *
  • Posts: 18
  • Karma: 4
  • Hey, Yea im not the best at lua but im lerning
Re: ULXToolRestricter
« Reply #1 on: July 05, 2008, 11:56:43 AM »
This is just the verry basic code im  hoping with a few more tuts to make it so you can add restricted tools in a cfg or txt file

Reco Will Allways Help!

Offline benbrooks

  • Newbie
  • *
  • Posts: 28
  • Karma: 2
Re: ULXToolRestricter
« Reply #2 on: July 06, 2008, 06:24:20 AM »
Looks simple but effective, nice work :)

Offline RecoX

  • Newbie
  • *
  • Posts: 18
  • Karma: 4
  • Hey, Yea im not the best at lua but im lerning
Re: ULXToolRestricter
« Reply #3 on: July 06, 2008, 07:55:14 AM »
Thanks Also im ahving proplems in my servers all pepole can pick echover up

Reco Will Allways Help!

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ULXToolRestricter
« Reply #4 on: July 06, 2008, 09:24:31 AM »
Welcome to the forums RecoX! Sit back, relax, and let the crazy do its work. :)
Experiencing God's grace one day at a time.

Offline Chironex

  • Full Member
  • ***
  • Posts: 197
  • Karma: 11
  • Formerly known as Kyzer
Re: ULXToolRestricter
« Reply #5 on: July 06, 2008, 10:12:30 AM »
Do something more newb-friendly, something like that:
Code: [Select]
-- Here they write all tools they want to restrict:
local Restricted_Tools =
{
    "#Anti-NoClip",
    "Gcombat",
    "Cannon",
    "linktool"
}

--and then in your function, you just check if the toolmode is one of that list:
if Restricted_Tools[toolmode] then

Offline RecoX

  • Newbie
  • *
  • Posts: 18
  • Karma: 4
  • Hey, Yea im not the best at lua but im lerning
Re: ULXToolRestricter
« Reply #6 on: July 06, 2008, 10:52:55 AM »
Thanks Medigeo (hopfly spelt right didn't look) And ill try to make something more newb friendly

Reco Will Allways Help!

Offline RecoX

  • Newbie
  • *
  • Posts: 18
  • Karma: 4
  • Hey, Yea im not the best at lua but im lerning
Re: ULXToolRestricter
« Reply #7 on: July 06, 2008, 11:07:28 AM »
Ive Added the Nweb Freindly stool adder and im also working on allowed players via steam ids is it ply:SteamID() ?

Reco Will Allways Help!

Offline jay209015

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 934
  • Karma: 62
    • Dev-Solutions
Re: ULXToolRestricter
« Reply #8 on: July 06, 2008, 03:13:22 PM »
The hook needs to be after the function

Code: [Select]
hook.Add( "CanTool", "GetTool", gettool)
This will only work for the first table entry:

Code: [Select]
if ply:SteamID() == Allowed_players then return true
Try something like:

Code: [Select]
table.HasValue(Allowed_players, ply:SteamID()) then return true
And where's the function "UseTool" that you are calling with this hook?

Code: [Select]
hook.Add( "CanTool", "UseTool", UseTool );
An error only becomes a mistake when you refuse to correct it. --JFK

"And thus the downfall of the great ULX dynasty was wrought not by another dynasty, but the slow and steady deterioration of the leaders themselves, followed by the deprecation of the great knowledge they possessed." -Gmod, Chapter 28, verse 34 -- Stickly

Offline RecoX

  • Newbie
  • *
  • Posts: 18
  • Karma: 4
  • Hey, Yea im not the best at lua but im lerning
Re: ULXToolRestricter
« Reply #9 on: July 07, 2008, 07:20:50 AM »
Well getting that it wont checkif your amdin when you slect a tool maybe ill try if you use a tool thats restricted without being an admin

Reco Will Allways Help!

Offline RecoX

  • Newbie
  • *
  • Posts: 18
  • Karma: 4
  • Hey, Yea im not the best at lua but im lerning
Re: ULXToolRestricter
« Reply #10 on: July 07, 2008, 11:26:28 AM »
Ive added Ant-Stool:Anti-Sent Stops a non admin from spawning a sent and has an exclusion list like the others

Reco Will Allways Help!

Offline Chief_runningwater

  • Newbie
  • *
  • Posts: 14
  • Karma: 2
  • Fpsbanana User
    • Chiefrunningwater.com
Re: ULXToolRestricter
« Reply #11 on: July 07, 2008, 01:32:43 PM »
How would I add this to my server, I'm a little confused on how to set this up....

Offline RecoX

  • Newbie
  • *
  • Posts: 18
  • Karma: 4
  • Hey, Yea im not the best at lua but im lerning
Re: ULXToolRestricter
« Reply #12 on: July 07, 2008, 11:50:20 PM »
Well currently you can't as its not checking proply :)
But the way you set it is real simple

Add your steam ids you want it not to affect
and put in lua/autorun

Reco Will Allways Help!

Offline Chief_runningwater

  • Newbie
  • *
  • Posts: 14
  • Karma: 2
  • Fpsbanana User
    • Chiefrunningwater.com
Re: ULXToolRestricter
« Reply #13 on: July 08, 2008, 11:00:40 AM »
Well currently you can't as its not checking proply :)
But the way you set it is real simple

Add your steam ids you want it not to affect
and put in lua/autorun
Thanks that helped a lot now all I need to do is wait till you release it  ;D

Offline spbogie

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 456
  • Karma: 41
Re: ULXToolRestricter
« Reply #14 on: July 08, 2008, 02:14:05 PM »
local Restricted_Tools =
-- Add your restrected tools here
{
    "#Anti-NoClip",
   "adv_duplicator",
    "Gcombat",
    "Anti-NoClip",
    "linktool",
   "stacker",
}
--Add your steam id's that this should not affect
local Allowed_players =
{
    "STEAM:1:0:5447", -- Don't forget to remove this  Lay out exactly like that so "STEAM:1:0:88888",    "
}
hook.Add( "CanTool", "GetTool", gettool)
 function gettool(ply, tr, toolmode)
   if Restricted_Tools[toolmode] then
   if pl:IsAdmin() then return true
   if ply:SteamID() == Allowed_players then return true
   if pl:SuperAdmin() then return true
   if return false then
   ply:PrintMessage(HUD_PRINTTALK, "ULXAnti-Stool: Sorry But your not an Admin, Or In the Excluded Player List")
   end
   end
 end
 hook.Add( "CanTool", "UseTool", UseTool );
I have not failed. I've just found 10,000 ways that won't work. - Thomas A. Edison
I reject your reality and substitute my own. - Adam Savage