• darkrp ooc problem
    2 replies, posted
What happens is ooc is displayed on both sides *--------------------------------------------------------- Variables ---------------------------------------------------------*/ local timeLeft = 10 local timeLeft2 = 10 local stormOn = false local zombieOn = false local maxZombie = 10 RPArrestedPlayersPositions = {} /*--------------------------------------------------------- Zombie ---------------------------------------------------------*/ function ControlZombie() timeLeft2 = timeLeft2 - 1 if timeLeft2 < 1 then if zombieOn then timeLeft2 = math.random(300,500) zombieOn = false timer.Stop("start2") ZombieEnd() else timeLeft2 = math.random(150,300) zombieOn = true timer.Start("start2") DB.RetrieveZombies() ZombieStart() end end end function ZombieStart() for k, v in pairs(player.GetAll()) do if v:Alive() then v:PrintMessage(HUD_PRINTCENTER, LANGUAGE.zombie_approaching) v:PrintMessage(HUD_PRINTTALK, LANGUAGE.zombie_approaching) end end end function ZombieEnd() for k, v in pairs(player.GetAll()) do if v:Alive() then v:PrintMessage(HUD_PRINTCENTER, LANGUAGE.zombie_leaving) v:PrintMessage(HUD_PRINTTALK, LANGUAGE.zombie_leaving) end end end function PlayerDist(npcPos) local playDis local currPlayer for k, v in pairs(player.GetAll()) do local tempPlayDis = v:GetPos():Distance(npcPos:GetPos()) if playDis == nil then playDis = tempPlayDis currPlayer = v end if tempPlayDis < playDis then playDis = tempPlayDis currPlayer = v end end return currPlayer end function LoadTable(ply) ply:SetDarkRPVar("numPoints", table.getn(zombieSpawns)) for k, v in pairs(zombieSpawns) do local Sep = (string.Explode(" " ,v)) ply:SetDarkRPVar("zPoints" .. k, Vector(tonumber(Sep[1]),tonumber(Sep[2]),tonumber(Sep[3]))) end end function ReMoveZombie(ply, index) if ply:HasPriv(ADMIN) then if not index or zombieSpawns[tonumber(index)] == nil then Notify(ply, 1, 4, string.format(LANGUAGE.zombie_spawn_not_exist, tostring(index))) else DB.RetrieveZombies() Notify(ply, 1, 4, LANGUAGE.zombie_spawn_removed) table.remove(zombieSpawns,index) DB.StoreZombies() if ply.DarkRPVars.zombieToggle then LoadTable(ply) end end else Notify(ply, 1, 4, string.format(LANGUAGE.need_admin, "/removezombie")) end return "" end AddChatCommand("/removezombie", ReMoveZombie) function AddZombie(ply) if ply:HasPriv(ADMIN) then DB.RetrieveZombies() table.insert(zombieSpawns, tostring(ply:GetPos())) DB.StoreZombies() if ply.DarkRPVars.zombieToggle then LoadTable(ply) end Notify(ply, 1, 4, LANGUAGE.zombie_spawn_added) else Notify(ply, 1, 6, string.format(LANGUAGE.need_admin, "/addzombie")) end return "" end AddChatCommand("/addzombie", AddZombie) function ToggleZombie(ply) if ply:HasPriv(ADMIN) then if not ply.DarkRPVars.zombieToggle then DB.RetrieveZombies() ply:SetDarkRPVar("zombieToggle", true) LoadTable(ply) else ply:SetDarkRPVar("zombieToggle", false) end else Notify(ply, 1, 6, LANGUAGE.string.format(LANGUAGE.need_admin, "/showzombie")) end return "" end AddChatCommand("/showzombie", ToggleZombie) function SpawnZombie() timer.Start("move") if GetAliveZombie() < maxZombie then if table.getn(zombieSpawns) > 0 then local zombieType = math.random(1, 4) if zombieType == 1 then local zombie1 = ents.Create("npc_zombie") zombie1:SetPos(DB.RetrieveRandomZombieSpawnPos()) zombie1.nodupe = true zombie1:Spawn() zombie1:Activate() elseif zombieType == 2 then local zombie2 = ents.Create("npc_fastzombie") zombie2:SetPos(DB.RetrieveRandomZombieSpawnPos()) zombie2.nodupe = true zombie2:Spawn() zombie2:Activate() elseif zombieType == 3 then local zombie3 = ents.Create("npc_antlion") zombie3:SetPos(DB.RetrieveRandomZombieSpawnPos()) zombie3.nodupe = true zombie3:Spawn() zombie3:Activate() elseif zombieType == 4 then local zombie4 = ents.Create("npc_headcrab_fast") zombie4:SetPos(DB.RetrieveRandomZombieSpawnPos()) zombie4.nodupe = true zombie4:Spawn() zombie4:Activate() end end end end function GetAliveZombie() local zombieCount = 0 for k, v in pairs(ents.FindByClass("npc_zombie")) do zombieCount = zombieCount + 1 end for k, v in pairs(ents.FindByClass("npc_fastzombie")) do zombieCount = zombieCount + 1 end for k, v in pairs(ents.FindByClass("npc_antlion")) do zombieCount = zombieCount + 1 end for k, v in pairs(ents.FindByClass("npc_headcrab_fast")) do zombieCount = zombieCount + 1 end return zombieCount end function ZombieMax(ply, args) if ply:HasPriv(ADMIN) then if not tonumber(args) then Notify(ply, 1, 4, string.format(LANGUAGE.invalid_x, "argument", "")) return "" end maxZombie = tonumber(args) Notify(ply, 1, 4, string.format(LANGUAGE.zombie_maxset, args)) end return "" end AddChatCommand("/zombiemax", ZombieMax) function StartZombie(ply) if ply:HasPriv(ADMIN) then timer.Start("zombieControl") Notify(ply, 1, 4, LANGUAGE.zombie_enabled) end return "" end AddChatCommand("/enablezombie", StartZombie) function StopZombie(ply) if ply:HasPriv(ADMIN) then timer.Stop("zombieControl") zombieOn = false timer.Stop("start2") ZombieEnd() Notify(ply, 1, 4, LANGUAGE.zombie_disabled) return "" end end AddChatCommand("/disablezombie", StopZombie) timer.Create("start2", 1, 0, SpawnZombie) timer.Create("zombieControl", 1, 0, ControlZombie) timer.Stop("start2") timer.Stop("zombieControl") /*--------------------------------------------------------- Meteor storm ---------------------------------------------------------*/ function StormStart() for k, v in pairs(player.GetAll()) do if v:Alive() then v:PrintMessage(HUD_PRINTCENTER, LANGUAGE.meteor_approaching) v:PrintMessage(HUD_PRINTTALK, LANGUAGE.meteor_approaching) end end end function StormEnd() for k, v in pairs(player.GetAll()) do if v:Alive() then v:PrintMessage(HUD_PRINTCENTER, LANGUAGE.meteor_passing) v:PrintMessage(HUD_PRINTTALK, LANGUAGE.meteor_passing) end end end function ControlStorm() timeLeft = timeLeft - 1 if timeLeft < 1 then if stormOn then timeLeft = math.random(300,500) stormOn = false timer.Stop("start") StormEnd() else timeLeft = math.random(60,90) stormOn = true timer.Start("start") StormStart() end end end function StartShower() timer.Adjust("start", math.random(.1,1), 0, StartShower) for k, v in pairs(player.GetAll()) do if math.random(0, 2) == 0 and v:Alive() then AttackEnt(v) end end end function AttackEnt(ent) meteor = ents.Create("meteor") meteor.nodupe = true meteor:Spawn() meteor:SetTarget(ent) end function StartStorm(ply) if ply:HasPriv(ADMIN) then timer.Start("stormControl") Notify(ply, 1, 4, LANGUAGE.meteor_enabled) end return "" end AddChatCommand("/enablestorm", StartStorm) function StopStorm(ply) if ply:HasPriv(ADMIN) then timer.Stop("stormControl") stormOn = false timer.Stop("start") StormEnd() Notify(ply, 1, 4, LANGUAGE.meteor_disabled) return "" end end AddChatCommand("/disablestorm", StopStorm) timer.Create("start", 1, 0, StartShower) timer.Create("stormControl", 1, 0, ControlStorm) timer.Stop("start") timer.Stop("stormControl") /*--------------------------------------------------------- Earthquake ---------------------------------------------------------*/ local lastmagnitudes = {} -- The magnitudes of the last tremors local next_update_time local tremor = ents.Create("env_physexplosion") tremor:SetPos(Vector(0,0,0)) tremor:SetKeyValue("radius",9999999999) tremor:SetKeyValue("spawnflags", 7) tremor.nodupe = true tremor:Spawn() function TremorReport(mag) local mag = table.remove(lastmagnitudes, 1) if mag then if mag < 6.5 then NotifyAll(1, 3, string.format(LANGUAGE.
anybody have any clue because once i take out code for making a reason for warranting it goes back to normal
Might want to put that code in [code][ /code] since that's a huge post (without the space)
Sorry, you need to Log In to post a reply to this thread.