Player:GetInfo returning string with newline/Player:Give not working?
0 replies, posted
The following code doesn't work:
[code]function Ply:SpawnForRound()
self:StripWeapons()
self:SetTeam( autobalance.TeamWithLowestPlayers() )
self:Spawn()
self:SetModel( self:TeamToModel() )
self:Give( "weapon_battle_p226" )
local weapon = self:GetInfo( "battle_primary_weapon" )
self:Give( weapon )
local col = team.GetColor( self:Team() )
self:SetPlayerColor( Vector( col.r/255.0, col.g/255.0, col.b/255.0 ) )
end[/code]
The console says this (your typical NULL Ent messages)
[code]Attempted to create unknown entity type !
NULL Ent in GiveNamedItem!
[/code]
This is where I'm declaring "battle_primary_weapon" (clientside, of course)
[code]CreateClientConVar( "battle_primary_weapon", "weapon_battle_famasg4", true, true )
cvars.AddChangeCallback( "battle_primary_weapon", function( convar, oldval, newval )
if not table.HasValue( GAMEMODE.AllWeapons, newval ) then
RunConsoleCommand( convar, oldval )
end
end )[/code]
I assumed that a newline was being created, and this is further supported by a newline being shown in the console when I print the value. What should I do to fix this?
Sorry, you need to Log In to post a reply to this thread.