• How to make a secondary groups (script) custom jobcheck
    3 replies, posted
So with my NPC, I want only certain jobs/teams to spawn certain stuff, example: I want this ship to only spawn if your team/secondary group is "Red Squad" Any help would be appreciated. net.Receive("BuyYWing", function(len, ply)     entity = ents.Create("y-wing")     entity:SetAngles(Angle(0, 180, 0))     entity:SetPos(ply:EyePos() + ply:GetAngles():Right() * 350 + Vector(-30, 0, 10))                     entity:Spawn()         timer.Simple( .25, function()                ply:Say("Your ship has been delivered.")         end)         end)
Before you start spawning the entity try putting: if ply:Team() == TEAM_NAME then *your code for spawning the ship* end All was written on my phone so there may be a typo
You said "certain jobs", is this for an RP server? The snippet Luke posted above will work if you know the team index (which in RP you set when creating the job), but if you want to check for the team name string like "Red Squad" it'd need a small adjustment. if team.GetName(ply:Team()) == "Red Squad" then -- Ship spawn code goes here end
You said "certain jobs", is this for an RP server? The snippet Luke posted above will work if you know the team index (which in DarkRP you set when creating the job), but if you want to check for the team name string like "Red Squad" it'd need a small adjustment. if team.GetName(ply:Team()) == "Red Squad" then -- Ship spawn code goes here end It is a star wars RP server, and for our groups we use a gmod store script called secondary groups, and it has a customcheck function that is ply:IsSecondaryUserGroup "group", like for our jobs and the whitelist the customcheck for that is  customCheck = function( ply ) return ply:IsSecondaryUserGroup "327th Marksman"       end
Sorry, you need to Log In to post a reply to this thread.