DarkRP.Player.NewData

From Official DarkRP Wiki
Jump to: navigation, search
This page refers to DarkRP 2.4.3. This information may be incorrect as of later versions.
Check here for a up-to-date list of functions.
Function
Function name Player:NewData()
Description:
Setup the player when he joins. This shouldn't be used elsewhere.
Returns: nil
Part of Library: Player
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.darkrp.com/index.php?title=DarkRP.Player.NewData]Player:NewData[/url][/b]

Examples

DescriptionThe function how it's defined in DarkRP.
Used onNewerServer.png
Code
function meta:NewData()
	if not IsValid(self) then return end
	self.DarkRPUnInitialized = true
	self:RestorePlayerData()
 
	timer.Simple(5, function()
		if not IsValid(self) then return end
 
		if GetConVarNumber("DarkRP_Lockdown") == 1 then
			RunConsoleCommand("DarkRP_Lockdown", 1) -- so new players who join know there's a lockdown
		end
	end)
 
	self:InitiateTax()
 
	self:UpdateJob(team.GetName(1))
 
	self:GetTable().Ownedz = { }
	self:GetTable().OwnedNumz = 0
 
	self:GetTable().LastLetterMade = CurTime() - 61
	self:GetTable().LastVoteCop = CurTime() - 61
 
	self:SetTeam(1)
 
	-- Whether or not a player is being prevented from joining
	-- a specific team for a certain length of time
	for i = 1, #RPExtraTeams do
		if GAMEMODE.Config.restrictallteams then
			self.bannedfrom[i] = 1
		else
			self.bannedfrom[i] = 0
		end
	end
end
OutputN/A


Additional Notes

  • Don't use this function anywhere except in the "PlayerInitialSpawn" hook.