How would one restrict a class to a group?

Need some help with gamemode related stuff?

How would one restrict a class to a group?

Postby BlankJones » Wed Jan 30, 2013 1:44 pm

I'm having another issue (again D:) Whenever someone attempts to raid a community stockpile, the progress bar never stops making people having to rejoin in order to clear the screen. Any advice?

Screenshots:
http://steamcommunity.com/sharedfiles/f ... =123938518
http://steamcommunity.com/sharedfiles/f ... =123938544
http://steamcommunity.com/sharedfiles/f ... =123938558

Also two questions;

1.) How would one restrict a class to a group?
I used the code:
Code: Select all
function(ply) return ply:GetUserGroup() == "donator"  end

I put it in the shared.lua:
Code: Select all
          --Team Variables

TEAM_WASTELANDER = 6
TEAM_SCAVENGER = 7
TEAM_SCIENCE = 8
TEAM_ENGINEER = 9
TEAM_CULTIVATOR = 5
TEAM_DONATOR = 4

team.SetUp( TEAM_WASTELANDER, "Wastelander", Color( 125, 125, 125, 255 ) ) --Gray
team.SetUp( TEAM_SCAVENGER, "Scavenger", Color( 102, 51, 0, 225 ) ) --Brown
team.SetUp( TEAM_SCIENCE, "Science", Color( 0, 0, 153, 225 ) ) --Blue
team.SetUp( TEAM_ENGINEER, "Engineer", Color( 255, 204, 0, 225 ) ) --Orange
team.SetUp( TEAM_CULTIVATOR, "Cultivator", Color( 51, 153, 0, 225 ) ) --Green
team.SetUp( TEAM_DONATOR, "Vault Dweller", Color(0, 100, 0) function(ply) return ply:GetUserGroup() == "donator" or ply:IsAdmin() end)


2.) Adding in weapons. I'm trying to add in the Crossbow for the donator group "Vault Dweller". My attempts at copying one of the exsisting weapons, then changing the information didn't seem to work!


Any help appreciated :D
BlankJones
 
Posts: 33
Joined: Sat Jun 09, 2012 12:28 pm

Re: Stockpile Raiding bug!

Postby eldarstorm » Wed Jan 30, 2013 3:20 pm

Please use one post per issue.
Also, bug reports need to go into the bug section, not this one.
As for bug reports, please check the list of bugs on the tracker and the bug sdection before posting.
The stockpile issue is a known issue. One that I was planning on working on this past weakend, but due to car issues, plumbing issues, and a massice migrane one day I have had to put debugging off for a bit.

I am renaming the post to reflect the grouping issue.
Image
User avatar
eldarstorm
Developer
 
Posts: 1172
Joined: Tue Nov 17, 2009 1:56 pm

Re: How would one restrict a class to a group?

Postby eldarstorm » Wed Jan 30, 2013 3:32 pm

What do you mean restrict a class to a group?
From the code above it looks like your trying to add a new class.

Setting up a new class is a lot more complicated than just creating the teat.setup and the team number. You should also avoid using any team numbers under 5, these seem to have issues after one of the previous updates to Garrys Mod.

You are also using the team.SetUp incorrectly. Here is the Garrys Mod Wiki link for that function http://wiki.garrysmod.com/page/Libraries/team/SetUp
Your Color designation for the new team is also missing the alpha variable as well.
Image
User avatar
eldarstorm
Developer
 
Posts: 1172
Joined: Tue Nov 17, 2009 1:56 pm

Re: How would one restrict a class to a group?

Postby LostInTheWired » Wed Jan 30, 2013 6:28 pm

First thing, it's in the issue tracker and will be fixed as soon as possible.

Your second issue, though, is more complicated. While I never liked the servers that do what you do, it's not in my power to stop you, and against my personal ethics to refuse help.

First thing to keep in mind is the team enums at the top, you cannot go 4 or below. We moved all the teams up because of an issue with NPCs. Players in a team group of 1-4 would not take damage from NPCs, so you will have to put it above the current max. You are also using team.SetUp wrong, in a way. While your function would technically work, it will error every time as ply is out of scope. There is no way for the function to receive the player value, so you'll likely have to modify the class switch functions for that functionality. I will also say to keep in mind, depending on what buffs/debuffs/skills this new class will have, there are a LOT of files you have to modify. Adding a class, while we wanted to make it more modular, was not made so due to the time constraints during early development. You will likely have to edit init, cl_init, much of the HUD code, likely construction, as well as entities this class works with and any files covering where they would get a buff/debuff.

For your third question, didn't work how? It's likely the vanilla crossbow uses an overrided ShootBullet function, so even using the crossbow model, it'll just look like it shoots bullets. Honestly, I make most of my guns copying my previous code. How is it not working?
LostInTheWired
Developer
 
Posts: 306
Joined: Tue Nov 17, 2009 7:54 pm

Re: How would one restrict a class to a group?

Postby BlankJones » Thu Jan 31, 2013 7:06 pm

Sorry took a while to respond. Anyways, the crossbow shows up being held to the left, GUI picture is that of the AK and it shoots rapid fire, that's because I didn't change the bullet codes but still have no idea why it's on the left. And I kinda agree with you there on dontor classes, if someone wants to donate then it should be just appreciated not rewarded, otherwise it's selling ;)
BlankJones
 
Posts: 33
Joined: Sat Jun 09, 2012 12:28 pm

Re: How would one restrict a class to a group?

Postby LostInTheWired » Fri Feb 01, 2013 12:46 pm

You're probably using the AK Composite code to base yours on. First off, the reason it shows up on the left is because it has view model flip set to true. that's required for CSS view models because the modeler for CSS was actually left handed, and modeled the guns like he saw them. Look for "SWEP.ViewModelFlip" in your shared file for the weapon and set that to false. GUI picture is handled in cl_init of the weapon. You'll have to modify this code to show a crossbow. An example using HL2DM icons is on the pulse rifle. Lastly, the gun shoots rapid fire because you have "SWEP.Primary.Automatic" set to true. Set it to false.
LostInTheWired
Developer
 
Posts: 306
Joined: Tue Nov 17, 2009 7:54 pm


Return to PNRP Tech and Troubleshooting

Who is online

Users browsing this forum: No registered users and 1 guest

cron