DARKRP When you change jobs you dont see? and dont spawn with any tools?
8 replies, posted
Basically, the HUD Is empty, you dont spawn with the tools and your screwed basically,
Error when changing jobs:
[IMG]http://i41.tinypic.com/29frosi.png[/IMG]
SV_Jobs dl: [url]https://mega.co.nz/#!MdBQzb6A!sbTvpS6ob3Gt73fdMSRzopcSyPOhaMsmScr_8DwaLQQ[/url]
code: [CODE]/*---------------------------------------------------------------------------
Functions
---------------------------------------------------------------------------*/
local meta = FindMetaTable("Player")
function meta:changeTeam(t, force)
local prevTeam = self:Team()
if self:isArrested() and not force then
DarkRP.notify(self, 1, 4, DarkRP.getPhrase("unable", team.GetName(t), ""))
return false
end
self:setDarkRPVar("agenda", nil)
if t ~= GAMEMODE.DefaultTeam and not self:changeAllowed(t) and not force then
DarkRP.notify(self, 1, 4, DarkRP.getPhrase("unable", team.GetName(t), "banned/demoted"))
return false
end
if self.LastJob and 10 - (CurTime() - self.LastJob) >= 0 and not force then
DarkRP.notify(self, 1, 4, DarkRP.getPhrase("have_to_wait", math.ceil(10 - (CurTime() - self.LastJob)), "/job"))
return false
end
if self.IsBeingDemoted then
self:teamBan()
self.IsBeingDemoted = false
self:changeTeam(GAMEMODE.DefaultTeam, true)
DarkRP.destroyVotesWithEnt(self)
DarkRP.notify(self, 1, 4, DarkRP.getPhrase("tried_to_avoid_demotion"))
return false
end
if prevTeam == t then
DarkRP.notify(self, 1, 4, DarkRP.getPhrase("unable", team.GetName(t), ""))
return false
end
local TEAM = RPExtraTeams[t]
if not TEAM then return false end
if TEAM.customCheck and not TEAM.customCheck(self) then
DarkRP.notify(self, 1, 4, TEAM.CustomCheckFailMsg or DarkRP.getPhrase("unable", team.GetName(t), ""))
return false
end
if not self.DarkRPVars["Priv"..TEAM.command] and not force then
if type(TEAM.NeedToChangeFrom) == "number" and prevTeam ~= TEAM.NeedToChangeFrom then
DarkRP.notify(self, 1,4, DarkRP.getPhrase("need_to_be_before", team.GetName(TEAM.NeedToChangeFrom), TEAM.name))
return false
elseif type(TEAM.NeedToChangeFrom) == "table" and not table.HasValue(TEAM.NeedToChangeFrom, prevTeam) then
local teamnames = ""
for a,b in pairs(TEAM.NeedToChangeFrom) do teamnames = teamnames.." or "..team.GetName(b) end
DarkRP.notify(self, 1,4, string.format(string.sub(teamnames, 5), team.GetName(TEAM.NeedToChangeFrom), TEAM.name))
return false
end
local max = TEAM.max
if max ~= 0 and -- No limit
(max >= 1 and team.NumPlayers(t) >= max or -- absolute maximum
max < 1 and (team.NumPlayers(t) + 1) / #player.GetAll() > max) then -- fractional limit (in percentages)
DarkRP.notify(self, 1, 4, DarkRP.getPhrase("team_limit_reached", TEAM.name))
return false
end
end
if TEAM.PlayerChangeTeam then
local val = TEAM.PlayerChangeTeam(self, prevTeam, t)
if val ~= nil then
return val
end
end
local hookValue = hook.Call("playerCanChangeTeam", nil, self, t, force)
if hookValue == false then return false end
local isMayor = RPExtraTeams[prevTeam] and RPExtraTeams[prevTeam].mayor
if isMayor and tobool(GetConVarNumber("DarkRP_LockDown")) then
DarkRP.unLockdown(self)
end
self:updateJob(TEAM.name)
self:setSelfDarkRPVar("salary", TEAM.salary)
DarkRP.notifyAll(0, 4, DarkRP.getPhrase("job_has_become", self:Nick(), TEAM.name))
if self:getDarkRPVar("HasGunlicense") then
self:setDarkRPVar("HasGunlicense", false)
end
if TEAM.hasLicense and GAMEMODE.Config.license then
self:setDarkRPVar("HasGunlicense", true)
end
self.LastJob = CurTime()
if GAMEMODE.Config.removeclassitems then
for k, v in pairs(ents.FindByClass("microwave")) do
if v.allowed and type(v.allowed) == "table" and table.HasValue(v.allowed, t) then continue end
if v.SID == self.SID then v:Remove() end
end
for k, v in pairs(ents.FindByClass("gunlab")) do
if v.allowed and type(v.allowed) == "table" and table.HasValue(v.allowed, t) then continue end
if v.SID == self.SID then v:Remove() end
end
for k, v in pairs(ents.FindByClass("drug_lab")) do
if v.allowed and type(v.allowed) == "table" and table.HasValue(v.allowed, t) then continue end
if v.SID == self.SID then v:Remove() end
end
for k,v in pairs(ents.FindByClass("spawned_shipment")) do
if v.allowed and type(v.allowed) == "table" and table.HasValue(v.allowed, t) then continue end
if v.SID == self.SID then v:Remove() end
end
end
if isMayor then
for _, ent in pairs(self.lawboards or {}) do
if IsValid(ent) then
ent:Remove()
end
end
end
self:SetTeam(t)
hook.Call("OnPlayerChangedTeam", GAMEMODE, self, prevTeam, t)
DarkRP.log(self:Nick().." ("..self:SteamID()..") changed to "..team.GetName(t), nil, Color(100, 0, 255))
if self:InVehicle() then self:ExitVehicle() end
if GAMEMODE.Config.norespawn 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)
hook.Call("UpdatePlayerSpeed", GAMEMODE, self)
GAMEMODE:PlayerSetModel(self)
GAMEMODE:PlayerLoadout(self)
else
self:KillSilent()
end
umsg.Start("OnChangedTeam", self)
umsg.Short(prevTeam)
umsg.Short(t)
umsg.End()
return true
end
function meta:updateJob(job)
self:setDarkRPVar("job", job)
timer.Create(self:UniqueID() .. "jobtimer", GAMEMODE.Config.paydelay, 0, function()
if not IsValid(self) then return end
self:payDay()
end)
end
function meta:teamUnBan(Team)
if not IsValid(self) then return end
if not self.bannedfrom then self.bannedfrom = {} end
self.bannedfrom[Team] = 0
end
function meta:teamBan(t, time)
if not self.bannedfrom then self.bannedfrom = {} end
t = t or self:Team()
self.bannedfrom[t] = 1
if time == 0 then return end
timer.Simple(time or GAMEMODE.Config.demotetime, function()
if not IsValid(self) then return end
self:teamUnBan(t)
end)
end
function meta:changeAllowed(t)
if not self.bannedfrom then return true end
if self.bannedfrom[t] == 1 then return false else return true end
end
/*---------------------------------------------------------------------------
Commands
---------------------------------------------------------------------------*/
local function ChangeJob(ply, args)
if args == "" then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
return ""
end
if ply:isArrested() then
DarkRP.notify(ply, 1, 5, DarkRP.getPhrase("unable", "/job", ""))
return ""
end
if ply.LastJob and 10 - (CurTime() - ply.LastJob) >= 0 then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("have_to_wait", math.ceil(10 - (CurTime() - ply.LastJob)), "/job"))
return ""
end
ply.LastJob = CurTime()
if not ply:Alive() then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("unable", "/job", ""))
return ""
end
if not GAMEMODE.Config.customjobs then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("disabled", "/job", ""))
return ""
end
local len = string.len(args)
if len < 3 then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("unable", "/job", ">2"))
return ""
end
if len > 25 then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("unable", "/job", "<26"))
return ""
end
local canChangeJob, message, replace = hook.Call("canChangeJob", nil, ply, args)
if canChangeJob == false then
DarkRP.notify(ply, 1, 4, message or DarkRP.getPhrase("unable", "/job", ""))
return ""
end
local job = replace or args
DarkRP.notifyAll(2, 4, DarkRP.getPhrase("job_has_become", ply:Nick(), job))
ply:updateJob(job)
return ""
end
DarkRP.defineChatCommand("job", ChangeJob)
local function FinishDemote(vote, choice)
local target = vote.target
target.IsBeingDemoted = nil
if choice == 1 then
target:teamBan()
if target:Alive() then
target:changeTeam(GAMEMODE.DefaultTeam, tr
[quote=garry]Do not post huge scripts and expect people to fix them. If you wrote the script then you should know why it doesn't work. If you're editing someone's script and can't get it to work then don't! Learn how to code!
KEEP DARP RP QUESTION TO THIS THREAD: [url]http://facepunch.com/showthread.php?t=1249475[/url][/quote]
First, Is your DarkRP Vanilla (Not custom, no added addons etc)
if yes, delete and download latest version.
Second, What did you last do to trigger this, when did it stop working?
Third, I really hope you didn't mess with the core DarkRP files, cause then it's your own fault
Forth, read the stickys, and if you changed the core DarkRP files, you may want to fix that..... especially before going posting on darkrp forums
1 No
2 No clue
3 Yup, cant get darkrpconfig to work
I see you have DarkRP 2.5 or higher, why the hell are you editing core files? They clearly advise you not to do that. I think most people won't even want to help you because of that reason XD
Yeah, I honestly am not gonna help and support you modifying the core files, it is clearly said not to, and in every folder it says don't modify anything but, you think your so pro and can do what you want, well, now, since your so smart, can fix this by yourself.
I follow tutorials, im not some pro coder, im learning from the "Pro coders" And the reason i modify them is DarkRPConfig or whatever its called DOESNT WORK for me. i dont get any of it. So if you dont wanna help, dont bother even posting.
I'm sure people would be willing to help if it didn't seem like your attitude about this was "here's my code fix it for me". Why didn't you ask about your config not working before you went and edited the core files?
[QUOTE=Agentbondy43;43655085]the reason i modify them is DarkRPConfig or whatever its called DOESNT WORK for me.[/QUOTE]
Well, look where modifying the DarkRP core files got you....
[editline]24th January 2014[/editline]
[QUOTE=Jeezy;43655299]I'm sure people would be willing to help if it didn't seem like your attitude about this was "here's my code fix it for me". Why didn't you ask about your config not working before you went and edited the core files?[/QUOTE]
Yeah, he just put in lots of code that is not very helpful, especially when the error is at line 155....
Plus, it doesn't sound like he even tried to use the DarkRPModificationAddon...
And, he is on the wrong forum.
Sorry, you need to Log In to post a reply to this thread.