Ulysses

Ulysses Stuff => Ulysses Release Archives => Releases => Releases for ULX v1.* => Topic started by: Golden-Death on December 17, 2005, 02:49:29 PM

Title: Gun Admin Check
Post by: Golden-Death 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.
Title: Re: Gun Admin Check
Post by: Jesusaurus-Rex on December 17, 2005, 02:52:21 PM
Oh, nice work, maybe Meggeh could help you use the ULX admin list.
Title: Re: Gun Admin Check
Post by: Mank on December 17, 2005, 03:21:17 PM
Use _PlayerSilentKill instead.  It kills em even when they have buddha.
Title: Re: Gun Admin Check
Post by: Megiddo 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/
Title: Re: Gun Admin Check
Post by: Golden-Death on December 17, 2005, 08:42:35 PM
redid it
Title: Re: Gun Admin Check
Post by: Mank on December 18, 2005, 03:32:02 AM
Nice one.
Title: Re: Gun Admin Check
Post by: Megiddo on February 10, 2006, 02:13:59 PM
Please update this plugin to use ULX v1.1's new module system
Title: Re: Gun Admin Check
Post by: Atomix 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
Title: Re: Gun Admin Check
Post by: Golden-Death 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.
Title: Re: Gun Admin Check
Post by: Megiddo on February 20, 2006, 11:03:30 AM
Nope, hasAccess still exists, if it says it's nil he's probably not using ULX.
Title: Re: Gun Admin Check
Post by: Golden-Death on February 20, 2006, 11:07:04 AM
Ah, yes you need ULX to use this.
Title: Re: Gun Admin Check
Post by: Mascot105 on March 11, 2006, 08:43:43 PM
Thanks SOOOO Much!.
Very Very Very usuful for construct servers.
Title: Re: Gun Admin Check
Post by: Slayer_NL 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.
Title: Re: Gun Admin Check
Post by: Golden-Death on March 25, 2006, 09:26:33 AM
Do you have ULX installed and working correctly?
Title: Re: Gun Admin Check
Post by: Slayer_NL 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.
Title: Re: Gun Admin Check
Post by: Golden-Death on March 25, 2006, 01:17:47 PM
Well im stumped. For some reason, no matter what I do, if I run any script that has a ULX specific function, it doesnt work. (IE: hasAccess keeps coming out as a nil value, as well as CONCOMMAND)

Code: [Select]

] lua _PlayerGiveSWEP(1,"jetpack.lua")
Lua Error: Line 8: attempt to call global 'ULX_CONCOMMAND' (a nil value)
LUA: Errors when running script 'access.lua'
] lua_openscript access.lua
] gd_test
No access for you!
Title: Re: Gun Admin Check
Post by: Golden-Death on March 25, 2006, 01:35:56 PM
Bah im beginnign to hate this thing. Please tell me if this works.

Make a lua file called 'access.lua' in the lua folder. Fill it:
Code: [Select]
function cc_gd_test( userid, args, argv, argc )
  if hasAccess( userid, ACCESS_KICK ) == true then
    ulx_console( userid, "Authorized." )
  else
    ulx_console( userid, "No Access." )
  end
end
ULX_CONCOMMAND( "gd_test", cc_gd_test )

Open the weapon script, add to the top:
Code: [Select]
_ServerCommand("gd_test\n")

Now load the game and type
Code: [Select]
lua_openscript access.luathen load your weapon. If you can use it, the console should say authorized, if not, it should say No Access. Please confirm.
Title: Re: Gun Admin Check
Post by: Slayer_NL on March 26, 2006, 04:22:41 AM
Well it says authorized when i spawn it and pick it up. BUT Normal players can still pick it up.
Title: Re: Gun Admin Check
Post by: Golden-Death on March 26, 2006, 09:43:38 AM
Yeah I've noticed that too, I have no idea why. Is hasAccess broken?
Title: Re: Gun Admin Check
Post by: Slayer_NL on March 27, 2006, 05:17:49 AM
Ok thanks for helping. When you have a fix please post it. ;D
Title: Re: Gun Admin Check
Post by: Megiddo on March 27, 2006, 06:47:53 AM
Yeah I've noticed that too, I have no idea why. Is hasAccess broken?

Don't kid yourself GD. Try putting debug messages in your code to see what's wrong.
Title: Re: Gun Admin Check
Post by: Slayer_NL on March 28, 2006, 07:11:59 AM
Any fixes yet?
Title: Re: Gun Admin Check
Post by: Golden-Death on March 28, 2006, 07:27:09 PM
No, sorry, been too busy. I get home at 7:30 every day this week and next. orchestra
Title: Re: Gun Admin Check
Post by: Slayer_NL on March 29, 2006, 04:11:40 AM
Ok no problem. I can wait.
Title: Re: Gun Admin Check
Post by: Golden-Death on March 29, 2006, 10:13:55 PM
As soon as I find the code that converts playerid to steamid, this will be fixed.
Title: Re: Gun Admin Check
Post by: Golden-Death on March 29, 2006, 10:26:03 PM
Ok I fixed it, see the first post for details.

Edit: Yeah, I used my own custom admin list. I can't be bothered to figure out whats wrong with the ULX admins list with what little time I have.
Title: Re: Gun Admin Check
Post by: Megiddo on March 30, 2006, 08:15:24 AM
I wish I had a dime for every time someone blamed their problems on me... I'd be a rich man... very rich.
Title: Re: Gun Admin Check
Post by: Slayer_NL on March 30, 2006, 10:25:56 AM
Does this have to be in the weapon script or can i just paste the new code at the top of the script?
Code: [Select]
function onPickup( userid )
end
Title: Re: Gun Admin Check
Post by: Golden-Death on March 30, 2006, 03:38:52 PM
Im not blaming you Meg, im simply stating that Ive tried all I can.

You replace that code with the one in the first post
Title: Re: Gun Admin Check
Post by: Slayer_NL on March 31, 2006, 05:22:12 AM
Oh ok tnx for the helping going to test it.
Title: Re: Gun Admin Check
Post by: Slayer_NL on March 31, 2006, 06:53:46 AM
Can i put all the weapons in like one folder called Admin SWEPS and then put the steamid's in there too would that work?
Title: Re: Gun Admin Check
Post by: Slayer_NL on March 31, 2006, 09:45:18 AM
It's not really working for me. It sees the wepadminlist as a SWEP weapon and when i add my steamid in the list im still not authorized to use the gun.
Title: Re: Gun Admin Check
Post by: Golden-Death on March 31, 2006, 03:50:24 PM
Just to make sure its proper, could you post the SWEP and the admin list for me?
Title: Re: Gun Admin Check
Post by: Slayer_NL on April 01, 2006, 02:23:22 AM
Adminlist:
Code: [Select]
AUTHID1 = "STEAM_0:0:187892";
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";

SWEP(Blackholegun):
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

--[[  ______________________________________________
     |¡!¡!¡!¡!¡!¡     Black Hole Gun    !¡!¡!¡!¡!¡!¡|
     |!¤¡!¡!¡!¤¡!        v. 1.8         ¡!¤¡!¡!¡!¡¤!|
     |¡!¡!¡!¡!¡!¡!¡!¡      By     !¡!¡!¡!¡!¡!¡!¡!¡!¡|
     |!¡!¡!¤¡!¡!¡  TrinitronX (enTity)  !¡!¡!¡¤!¡!¡!|
     |¡!¡!¡!¡!¡!¡      ROBO DONUT       !¡!¡!¡!¡!¡!¡|
     |!¤¡!¡!¡!¤¡¡         and           ¡!¤¡!¡!¡!¡¤!|
     |¡!¡!¡!¡!¡!¡       dssalmon        !¡!¡!¡!¡!¡!¡|
     |¡¤¡!¡!¡¤¡ vector/angle functions by  ¡¤¡!¡!¡¤¡|
     |¡!¡!¤!¡!¡         GeoGriff           ¡!¡!¤!¡!¡|
     |¡¤¡!¡!¡¤¡  gun inspired by NeoSeeker ¡¤¡!¡!¡¤¡|
      ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Feel free to use this, or modify it.. as long as you give the authors credit.  Thanks!
]]

-- global variables that can tweak the effects of the black hole (feel free to change them if wanted)

affectplayers = true; -- whether or not the black hole will suck players in (default true). Set to false to not pull in players.
affectnpcs = true; -- whether or not the black hole will suck in npcs (default true)

-- Shot related settings
local fieldtime = 10; --default is 7 (the amount of time the black hole is in effect for.. note that changing this may offset the black hole's sound effects)
local shotmovetime = 3; --default is 3 (the amount of time the black hole ball can move around)

-- Black hole related settings
blackholeforce = 90000000; --90000000 is default for the black hole's force.  Use less to give it less pull
blackholeouterradius = 300000; --default is 300000 (effects the outer/pulling radius of the black hole)
blackholeinnerradius = 70; --default is 70 (effects the inner deletion/kill radius of the black hole)


Code for the SWEP is to long so i only posted the begin.
Title: Re: Gun Admin Check
Post by: Golden-Death on April 01, 2006, 10:59:10 AM
Works for me. Try making sure your Steamid is what it is when your ingame. WHen your on singleplayer, it may be UNKNOWN so thats what youd have to put in there.

Title: Re: Gun Admin Check
Post by: Slayer_NL on April 02, 2006, 12:43:29 AM
Ok ill try. When not working i'll post again. :P
Title: Re: Gun Admin Check
Post by: Slayer_NL on April 02, 2006, 05:09:25 AM
Ok i found out that i missed one number in my STEAMID. I put that number in and it still says No access and i get slayed.
Title: Re: Gun Admin Check
Post by: Golden-Death on April 02, 2006, 09:46:54 AM
And your steamid that you entered is the exact one that comes up when you type status?
Title: Re: Gun Admin Check
Post by: Slayer_NL on April 02, 2006, 11:16:48 AM
Yes i copied it.
Title: Re: Gun Admin Check
Post by: Golden-Death on April 02, 2006, 12:07:45 PM
Huh... I don't really know. However, when I was testing it, I never had a problem with it not giving access... when it was broken, it always gave access, not vice versa, so there must be something wrong with the steam id list or something
Title: Re: Gun Admin Check
Post by: Slayer_NL on April 03, 2006, 06:34:23 AM
Can be, because i have another admin only SWEP script and when i add my id there it doesn't give me access. So I'll try it with my friend his id and see if he get's access.
Title: Re: Gun Admin Check
Post by: purplg on August 14, 2006, 06:47:49 PM
I found out the problem with the script.

Well, move your wepadminlist.lua to the GMod9/lua folder, but leave everything else the same. It worked perfectly.

I'm currently using ULX v1.13 if that has anything to do with it. I'm just now starting to teach myself LUA so I don't know much.