AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") --AddCSLuaFile("cl_vgui.lua") include("shared.lua") include("cl_init.lua") --include("cl_vgui.lua") local meta = FindMetaTable("Player") --DeriveGamemode( "sandbox" ); //HOOKS function meta:Data() --FLOATS self:SetNWFloat("moneyint",0) self:SetNWFloat("classint",0) self:SetNWFloat("timesurvint",0) self:SetNWFloat("infectedint",0) self:SetNWFloat("infmortalint",0) self:SetNWFloat("payint",0) --STRINGS self:SetNWString("bitestr","Normal") self:SetNWString("classstr","Nil") self:SetNWString("infectedstr","Positive") end SetGlobalInt("pmoneyint", 0) function GM:PlayerInitialSpawn(pl) pl:Data() pl:DayTimer() pl:SetTeam(1) RunOrg(pl) end function testz(ply) ply:Give("weapon_glock") end function RunOrg(pl) local classrand = math.random(1, 4) pl:SetNWFloat("classint", classrand) if pl:GetNWFloat("classint") == 1 then pl:SetNWString("classstr", "Builder") pl:SetNWFloat("payint", 20) pl:PrintMessage(3, "You are randomly picked to be in the Faction: Builder.\n") pl:ConCommand("say I am in the Faction: Builder") elseif pl:GetNWFloat("classint") == 2 then pl:SetNWString("classstr", "Scientist") pl:SetNWFloat("payint", 30) pl:PrintMessage(3, "You are randomly picked to be in the Faction: Scientist\n") pl:ConCommand("say I am in the Faction: Scientist") elseif pl:GetNWFloat("classint") == 3 then pl:SetNWString("classstr", "Military Ops") pl:SetNWFloat("payint", 40) pl:PrintMessage(3, "You are randomly picked to be in the Faction: Military Ops\n") pl:ConCommand("say I am in the Faction: Military Ops") elseif pl:GetNWFloat("classint") == 4 then pl:SetNWString("classstr", "Military Rifleman") pl:SetNWFloat("payint", 40) pl:PrintMessage(3, "You are randomly picked to be in the Faction: Military Rifleman\n") pl:ConCommand("say I am in the Faction: Military Rifleman") end end function GM:PlayerSpawn(ply) if ply:Team() == 1 then if ply:GetNWFloat("classint") == 1 then ply:Give("weapon_glock") ply:Give("weapon_physgun") ply:GiveAmmo(80, "Pistol") ply:SetHealth(150) elseif ply:GetNWFloat("classint") == 2 then ply:Give("weapon_357") ply:Give("weapon_medi") ply:GiveAmmo(12, "357") ply:SetHealth(150) elseif ply:GetNWFloat("classint") == 3 then ply:Give("weapon_shotgun") ply:Give("weapon_deagle") ply:GiveAmmo(40, "buckshot") ply:GiveAmmo(20, "Pistol") ply:SetHealth(120) elseif ply:GetNWFloat("classint") == 4 then ply:Give("weapon_deagle") ply:Give("weapon_m4") ply:GiveAmmo(20, "Pistol") ply:GiveAmmo(120, "smg1") --ply:SetModel("models/plyayer/combine_solider.mdl") ply:SetHealth(120) end elseif pl:Team() == 2 then pl:SetHealth(500) end end function GM:PlayerSpawnProp(ply) if ply:GetNWFloat("classnum") == 1 then if ply:GetNWFloat("moneyint") > 4 then ply:SetNWFloat("moneyint",ply:GetNWFloat("moneyint")-5) ply:PrintMessage(3, "You made a prop from your own money.\n") elseif ply:GetNWFloat("moneyint") < 4 then SetGlobalInt("pmoneyint",GetGlobalInt("pmoneyint")-5) ply:PrintMessage(3, "You took from the Populations Fundings to build.\n") end end end function GM:PlayerDeath(victim, weapon, killer) if victim:Team() == 1 then victim:SetTeam(2) victim:PrintMessage(3, "You have died and are now infected.\n") local zombie = ents.Create("npc_zombie") zombie:SetPos(victim:GetPos()) zombie:Spawn() end end function GM:OnNPCKilled(victim, killer) local moneyrand = math.random(0, 10) local fundingrand = moneyrand / 2 killer:SetNWFloat("moneyint",killer:GetNWFloat("moneyint")+moneyrand) --killer:PrintMessage(3, "You loot the Infected corpse and find "..moneyrand.."$.") if moneyrand != 1 or moneyrand != 3 or moneyrand != 5 or moneyrand != 7 or moneyrand != 9 then killer:SetNWFloat("moneyint",killer:GetNWFloat("moneyint")-fundingrand) SetGlobalInt("pmoneyint",GetGlobalInt("pmoneyint")+fundingrand) killer:PrintMessage(3, " You loot the Infected corpse and find "..moneyrand.."$. And you have put "..fundingrand.."$ into your Population's Funds\n") end end function GM:PlayerHurt(victim) if victim:Health() < 75 then local infectedtimer = victim:UniqueID().."timernamestr" timer.Create(infectedtimer, 30, 0, victim:LoseHP(), victim) victim:PrintMessage(3, "You have been bitten. You have 12 hours to find a scientist!\n") victim:SetNWString("bitestr", "Infected") end end //REGULAR CODE function meta:AddDays() self:SetNWFloat("timesurvint",self:GetNWFloat("timesurvint")+1) self:SetNWFloat("moneyint",self:GetNWFloat("moneyint")+self:GetNWFloat("payint")) self:PrintMessage(3, "You got paid "..self:GetNWFloat("payint").." for surviving another day!\n") end function meta:DayTimer() local timerq = self:UniqueID().."daytimer" timer.Create(timerq, 300, 0, self.AddDays , self ) end function meta:LoseHP(infectedtimer) self:SetHealth(self:Health() - 1) //LOSE 2 HP EVERY MINUTE! if self:Health() > 74 then self:PrintMessage(3, "You are healed and set to go.\n") timer.Destory(infectedtimer) self:SetNWString("bitestr","Normal") end end function testz(ply) ply:Give("weapon_glock") end