• Multiple DarkRP and general server hosting questions for your consideration
    4 replies, posted
1. We have a couple of custom playermodels on our server. After much work in getting these installed on fastDL and added to the proper RP jobs we have a problem: the models work but when you open up the f4 menu and go to the job tab the icon is still of a red ERROR (even though when you hover over or choose that job, it is the working model). 2. We have a secret service job to guard the mayor but a problem came to our attention: this job can always be chosen and played even if there is no mayor. How would one go about adding the proper lua to make it so if there is not a mayor this job cannot be chosen and if the mayor dies or leaves everyone in this job gets demoted? 3. We have a SWAT class to help out the police. Unfortunately, this class cannot make warrants and wants. I explored main.lua and found where this is coded, but i cant seem to get a working edit. For your convenience the section in question is below: [CODE] local function SearchWarrant(ply, args) local t = ply:Team() if not ply:IsCP() then Notify(ply, 1, 4, string.format(LANGUAGE.must_be_x, "cop/mayor", "/warrant")) else if ply:IsCP() or t == "TEAM_SWAT" or t == "TEAM_MG" then -- THIS IS WHERE YOU EDITED YO local tableargs = string.Explode(" ", args) local reason = "" if #tableargs == 1 then Notify(ply, 1, 4, LANGUAGE.vote_specify_reason) return "" end if not ply:Alive() then Notify(ply, 1, 4, "You must be alive in order to issue a warrant") return "" end for i = 2, #tableargs, 1 do reason = reason .. " " .. tableargs[i] end reason = string.sub(reason, 2) if string.len(reason) > 25 then Notify(ply, 1, 4, string.format(LANGUAGE.unable, "/warrant", "<25 chars")) return "" end local p = FindPlayer(tableargs[1]) if p and p:Alive() then -- If we're the Mayor, set the search warrant if t == TEAM_MAYOR then SetWarrant(ply, p) else -- If we're CP or Chief -- Find the mayor local m = nil for k, v in pairs(player.GetAll()) do if v:Team() == TEAM_MAYOR then m = v break end end -- If we found the mayor if m ~= nil and not m.DarkRPVars.AFK then -- Request a search warrent for player "p" ques:Create(string.format(LANGUAGE.warrant_request.."\nReason: "..reason, ply:Nick(), p:Nick()), p:EntIndex() .. "warrant", m, 40, FinishWarrant, ply, p, reason) Notify(ply, 0, 4, string.format(LANGUAGE.warrant_request2, m:Nick())) else -- There is no mayor or the mayor is AFK, CPs can set warrants. SetWarrant(ply, p, reason) end end else Notify(ply, 1, 4, string.format(LANGUAGE.could_not_find, "player: "..tostring(args))) end end return "" end AddChatCommand("/warrant", SearchWarrant) AddChatCommand("/warrent", SearchWarrant) -- Most players can't spell for some reason local function PlayerWanted(ply, args) if not ply:IsCP() then Notify(ply, 1, 6, string.format(LANGUAGE.must_be_x, "cop/mayor", "/wanted")) else if ply:IsCP or ply:Team() == "TEAM_SWAT" or ply:Team == "TEAM_MG" then -- EDITED HERE TOO local tableargs = string.Explode(" ", args) local reason = "" if #tableargs == 1 then Notify(ply, 1, 4, LANGUAGE.vote_specify_reason) return "" end if not ply:Alive() then Notify(ply, 1, 4, "You must be alive in order to make someone wanted") return "" end for i = 2, #tableargs, 1 do reason = reason .. " " .. tableargs[i] end reason = string.sub(reason, 2) if string.len(reason) > 22 then Notify(ply, 1, 4, string.format(LANGUAGE.unable, "/wanted", "<23 chars")) return "" end local p = FindPlayer(tableargs[1]) if p and p:Alive() and not RPArrestedPlayers[p:SteamID()] and not p.DarkRPVars.wanted then p:SetDarkRPVar("wanted", true) p:SetDarkRPVar("wantedReason", tostring(reason)) for a, b in pairs(player.GetAll()) do b:PrintMessage(HUD_PRINTCENTER, string.format(LANGUAGE.wanted_by_police, p:Nick()).."\nReason: "..tostring(reason)) if b:IsAdmin() then b:PrintMessage( HUD_PRINTCONSOLE, ply:Nick() .. " has made " .. p:Nick() .. " wanted by police for " .. reason ) end end timer.Create(p:Nick() .. " wantedtimer", GetConVarNumber("wantedtime"), 1, TimerUnwanted, ply, p) else Notify(ply, 1, 4, string.format(LANGUAGE.could_not_find, "player: "..tostring(args))) end end return "" end AddChatCommand("/wanted", PlayerWanted) AddChatCommand("/wantid", PlayerWanted) -- Inspired by the /warrent for people not spelling write. You can rewrite so you can want like this: STEAM_0:0:29257121 stupid kid local function PlayerUnWanted(ply, args) if not ply:IsCP() then Notify(ply, 1, 6, string.format(LANGUAGE.must_be_x, "cop/mayor", "/unwanted")) else if ply:IsCP or ply:Team() == "TEAM_SWAT" or ply:Team == "TEAM_MG" then -- EDITED HERE TOO local p = FindPlayer(args) if p and p:Alive() and p.DarkRPVars.wanted then p:SetDarkRPVar("wanted", false) for a, b in pairs(player.GetAll()) do b:PrintMessage(HUD_PRINTCENTER, string.format(LANGUAGE.wanted_expired, p:Nick())) end timer.Destroy(p:Nick() .. " wantedtimer") else Notify(ply, 1, 4, string.format(LANGUAGE.could_not_find, "Player: "..tostring(args))) end end return "" end [/CODE] Any help at all is appreciated.
Search for where the _:IsCP() function is declared. I actually moved mine into Shared.lua before Falco started using it properly. But for example [code] function _R.Player:IsCP() local Team = self:Team() if Team == TEAM_POLICE or Team == TEAM_CHIEF or Team == TEAM_MAYOR or Team == TEAM_SWAT or Team == TEAM_SWATRECON or Team == TEAM_SWATMEDIC or Team == TEAM_SWATCQB then return true end return false end [/code] Any jobs added to that function will (in theory if darkrp uses IsCP everywhere now) allow that rank the same powers as a cop. So they can use 911 chat/open doors/warrants etc etc. As for number 1: No idea off hand Number 2: This is possible and I did it for my RP2 server recently, the codes part of a bigger segment I added though. You need to essentially add to the job command to do: if team = TEAM_SSA then Loop all players if a player = mayor then break allow SSA job else deny SSA job Yea... my half sudo code for number 2, you should learn a small amount of LUA to run a DarkRP server well anyway.
Thanks a ton! I edited some files and will update this post later with the results so others can learn from exactly what i did if it works correctly. I have one additional question though: For number 2 that code blocks the job from being picked when there is no mayor, but what file do i need to edit so that when the mayor dies and gets demoted, the secret service get demoted as well. Also if anyone can help with the first question i would very much appreciate it!
[QUOTE=RCRad;34516460]Thanks a ton! I edited some files and will update this post later with the results so others can learn from exactly what i did if it works correctly. I have one additional question though: For number 2 that code blocks the job from being picked when there is no mayor, but what file do i need to edit so that when the mayor dies and gets demoted, the secret service get demoted as well. Also if anyone can help with the first question i would very much appreciate it![/QUOTE] That would require editing the death hook in sv_gamemode_functions.lua or w/e it's called. While having everyone demoted is great for RP it would get insanely annoying and I doubt people will continue using SSA. This wouldn't be as serious RP but would fit in with DarkRP theme a bit more: Have them respawn when the mayor dies, or teleport to spawn etc. So they can go on protecting the next Mayor of the town. Make a rule that makes NLR apply to all SSA etc. Actually that's an awesome idea, I think I might code that into my evocity server when I get some time. Messes with the assasin revenge bit though, needs some thinking work me thinks.
Thanks, i've resolved most of my problems. Anyone able to help with: 1. We have a couple of custom playermodels on our server. After much work in getting these installed on fastDL and added to the proper RP jobs we have a problem: the models work but when you open up the f4 menu and go to the job tab the icon is still of a red ERROR (even though when you hover over or choose that job, it is the working model).
Sorry, you need to Log In to post a reply to this thread.