Author Topic: Gun Admin Check  (Read 33292 times)

0 Members and 1 Guest are viewing this topic.

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Gun Admin Check
« on: December 17, 2005, 02:49:29 PM »
This script will check to see if your an admin on a certain list and kill you if you are not supposed to have the gun.

Installation:


Find the script of the gun you want to use. (ex: gmod9/lua/weapons/bangun/bangun.lua)

Find the part that says (or something similar)
Code: [Select]
-- Called when player picks up weapon

function onPickup( userid )
end

Copy everything from 'function' to 'end' and delete it, so you should be deleting this:
Code: [Select]
function onPickup( userid )
end

Now where that originally was, paste this:
Code: [Select]

function onPickup( pickerup )

_OpenScript( "wepadminlist.lua" );
if (_PlayerInfo( pickerup, "networkid" ) == AUTHID1) or
(_PlayerInfo( pickerup, "networkid" ) == AUTHID2) or
(_PlayerInfo( pickerup, "networkid" ) == AUTHID3) or
(_PlayerInfo( pickerup, "networkid" ) == AUTHID4) or
(_PlayerInfo( pickerup, "networkid" ) == AUTHID5) or
(_PlayerInfo( pickerup, "networkid" ) == AUTHID6) or
(_PlayerInfo( pickerup, "networkid" ) == AUTHID7) or
(_PlayerInfo( pickerup, "networkid" ) == AUTHID8) or
(_PlayerInfo( pickerup, "networkid" ) == AUTHID9) or
(_PlayerInfo( pickerup, "networkid" ) == AUTHID10) or
(_PlayerInfo( pickerup, "networkid" ) == AUTHID11) then
     _Msg( "Authorized." )
  else
    _Msg( "No acess!" )
    _ScreenText( pickerup, "You do not have permission to use this weapon",0, 0, 255,0,0,255,1,1,2,1,0)
_PlayerSilentKill( pickerup, 1, true )

  end



end

Now, create a new lua file called 'wepadminlist' (It must be called this and must be in the same folder as the weapons it is used in).
Inside, paste this:
Code: [Select]
AUTHID1 = "Steam ID Here";
AUTHID2 = "Steam ID Here";
AUTHID3 = "Steam ID Here";
AUTHID4 = "Steam ID Here";
AUTHID5 = "Steam ID Here";
AUTHID6 = "Steam ID Here";
AUTHID7 = "Steam ID Here";
AUTHID8 = "Steam ID Here";
AUTHID9 = "Steam ID Here";
AUTHID10 = "Steam ID Here";
AUTHID11 = "Steam ID Here";
For every admin, replace the part inside the quotes that says Steam ID Here, and replace it with the admin's steamid.

and your done.
« Last Edit: March 29, 2006, 10:31:39 PM by Golden-Death »


Offline Jesusaurus-Rex

  • Newbie
  • *
  • Posts: 29
  • Karma: 3
Re: Gun Admin Check
« Reply #1 on: December 17, 2005, 02:52:21 PM »
Oh, nice work, maybe Meggeh could help you use the ULX admin list.

Offline Mank

  • Full Member
  • ***
  • Posts: 209
  • Karma: 9
    • Ulysses Mod!
Re: Gun Admin Check
« Reply #2 on: December 17, 2005, 03:21:17 PM »
Use _PlayerSilentKill instead.  It kills em even when they have buddha.
If you doubt your powers you bring powers to your doubts.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Gun Admin Check
« Reply #3 on: December 17, 2005, 07:15:06 PM »
Uh... please use ULX for that user list... that's terrible. Read the docs at http://wiki.ulyssesmod.net/
Experiencing God's grace one day at a time.

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Re: Gun Admin Check
« Reply #4 on: December 17, 2005, 08:42:35 PM »
redid it


Offline Mank

  • Full Member
  • ***
  • Posts: 209
  • Karma: 9
    • Ulysses Mod!
Re: Gun Admin Check
« Reply #5 on: December 18, 2005, 03:32:02 AM »
Nice one.
If you doubt your powers you bring powers to your doubts.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Gun Admin Check
« Reply #6 on: February 10, 2006, 02:13:59 PM »
Please update this plugin to use ULX v1.1's new module system
Experiencing God's grace one day at a time.

Atomix

  • Guest
Re: Gun Admin Check
« Reply #7 on: February 20, 2006, 09:41:34 AM »
I put it at the top of all my admin only guns, and anyone can still pick them up, and in the master console it just says.

[LUA] Error calling 'onPickup' : 'Line 3: attempt to call global 'hasAccess' <anil value>'

can someone tell me what I'm doing wrong?

Thank youuuu

-Atomix

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Re: Gun Admin Check
« Reply #8 on: February 20, 2006, 10:32:23 AM »
Its probobly because meg has changed the code for the new version. Ill see what I can do to update it.


Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Gun Admin Check
« Reply #9 on: February 20, 2006, 11:03:30 AM »
Nope, hasAccess still exists, if it says it's nil he's probably not using ULX.
Experiencing God's grace one day at a time.

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Re: Gun Admin Check
« Reply #10 on: February 20, 2006, 11:07:04 AM »
Ah, yes you need ULX to use this.


Mascot105

  • Guest
Re: Gun Admin Check
« Reply #11 on: March 11, 2006, 08:43:43 PM »
Thanks SOOOO Much!.
Very Very Very usuful for construct servers.

Slayer_NL

  • Guest
Re: Gun Admin Check
« Reply #12 on: March 25, 2006, 09:14:20 AM »
Could you please explain a bit more.
I have downloaded ULX 1.1 and set up correctly because im admin.
I have putten the script above the .lua from the weapon and i get the same error as Atomix.

Please explain a bit better what I'm doing wrong.

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Re: Gun Admin Check
« Reply #13 on: March 25, 2006, 09:26:33 AM »
Do you have ULX installed and working correctly?


Slayer_NL

  • Guest
Re: Gun Admin Check
« Reply #14 on: March 25, 2006, 10:34:58 AM »
Well i think so I am admin and all commands are working so i think it's installed correctly.