Few Server Problems - DarkRP Server

I have recently made a server for darkrp, and have almost everything done. I am having a problem with the gun dealer class and a few other things.

To make it easy i have a few questions that i have been searching on google for about 5 days with no results. Please respond with the number and your answer!

  1. When I edit the addentities.lua I have all my weapons made in shipments and that’s working great! But i have yet to find how to allow only gun dealers to buy the guns on their own. Like 1 pistol instead of a shipment. (I changed the false to true, but now every class can buy them).

  2. I have files that are in use on my server in the addons folder, but when clients join, it doesn’t make them download, and it shows up as errors. For instance a few custom weapons, and a player model called NSA Agent. I have tried a few things in the LUA/AUTORUN/SERVER but so far no result.

  3. I made a few admin classes like (“admin on duty”, “swat”, etc.) But i have made a subscriber rank and want them to get custom weapons and allow them to get ruby printer and custom classes. Is there a way to change in the shared.lua file the 0=anyone, 1=admin, 2=superadmin, by adding a 3 for subscriber???

Thanks Ahead of time for the help.

  1. False and True in addshipments don’t determine who can buy them, the rp_buypistols cVar does.
  2. Have you mirrored the files onto a webhost?
  3. It doesn’t work that way, you have to edit player.lua, under changejobs, and add an if statement, followed by the TEAM name.

Thanks for the quick response!

  1. When I change rp_buypistols nothing shows up in entities tab!
  2. I have a dedicated server from my alienware and the files are all in my addons
  3. I looked through the default player.lua in darkrp gamemode and dont understand what you want me to put, and where.

 /*---------------------------------------------------------
 Teams/jobs
 ---------------------------------------------------------*/
function meta:ChangeTeam(t, force)
	if RPArrestedPlayers[self:SteamID()] and not force then
		if not self:Alive() then
			Notify(self, 1, 4, string.format(LANGUAGE.unable, team.GetName(t), ""))
			return
		else
			Notify(self, 1, 4, string.format(LANGUAGE.unable, team.GetName(t), ""))
			return
		end
	end
	
	self:SetDarkRPVar("helpBoss",false)
	self:SetDarkRPVar("helpCop",false)
	self:SetDarkRPVar("helpMayor",false)

	
	if t ~= TEAM_CITIZEN and not self:ChangeAllowed(t) and not force then
		Notify(self, 1, 4, string.format(LANGUAGE.unable, team.GetName(t), "banned/demoted"))
		return
	end
	
	if self.LastJob and 10 - (CurTime() - self.LastJob) >= 0 and not force then
		Notify(self, 1, 4, string.format(LANGUAGE.have_to_wait,  math.ceil(10 - (CurTime() - self.LastJob)), "/job"))
		return 
	end
	
	if self.IsBeingDemoted then
		self:TeamBan()
		vote.DestroyVotesWithEnt(self)
		Notify(self, 1, 4, "You tried to escape demotion. You failed, and have been demoted.")
	end
	
	
	if self:Team() == t then
		Notify(self, 1, 4, string.format(LANGUAGE.unable, team.GetName(t), ""))
		return
	end

	local TEAM = RPExtraTeams[t]
	if not TEAM then return end
	
	if not self.DarkRPVars["Priv"..TEAM.command] and not force  then
		if type(TEAM.NeedToChangeFrom) == "number" and self:Team() ~= TEAM.NeedToChangeFrom then
			Notify(self, 1,4, string.format(LANGUAGE.need_to_be_before, team.GetName(TEAM.NeedToChangeFrom), TEAM.name))
			return
		elseif type(TEAM.NeedToChangeFrom) == "table" and not table.HasValue(TEAM.NeedToChangeFrom, self:Team()) then
			local teamnames = ""
			for a,b in pairs(TEAM.NeedToChangeFrom) do teamnames = teamnames.." or "..team.GetName(b) end
			Notify(self, 1,4, string.format(string.sub(teamnames, 5), team.GetName(TEAM.NeedToChangeFrom), TEAM.name))
			return
		end
		if GetConVarNumber("max"..TEAM.command.."s") and GetConVarNumber("max"..TEAM.command.."s") ~= 0 and team.NumPlayers(t) >= GetConVarNumber("max"..TEAM.command.."s")then
			Notify(self, 1, 4, string.format(LANGUAGE.team_limit_reached, TEAM.name))
			return
		end
	end
	if self:Team() == TEAM_MAYOR and tobool(GetConVarNumber("DarkRP_LockDown")) then
		UnLockdown(self)
	end
	self:UpdateJob(TEAM.name)
	DB.StoreSalary(self, TEAM.salary)
	NotifyAll(0, 4, string.format(LANGUAGE.job_has_become, self:Nick(), TEAM.name))
	if self.DarkRPVars.HasGunlicense then
		self:SetDarkRPVar("HasGunlicense", false)
	end
	if TEAM.Haslicense and GetConVarNumber("license") ~= 0 then
		self:SetDarkRPVar("HasGunlicense", true)
	end
	
	self.LastJob = CurTime()
	
	if t == TEAM_POLICE then	
		self:SetDarkRPVar("helpCop", true)
	elseif t == TEAM_MOB then
		self:SetDarkRPVar("helpBoss", true)
	elseif t == TEAM_MAYOR then
		self:SetDarkRPVar("helpMayor", true)
	end
	
	if tobool(GetConVarNumber("removeclassitems")) then
		for k, v in pairs(ents.FindByClass("microwave")) do
			if v.SID == self.SID then v:Remove() end
		end
		for k, v in pairs(ents.FindByClass("gunlab")) do
			if v.SID == self.SID then v:Remove() end
		end
		
		if t ~= TEAM_MOB and t ~= TEAM_GANG then
			for k, v in pairs(ents.FindByClass("drug_lab")) do
				if v.SID == self.SID then v:Remove() end
			end
		end
		
		for k,v in pairs(ents.FindByClass("spawned_shipment")) do
			if v.SID == self.SID then v:Remove() end
		end
	end
	
	self:SetTeam(t)
	DB.Log(self:SteamName().." ("..self:SteamID()..") changed to "..team.GetName(t))
	if self:InVehicle() then self:ExitVehicle() end
	if GetConVarNumber("norespawn") == 1 and self:Alive() then
		self:StripWeapons()
		local vPoint = self:GetShootPos() + Vector(0,0,50)
		local effectdata = EffectData()
		effectdata:SetEntity(self)
		effectdata:SetStart( vPoint ) -- Not sure if we need a start and origin (endpoint) for this effect, but whatever
		effectdata:SetOrigin( vPoint )
		effectdata:SetScale(1)
		util.Effect("entity_remove", effectdata)
		GAMEMODE:PlayerSetModel(self)
		GAMEMODE:PlayerLoadout(self)
	else
		self:KillSilent()
	end
end

function meta:UpdateJob(job)
	self:SetDarkRPVar("job", job)
	self:GetTable().Pay = 1
	self:GetTable().LastPayDay = CurTime()

	timer.Create(self:SteamID() .. "jobtimer", GetConVarNumber("paydelay"), 0, self.PayDay, self)
end


Alright, well since you took your time to copy and paste.

Hm, strange. Your DarkRP doesn’t look like mine, might be outdated.
Anyways, let’s see…

replace this:
[lua] if self:Team() == t then
Notify(self, 1, 4, string.format(LANGUAGE.unable, team.GetName(t), “”))
return
[/lua]

With this.

[lua] for k,v in pairs(RPExtraTeams) do
if t == k then
if self:Team() == t then
Notify(self, 1, 4, string.format(LANGUAGE.unable, team.GetName(t), “”))
return
end

			if ( not self:IsUserGroup( "vip" ) ) then

	local VipNote = "You're not VIP, go donate cheap ass."

			if (t == TEAM_NAME) then
	Notify(self, 1, 4, VipNote)   
	return    
  end

end[/lua]

Ignore the for k,v area, the important area is the if ( not) section. That determines what groups can use the job. If the group is not vip, and they’re trying to switch to your TEAM_NAME, than send them the Notification of VipNote, which is “You’re not vip blahblah”.

:slight_smile:

As for rp_buypistols, did you assign the entities to any jobs?

And you need a completely separate WebHost, you’re using Windows I’d assume?
Get WAMP, and setup Apache to mirror your files.

Thanks for the code, i am putting in now. what do i put under the class that i want them to have?

yes i assigned all gun entities to gun dealer and admin.

I added u on steam to make contact easier if you wanna help me over that…

BTW thanks for everything

There is a server-side cvar that disables /buypistol. Go into game, as an admin and press F4, then go to Admin tab and find it.

Then go to your addentities.lua and find the number that corresponds to however much are in the shipment. Make it to 1, then adjust the price accordingly. When the gun dealer buys it, it will come one pistol per crate.

Simple and realistic.