• Warrant/Wanted section messed up
    1 replies, posted
Hey everyone. Don't worry, I won't ask for anything hard here. My request simply is that can someone paste in PHP tags the whole warrant/wanted section in the DarkRP SVN version in the main.lua? I accidentally messed something up and I need it refreshed. I know where I went wrong but downloading the whole SVN again is just to painful... :P Thanks.
[php]/*--------------------------------------------------------- Warrants/wanted ---------------------------------------------------------*/ local function UnWarrant(ply, target) if not target.warranted then return end target.warranted = false Notify(ply, 1, 4, string.format(LANGUAGE.warrant_expired, target:Nick())) end local function SetWarrant(ply, target, reason) target.warranted = true timer.Simple(GetConVarNumber("searchtime"), UnWarrant, ply, target) for a, b in pairs(player.GetAll()) do b:PrintMessage(HUD_PRINTCENTER, string.format(LANGUAGE.warrant_approved, target:Nick()).."\nReason: "..tostring(reason)) end Notify(ply, 1, 4, LANGUAGE.warrant_approved2) end local function FinishWarrant(choice, mayor, initiator, target, reason) if choice == 1 then SetWarrant(initiator, target, reason) else Notify(initiator, 1, 4, string.format(LANGUAGE.warrant_denied, mayor:Nick())) end return "" end local function TimerUnwanted(ply, args) 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())) timer.Destroy(p:Nick() .. " wantedtimer") end else return "" end end local function SearchWarrant(ply, args) local t = ply:Team() if not (t == TEAM_POLICE or t == TEAM_MAYOR or t == TEAM_CHIEF) then Notify(ply, 1, 4, string.format(LANGUAGE.must_be_x, "cop/mayor", "/warrant")) else local tableargs = string.Explode(" ", args) local reason = "" if #tableargs == 1 then Notify(ply, 1, 4, LANGUAGE.vote_specify_reason) 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, "/warrant", "<23 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 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, 1, 4, string.format(LANGUAGE.warrant_request2, m:Nick())) else -- there is no mayor, 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) local t = ply:Team() if t ~= TEAM_POLICE and t ~= TEAM_MAYOR and t ~= TEAM_CHIEF then Notify(ply, 1, 6, string.format(LANGUAGE.must_be_x, "cop/mayor", "/wanted")) else local tableargs = string.Explode(" ", args) local reason = "" if #tableargs == 1 then Notify(ply, 1, 4, LANGUAGE.vote_specify_reason) 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() 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)) timer.Create(p:Nick() .. " wantedtimer", GetConVarNumber("wantedtime"), 1, TimerUnwanted, ply, args) end else Notify(ply, 1, 4, string.format(LANGUAGE.could_not_find, "player: "..tostring(args))) end end return "" end AddChatCommand("/wanted", PlayerWanted) local function PlayerUnWanted(ply, args) local t = ply:Team() if not (t == TEAM_POLICE or t == TEAM_MAYOR or t == TEAM_CHIEF) then Notify(ply, 1, 6, string.format(LANGUAGE.must_be_x, "cop/mayor", "/unwanted")) else 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())) timer.Destroy(p:Nick() .. " wantedtimer") end else Notify(ply, 1, 4, string.format(LANGUAGE.could_not_find, "Player: "..tostring(args))) end end return "" end AddChatCommand("/unwanted", PlayerUnWanted)[/php] :keke:
Sorry, you need to Log In to post a reply to this thread.