coding basewars gamemode need some help with a few things
4 replies, posted
Ok first is that when I open the buy menu I get this error.
[CODE]
[ERROR] gamemodes/rgbasewars/gamemode/cl_buymenu.lua:51: attempt to call field 'GetModel' (a nil value)
1. DoPopulate - gamemodes/rgbasewars/gamemode/cl_buymenu.lua:51
2. DoClick - gamemodes/rgbasewars/gamemode/cl_buymenu.lua:68
3. InternalDoClick - lua/vgui/dtree_node.lua:81
4. fn - gamemodes/rgbasewars/gamemode/cl_buymenu.lua:78
5. Call - addons/ulib/lua/ulib/shared/hook.lua:183
6. CallPopulateHook - gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/content.lua:49
7. Function - gamemodes/rgbasewars/gamemode/cl_buymenu.lua:86
8. unknown - gamemodes/sandbox/gamemode/spawnmenu/creationmenu.lua:42
[/CODE]
[CODE]local Panel = vgui.Create( "DFrame" )
Panel:Hide()
hook.Add( "PopulateBasewars", "AddEntityContent", function( pnlContent, tree, node )
local Categorised = {}
-- Add this list into the tormoil
local SpawnableEntities = scripted_ents.GetSpawnable()
for k,v in pairs(SpawnableEntities) do --Remove all non basewars items
if v.Price == nil then
table.remove(SpawnableEntities, k)
end
end
if ( SpawnableEntities ) then
for k, v in pairs( SpawnableEntities ) do
v.Category = v.Category or "Other"
Categorised[ v.Category ] = Categorised[ v.Category ] or {}
table.insert( Categorised[ v.Category ], v )
end
end
--
-- Add a tree node for each category
--
for CategoryName, v in SortedPairs( Categorised ) do
-- Add a node to the tree
local node = tree:AddNode( CategoryName, "icon16/bricks.png" );
-- When we click on the node - populate it using this function
node.DoPopulate = function( self )
-- If we've already populated it - forget it.
if ( self.PropPanel ) then return end
-- Create the container panel
self.PropPanel = vgui.Create( "ContentContainer", pnlContent )
self.PropPanel:SetVisible( false )
self.PropPanel:SetTriggerSpawnlistChange( false )
for k, ent in SortedPairsByMemberValue( v, "PrintName" ) do
local Icon = spawnmenu.CreateContentIcon( ent.ScriptedEntityType or "entity", self.PropPanel,
{
nicename = ent.PrintName or ent.ClassName,
spawnname = ent.ClassName,
material = "materials/spawnicons/"..ent.GetModel(),
admin = ent.AdminOnly || ( !ent.Spawnable && ent.AdminSpawnable )
})
Icon.DoClick = function ()
LocalPlayer():ConCommand("buy_entity "..ent.ClassName)
end
local Tooltip = Format( "Name: %s\nPrice: %s", ent.PrintName, ent.Price )
Icon:SetTooltip( Tooltip )
end
end
-- If we click on the node populate it and switch to it.
node.DoClick = function( self )
self:DoPopulate()
pnlContent:SwitchPanel( self.PropPanel );
end
end
-- Select the first node
local FirstNode = tree:Root():GetChildNode( 0 )
if ( IsValid( FirstNode ) ) then
FirstNode:InternalDoClick()
end
end )
spawnmenu.AddCreationTab( "Basewars", function()
local ctrl = vgui.Create( "SpawnmenuContentPanel" )
ctrl:CallPopulateHook( "PopulateBasewars" );
return ctrl
end, "icon16/basket.png", 30 )
[/CODE]
second thing is that if I dont have a skin set in ply:SetModel("models/player/Group01/male_03.mdl") I get this weird black skin thing... but I want it where the player can choose their skin.
third thing is that when the server shuts down the money will not save.
Add me on skype: codyteen11
If you want players to choose there skin you actually need to make a derma panel that lets you choose your model.
And to make the money save you need to make a database where it can save.
You're coding a gamemode yet you dont know how to fix stuff?
Not bad... not bad
WOW... thx for the help guys you help me so much... NOT
[QUOTE=codyteen;41888804]WOW... thx for the help guys you help me so much... NOT[/QUOTE]
So you post code and error and pretty much say here fix this shit and expect everyone to do it?
K
Sorry, you need to Log In to post a reply to this thread.