Forums are in read-only mode. Data has been backed up but be sure to save anything you want.

Zombie Survival: player.SpawnedTime not always defined



  • Hello,

    I am a fan of the Zombie Survival gamemode and am currently looking at writing some add ons for the gamemode.

    I’ve noticated that ply.SpawnedTime is not always defined in the function PlayerInitialSpawn.

    I believe that this code will also fix sometimes not showing up in the scoreboard times:

    	elseif team.NumPlayers(TEAM_UNDEAD) < 1 and team.NumPlayers(TEAM_HUMAN) >= 3 then
    		local plays = player.GetAll()
    		local newpl = plays[math.random(1, #plays)]
    		newpl:SetTeam(TEAM_UNDEAD)
    		DeadSteamIDs[newpl:SteamID()] = true
    		newpl:PrintMessage(4, "You've been randomly selected\nto lead the Undead army.")
    		newpl:StripWeapons()
    		newpl:Spawn()
    		if pl ~= newpl then
    			pl:SetTeam(TEAM_HUMAN)
    			pl.SpawnedTime = CurTime()
    		end
    

    I’m sorry if this has been fixed or has been posted before.



  • Hello,

    I am a fan of the Zombie Survival gamemode and am currently looking at writing some add ons for the gamemode.

    I’ve noticated that ply.SpawnedTime is not always defined in the function PlayerInitialSpawn.

    I believe that this code will also fix sometimes not showing up in the scoreboard times:

    	elseif team.NumPlayers(TEAM_UNDEAD) < 1 and team.NumPlayers(TEAM_HUMAN) >= 3 then
    		local plays = player.GetAll()
    		local newpl = plays[math.random(1, #plays)]
    		newpl:SetTeam(TEAM_UNDEAD)
    		DeadSteamIDs[newpl:SteamID()] = true
    		newpl:PrintMessage(4, "You've been randomly selected\nto lead the Undead army.")
    		newpl:StripWeapons()
    		newpl:Spawn()
    		if pl ~= newpl then
    			pl:SetTeam(TEAM_HUMAN)
    			pl.SpawnedTime = CurTime()
    		end
    

    I’m sorry if this has been fixed or has been posted before.



  • Well there’s a reason for that.



  • I’m not seeing the reason why the SpawnedTime is not defined in that particular instance.

    The player spawns as a human, but SpawnedTime is not set.

    Are you aware of the fact that sometimes players don’t show in the scoreboard?


Log in to reply
 

1
Online

11.3k
Users

15.5k
Topics

300.2k
Posts