The umsg late

I set a menu for F1. In it there are the inventory and the skills tab. I have to send the table of inventory and the skills from the server to the client by a datastream and a usermessage.

First time when I open it, it is empty because of this line:

[LUA]
if (inventory != nil) then
[/LUA]

but on the second open it works well, but for example if I earn new items to the inventory I can’t see them next time just after that. It is something like a late

Codes:

http://pastebin.com/710xd0Wf - Menu
http://pastebin.com/9y9isJXD - Show Help Hook

Thanks for help :slight_smile:

Actually, not the user message, but datastream can take an extremely long time to arrive. That’s your problem here. So, I suggest using user messages for the inventory too. If you think there’s really too much data for usermessages, consider sending the data when the player spawns and not when they open the menu.

Another thing I noticed is that you use this:
[lua]umsg.Start( ply:UniqueID() … “Skills” )[/lua]
Do you have any particular reason for doing that? User messages can be filtered to only be sent to a single player by using the second argument:
[lua]umsg.Start( “Skills”, ply )[/lua]

it didn’t work for me

[editline]5th November 2010[/editline]

Video:

And what exactly did you do?

This:
umsg.Start( “Skills”, ply )

didn’t work for me

Maybe because your usermessage hook is still on ply:UniqueID() … “Skills” ?

Watch the video.

I didn’t say that was supposed to fix it. I told you to send the datastream and usermessage when the player spawns for the first time.

Yeah, I know but the umsg late too

Then send those at the same time as the datastream.

I send those in the same

Show me where and how.

[LUA]
function DA_ShowHelp(ply)

umsg.Start(ply:UniqueID()…“Skills”)

umsg.Short(ply.Skills.totallevel)
umsg.Short(ply.Skills.mainlevel)

umsg.Short(ply.Skills.strength)
umsg.Short(ply.Skills.hitpoints)
umsg.Short(ply.Skills.defense)
umsg.Short(ply.Skills.mining)
umsg.Short(ply.Skills.woodcutting)
umsg.Short(ply.Skills.smithing)
umsg.Short(ply.Skills.firemaking)
umsg.Short(ply.Skills.cooking)
umsg.Short(ply.Skills.fishing)
umsg.Short(ply.Skills.tailoring)
umsg.Short(ply.Skills.prayer)
umsg.Short(ply.Skills.farming)

umsg.Short(ply.Skills.strengthxp)
umsg.Short(ply.Skills.hitpointsxp)
umsg.Short(ply.Skills.defensexp)
umsg.Short(ply.Skills.miningxp)
umsg.Short(ply.Skills.woodcuttingxp)
umsg.Short(ply.Skills.smithingxp)
umsg.Short(ply.Skills.firemakingxp)
umsg.Short(ply.Skills.cookingxp)
umsg.Short(ply.Skills.fishingxp)
umsg.Short(ply.Skills.tailoringxp)
umsg.Short(ply.Skills.prayerxp)
umsg.Short(ply.Skills.farmingxp)

umsg.End()

Data.Inventory = ply.Inventory
Data.Bank = ply.Bank
Data.Resources = Resources.Info
Data.Products = Products.Shop1
Data.ShopName = Products.ShopName

datastream.StreamToClients(ply, “cucc” ,Data )

ply:ConCommand(“DA_Main”)

end
[/LUA]

[lua]local mainlevel = 1
local totallevel = 21

local hitpoints = 10
local strength = 1
local defense = 1
local mining = 1
local woodcutting = 1
local smithing = 1
local firemaking = 1
local cooking = 1
local fishing = 1
local tailoring = 1
local prayer = 1
local farming = 1

local hitpointsxp = 1
local strengthxp = 1
local defensexp = 1
local miningxp = 1
local woodcuttingxp = 1
local smithingxp = 1
local firemakingxp = 1
local cookingxp = 1
local fishingxp = 1
local tailoringxp = 1
local prayerxp = 1
local farmingxp = 1

function main_menu()

Mainmenu = vgui.Create(“DFrame”)
Mainmenu:SetPos(ScrW() / 4,ScrH() / 4)
Mainmenu:SetSize(ScrW() / 2, ScrH() / 2+50)
Mainmenu:SetTitle(“Main Menu”)
Mainmenu:SetDraggable(true)
Mainmenu:ShowCloseButton(true)
Mainmenu:SetVisible(true)
Mainmenu:MakePopup()

MNick = vgui.Create(“DLabel”,Mainmenu)
MNick:SetText("Name : "…LocalPlayer():Nick() )
MNick:SetPos(20,ScrH()/2)
MNick:SizeToContents()

MTotalLvl = vgui.Create(“DLabel”,Mainmenu)
MTotalLvl:SetText("Total lvl : “…totallevel…” Main lvl : "…mainlevel )
MTotalLvl:SetPos(20,ScrH()/2+20)
MTotalLvl:SizeToContents()

if (inventory != nil) then

MGold = vgui.Create(“DLabel”,Mainmenu)
MGold:SetText("Gold : "…inventory.gold )
MGold:SetPos(250,ScrH()/2)
MGold:SizeToContents()

MAmount = vgui.Create(“DLabel”,Mainmenu)
MAmount:SetText("Inventory “…inventory.amount…” / "…inventory.capacity)
MAmount:SetPos(250,ScrH()/2+20)
MAmount:SizeToContents()

end

Menu1 = vgui.Create(“DPanel”)
Menu1:SetSize(ScrW() / 2-15,ScrH() / 2-50)

Menu2 = vgui.Create(“DPanel”)
Menu2:SetSize(ScrW() / 2-15,ScrH() / 2-50)

local Menu3 = vgui.Create( “DPanelList” )
Menu3:EnableVerticalScrollbar( true )
Menu3:EnableHorizontal( false )
Menu3:SetSpacing( 5 )
Menu3:SetPadding( 5 )
Menu3:SetPos(5,5)
Menu3:SetSize(200,ScrH() / 2-50)

function Inventory_Setup ( cucc, id, inv, data )

resources = {}
inventory = {}

resources = data.Resources
inventory = data.Inventory

end

if (inventory != nil) then

for k,v in pairs(inventory) do

	Item = k
	Amount = v

	if (Item == "amount") then
	
	elseif (Item == "capacity") then
	
	elseif (Item == "gold") then
	
	elseif (Amount > 0) then

	local Panel1 = vgui.Create('DPanel')
	Panel1:SetSize(200,50)
	
	local Name = vgui.Create("DLabel", Panel1)
	Name:SetPos(10,10)
	Name:SetText("Item : "..resources[Item].name )
	Name:SetFont("DefaultFixedOutline")
	Name:SizeToContents()
	
	local Value = vgui.Create("DLabel", Panel1)
	Value:SetPos(10,30)
	Value:SetText("Value : "..Amount)
	Value:SetFont("DefaultFixedOutline")
	Value:SizeToContents()
	
	local Drop = vgui.Create("DButton", Panel1)
	Drop:SetPos(150,10)
	Drop:SetSize(50,30)
	Drop:SetText("Drop")
	
	if table.HasValue( Resources.fishing , Item) then
	
	local Eat = vgui.Create("DButton", Panel1)
	Eat:SetPos(220,10)
	Eat:SetSize(50,30)
	Eat:SetText("Eat")
	Eat.DoClick = function()
	
		Food = k
		
		RunConsoleCommand("DA_InvEat",Food)

		end
	
	end
	
	Menu3:AddItem(Panel1)
	
	end
	
end

end

Clan = vgui.Create(“DButton”,Menu1)
Clan:SetPos(20,20)
Clan:SetSize(100,30)
Clan:SetText(“Clans”)
Clan.DoClick = function()
RunConsoleCommand(“DA_Clan”)
end

CreateClan = vgui.Create(“DButton”,Menu1)
CreateClan:SetPos(20,70)
CreateClan:SetSize(100,30)
CreateClan:SetText(“Create Clan”)
CreateClan.DoClick = function()
RunConsoleCommand(“DA_CreateClan”)
end

JoinClan = vgui.Create(“DButton”,Menu1)
JoinClan:SetPos(120,70)
JoinClan:SetSize(100,30)
JoinClan:SetText(“Join Clan”)
JoinClan.DoClick = function()
RunConsoleCommand(“DA_JoinClan”)
end

Save = vgui.Create(“DButton”,Menu1)
Save:SetPos(20,120)
Save:SetSize(100,30)
Save:SetText(“Save Character”)
Save.DoClick = function()

RunConsoleCommand("DA_Save",Char)

end

function DA_Skills(data_cb)

totallevel = data_cb:ReadShort()
mainlevel = data_cb:ReadShort()

strength = data_cb:ReadShort()
hitpoints = data_cb:ReadShort()
defense = data_cb:ReadShort()
mining = data_cb:ReadShort()
woodcutting = data_cb:ReadShort()
smithing = data_cb:ReadShort()
firemaking = data_cb:ReadShort()
cooking = data_cb:ReadShort()
fishing = data_cb:ReadShort()
tailoring = data_cb:ReadShort()
prayer = data_cb:ReadShort()
farming = data_cb:ReadShort()

strengthxp = data_cb:ReadShort()
hitpointsxp = data_cb:ReadShort()
defensexp = data_cb:ReadShort()
miningxp = data_cb:ReadShort()
woodcuttingxp = data_cb:ReadShort()
smithingxp = data_cb:ReadShort()
firemakingxp = data_cb:ReadShort()
cookingxp = data_cb:ReadShort()
fishingxp = data_cb:ReadShort()
tailoringxp = data_cb:ReadShort()
prayerxp = data_cb:ReadShort()
farmingxp = data_cb:ReadShort()

end

Nick = vgui.Create(“DLabel”,Menu2)
Nick:SetText("Name : "…LocalPlayer():Nick() )
Nick:SetPos(20,20)
Nick:SetTextColor( Color(100,100,100,255) )
Nick:SizeToContents()

SteamID = vgui.Create(“DLabel”,Menu2)
SteamID:SetText("SteamID : "…LocalPlayer():SteamID() )
SteamID:SetPos(20,40)
SteamID:SetTextColor( Color(100,100,100,255) )
SteamID:SizeToContents()

Clan = vgui.Create(“DLabel”,Menu2)
Clan:SetText("Clan : "…team.GetName(LocalPlayer():Team() ) )
Clan:SetPos(20,60)
Clan:SetTextColor( Color(100,100,100,255) )
Clan:SizeToContents()

Hitpoints = vgui.Create(“DLabel”,Menu2)
Hitpoints:SetText("Hitpoints : “…hitpoints…” XP : “…hitpointsxp…” / "…LevelXP[hitpoints] )
Hitpoints:SetPos(20,100)
Hitpoints:SetTextColor( Color(100,100,100,255) )
Hitpoints:SizeToContents()

Strength = vgui.Create(“DLabel”,Menu2)
Strength:SetText("Strength : “…strength…” XP : “…strengthxp…” / "…LevelXP[strength] )
Strength:SetPos(20,120)
Strength:SetTextColor( Color(100,100,100,255) )
Strength:SizeToContents()

Defense = vgui.Create(“DLabel”,Menu2)
Defense:SetText("Defense : “…defense…” XP : “…defensexp…” / "…LevelXP[defense] )
Defense:SetPos(20,140)
Defense:SetTextColor( Color(100,100,100,255) )
Defense:SizeToContents()

MainLevel = vgui.Create(“DLabel”,Menu2)
MainLevel:SetText("MainLevel : "…mainlevel)
MainLevel:SetPos(20,160)
MainLevel:SetTextColor( Color(100,100,100,255) )
MainLevel:SizeToContents()

TotalLevel = vgui.Create(“DLabel”,Menu2)
TotalLevel:SetText("Total Level : "…totallevel)
TotalLevel:SetPos(20,180)
TotalLevel:SetTextColor( Color(100,100,100,255) )
TotalLevel:SizeToContents()

Mining = vgui.Create(“DLabel”,Menu2)
Mining:SetText("Mining : “…mining…” XP : “…miningxp…” / "…LevelXP[mining] )
Mining:SetPos(170,100)
Mining:SetTextColor( Color(100,100,100,255) )
Mining:SizeToContents()

Smithing = vgui.Create(“DLabel”,Menu2)
Smithing:SetText("Smithing : “…smithing…” XP : “…smithingxp…” / "…LevelXP[smithing] )
Smithing:SetPos(170,120)
Smithing:SetTextColor( Color(100,100,100,255) )
Smithing:SizeToContents()

Woodcutting = vgui.Create(“DLabel”,Menu2)
Woodcutting:SetText("Woodcutting : “…woodcutting…” XP : “…woodcuttingxp…” / "…LevelXP[woodcutting] )
Woodcutting:SetPos(170,140)
Woodcutting:SetTextColor( Color(100,100,100,255) )
Woodcutting:SizeToContents()

Firemaking = vgui.Create(“DLabel”,Menu2)
Firemaking:SetText("Firemaking : “…firemaking…” XP : “…firemakingxp…” / "…LevelXP[firemaking] )
Firemaking:SetPos(170,160)
Firemaking:SetTextColor( Color(100,100,100,255) )
Firemaking:SizeToContents()

Cooking = vgui.Create(“DLabel”,Menu2)
Cooking:SetText("Cooking : “…cooking…” XP : “…cookingxp…” / "…LevelXP[cooking] )
Cooking:SetPos(170,180)
Cooking:SetTextColor( Color(100,100,100,255) )
Cooking:SizeToContents()

Fishing = vgui.Create(“DLabel”,Menu2)
Fishing:SetText("Fishing : “…fishing…” XP : “…fishingxp…” / "…LevelXP[fishing] )
Fishing:SetPos(340,100)
Fishing:SetTextColor( Color(100,100,100,255) )
Fishing:SizeToContents()

Tailoring = vgui.Create(“DLabel”,Menu2)
Tailoring:SetText("Tailoring : “…tailoring…” XP : “…tailoringxp…” / "…LevelXP[tailoring] )
Tailoring:SetPos(340,120)
Tailoring:SetTextColor( Color(100,100,100,255) )
Tailoring:SizeToContents()

Prayer = vgui.Create(“DLabel”,Menu2)
Prayer:SetText("Prayer : “…prayer…” XP : “…prayerxp…” / "…LevelXP[prayer] )
Prayer:SetPos(340,140)
Prayer:SetTextColor( Color(100,100,100,255) )
Prayer:SizeToContents()

Farming = vgui.Create(“DLabel”,Menu2)
Farming:SetText("Farming : “…farming…” XP : “…farmingxp…” / "…LevelXP[farming] )
Farming:SetPos(340,160)
Farming:SetTextColor( Color(100,100,100,255) )
Farming:SizeToContents()

MenuSheet = vgui.Create( “DPropertySheet” )
MenuSheet:SetParent( Mainmenu )
MenuSheet:SetPos(5,40)
MenuSheet:SetSize(ScrW() / 2-15,ScrH() / 2-50)

MenuSheet:AddSheet( “Main Menu”,Menu1,“gui/silkicons/user”,false,false,“Main Menu”)
MenuSheet:AddSheet( “Info - Stats”,Menu2,“gui/silkicons/user”,false,false,“Info - Stats”)
MenuSheet:AddSheet( “Inventory”,Menu3,“gui/silkicons/user”,false,false,“Inventory”)

end

usermessage.Hook(LocalPlayer():UniqueID()…“Skills”,DA_Skills)
datastream.Hook(“cucc”, Inventory_Setup)

concommand.Add(“DA_Main”,main_menu)[/lua]

Try that.

Are you not reading anything I’m saying? I told you to do that when the player spawns for the first time,


not

when the player opens the menu.

It is okey, I have added to there too.

[editline]5th November 2010[/editline]

any new idea???

Did you try my method runamagic i post it should work for what you asked for.

Copy and replace with your old cl_init.lua or what ever.

okey

[editline]6th November 2010[/editline]

New error:
[lua\includes\modules\datastream.lua:406] attempt to call field ‘func’ (a nil value)

xD

[lua]local mainlevel = 1
local totallevel = 21

local hitpoints = 10
local strength = 1
local defense = 1
local mining = 1
local woodcutting = 1
local smithing = 1
local firemaking = 1
local cooking = 1
local fishing = 1
local tailoring = 1
local prayer = 1
local farming = 1

local hitpointsxp = 1
local strengthxp = 1
local defensexp = 1
local miningxp = 1
local woodcuttingxp = 1
local smithingxp = 1
local firemakingxp = 1
local cookingxp = 1
local fishingxp = 1
local tailoringxp = 1
local prayerxp = 1
local farmingxp = 1

function main_menu()

Mainmenu = vgui.Create(“DFrame”)
Mainmenu:SetPos(ScrW() / 4,ScrH() / 4)
Mainmenu:SetSize(ScrW() / 2, ScrH() / 2+50)
Mainmenu:SetTitle(“Main Menu”)
Mainmenu:SetDraggable(true)
Mainmenu:ShowCloseButton(true)
Mainmenu:SetVisible(true)
Mainmenu:MakePopup()

MNick = vgui.Create(“DLabel”,Mainmenu)
MNick:SetText("Name : "…LocalPlayer():Nick() )
MNick:SetPos(20,ScrH()/2)
MNick:SizeToContents()

MTotalLvl = vgui.Create(“DLabel”,Mainmenu)
MTotalLvl:SetText("Total lvl : “…totallevel…” Main lvl : "…mainlevel )
MTotalLvl:SetPos(20,ScrH()/2+20)
MTotalLvl:SizeToContents()

if (inventory != nil) then

MGold = vgui.Create(“DLabel”,Mainmenu)
MGold:SetText("Gold : "…inventory.gold )
MGold:SetPos(250,ScrH()/2)
MGold:SizeToContents()

MAmount = vgui.Create(“DLabel”,Mainmenu)
MAmount:SetText("Inventory “…inventory.amount…” / "…inventory.capacity)
MAmount:SetPos(250,ScrH()/2+20)
MAmount:SizeToContents()

end

Menu1 = vgui.Create(“DPanel”)
Menu1:SetSize(ScrW() / 2-15,ScrH() / 2-50)

Menu2 = vgui.Create(“DPanel”)
Menu2:SetSize(ScrW() / 2-15,ScrH() / 2-50)

local Menu3 = vgui.Create( “DPanelList” )
Menu3:EnableVerticalScrollbar( true )
Menu3:EnableHorizontal( false )
Menu3:SetSpacing( 5 )
Menu3:SetPadding( 5 )
Menu3:SetPos(5,5)
Menu3:SetSize(200,ScrH() / 2-50)

function Inventory_Setup ( cucc, id, inv, data )

resources = {}
inventory = {}

resources = data.Resources
inventory = data.Inventory

end

if (inventory != nil) then

for k,v in pairs(inventory) do
 
    Item = k
    Amount = v

    if (Item == "amount") then
     
    elseif (Item == "capacity") then
     
    elseif (Item == "gold") then
     
    elseif (Amount > 0) then
 
    local Panel1 = vgui.Create('DPanel')
    Panel1:SetSize(200,50)
     
    local Name = vgui.Create("DLabel", Panel1)
    Name:SetPos(10,10)
    Name:SetText("Item : "..resources[Item].name )
    Name:SetFont("DefaultFixedOutline")
    Name:SizeToContents()
     
    local Value = vgui.Create("DLabel", Panel1)
    Value:SetPos(10,30)
    Value:SetText("Value : "..Amount)
    Value:SetFont("DefaultFixedOutline")
    Value:SizeToContents()
     
    local Drop = vgui.Create("DButton", Panel1)
    Drop:SetPos(150,10)
    Drop:SetSize(50,30)
    Drop:SetText("Drop")
     
    if table.HasValue( Resources.fishing , Item) then
     
    local Eat = vgui.Create("DButton", Panel1)
    Eat:SetPos(220,10)
    Eat:SetSize(50,30)
    Eat:SetText("Eat")
    Eat.DoClick = function()
     
        Food = k
         
        RunConsoleCommand("DA_InvEat",Food)

        end
     
    end
     
    Menu3:AddItem(Panel1)
     
    end
     
end

end

Clan = vgui.Create(“DButton”,Menu1)
Clan:SetPos(20,20)
Clan:SetSize(100,30)
Clan:SetText(“Clans”)
Clan.DoClick = function()
RunConsoleCommand(“DA_Clan”)
end

CreateClan = vgui.Create(“DButton”,Menu1)
CreateClan:SetPos(20,70)
CreateClan:SetSize(100,30)
CreateClan:SetText(“Create Clan”)
CreateClan.DoClick = function()
RunConsoleCommand(“DA_CreateClan”)
end

JoinClan = vgui.Create(“DButton”,Menu1)
JoinClan:SetPos(120,70)
JoinClan:SetSize(100,30)
JoinClan:SetText(“Join Clan”)
JoinClan.DoClick = function()
RunConsoleCommand(“DA_JoinClan”)
end

Save = vgui.Create(“DButton”,Menu1)
Save:SetPos(20,120)
Save:SetSize(100,30)
Save:SetText(“Save Character”)
Save.DoClick = function()

RunConsoleCommand("DA_Save",Char)

end

function DA_Skills(data_cb)

totallevel = data_cb:ReadShort()
mainlevel = data_cb:ReadShort()

strength = data_cb:ReadShort()
hitpoints = data_cb:ReadShort()
defense = data_cb:ReadShort()
mining = data_cb:ReadShort()
woodcutting = data_cb:ReadShort()
smithing = data_cb:ReadShort()
firemaking = data_cb:ReadShort()
cooking = data_cb:ReadShort()
fishing = data_cb:ReadShort()
tailoring = data_cb:ReadShort()
prayer = data_cb:ReadShort()
farming = data_cb:ReadShort()

strengthxp = data_cb:ReadShort()
hitpointsxp = data_cb:ReadShort()
defensexp = data_cb:ReadShort()
miningxp = data_cb:ReadShort()
woodcuttingxp = data_cb:ReadShort()
smithingxp = data_cb:ReadShort()
firemakingxp = data_cb:ReadShort()
cookingxp = data_cb:ReadShort()
fishingxp = data_cb:ReadShort()
tailoringxp = data_cb:ReadShort()
prayerxp = data_cb:ReadShort()
farmingxp = data_cb:ReadShort()

end

Nick = vgui.Create(“DLabel”,Menu2)
Nick:SetText("Name : "…LocalPlayer():Nick() )
Nick:SetPos(20,20)
Nick:SetTextColor( Color(100,100,100,255) )
Nick:SizeToContents()

SteamID = vgui.Create(“DLabel”,Menu2)
SteamID:SetText("SteamID : "…LocalPlayer():SteamID() )
SteamID:SetPos(20,40)
SteamID:SetTextColor( Color(100,100,100,255) )
SteamID:SizeToContents()

Clan = vgui.Create(“DLabel”,Menu2)
Clan:SetText("Clan : "…team.GetName(LocalPlayer():Team() ) )
Clan:SetPos(20,60)
Clan:SetTextColor( Color(100,100,100,255) )
Clan:SizeToContents()

Hitpoints = vgui.Create(“DLabel”,Menu2)
Hitpoints:SetText("Hitpoints : “…hitpoints…” XP : “…hitpointsxp…” / "…LevelXP[hitpoints] )
Hitpoints:SetPos(20,100)
Hitpoints:SetTextColor( Color(100,100,100,255) )
Hitpoints:SizeToContents()

Strength = vgui.Create(“DLabel”,Menu2)
Strength:SetText("Strength : “…strength…” XP : “…strengthxp…” / "…LevelXP[strength] )
Strength:SetPos(20,120)
Strength:SetTextColor( Color(100,100,100,255) )
Strength:SizeToContents()

Defense = vgui.Create(“DLabel”,Menu2)
Defense:SetText("Defense : “…defense…” XP : “…defensexp…” / "…LevelXP[defense] )
Defense:SetPos(20,140)
Defense:SetTextColor( Color(100,100,100,255) )
Defense:SizeToContents()

MainLevel = vgui.Create(“DLabel”,Menu2)
MainLevel:SetText("MainLevel : "…mainlevel)
MainLevel:SetPos(20,160)
MainLevel:SetTextColor( Color(100,100,100,255) )
MainLevel:SizeToContents()

TotalLevel = vgui.Create(“DLabel”,Menu2)
TotalLevel:SetText("Total Level : "…totallevel)
TotalLevel:SetPos(20,180)
TotalLevel:SetTextColor( Color(100,100,100,255) )
TotalLevel:SizeToContents()

Mining = vgui.Create(“DLabel”,Menu2)
Mining:SetText("Mining : “…mining…” XP : “…miningxp…” / "…LevelXP[mining] )
Mining:SetPos(170,100)
Mining:SetTextColor( Color(100,100,100,255) )
Mining:SizeToContents()

Smithing = vgui.Create(“DLabel”,Menu2)
Smithing:SetText("Smithing : “…smithing…” XP : “…smithingxp…” / "…LevelXP[smithing] )
Smithing:SetPos(170,120)
Smithing:SetTextColor( Color(100,100,100,255) )
Smithing:SizeToContents()

Woodcutting = vgui.Create(“DLabel”,Menu2)
Woodcutting:SetText("Woodcutting : “…woodcutting…” XP : “…woodcuttingxp…” / "…LevelXP[woodcutting] )
Woodcutting:SetPos(170,140)
Woodcutting:SetTextColor( Color(100,100,100,255) )
Woodcutting:SizeToContents()

Firemaking = vgui.Create(“DLabel”,Menu2)
Firemaking:SetText("Firemaking : “…firemaking…” XP : “…firemakingxp…” / "…LevelXP[firemaking] )
Firemaking:SetPos(170,160)
Firemaking:SetTextColor( Color(100,100,100,255) )
Firemaking:SizeToContents()

Cooking = vgui.Create(“DLabel”,Menu2)
Cooking:SetText("Cooking : “…cooking…” XP : “…cookingxp…” / "…LevelXP[cooking] )
Cooking:SetPos(170,180)
Cooking:SetTextColor( Color(100,100,100,255) )
Cooking:SizeToContents()

Fishing = vgui.Create(“DLabel”,Menu2)
Fishing:SetText("Fishing : “…fishing…” XP : “…fishingxp…” / "…LevelXP[fishing] )
Fishing:SetPos(340,100)
Fishing:SetTextColor( Color(100,100,100,255) )
Fishing:SizeToContents()

Tailoring = vgui.Create(“DLabel”,Menu2)
Tailoring:SetText("Tailoring : “…tailoring…” XP : “…tailoringxp…” / "…LevelXP[tailoring] )
Tailoring:SetPos(340,120)
Tailoring:SetTextColor( Color(100,100,100,255) )
Tailoring:SizeToContents()

Prayer = vgui.Create(“DLabel”,Menu2)
Prayer:SetText("Prayer : “…prayer…” XP : “…prayerxp…” / "…LevelXP[prayer] )
Prayer:SetPos(340,140)
Prayer:SetTextColor( Color(100,100,100,255) )
Prayer:SizeToContents()

Farming = vgui.Create(“DLabel”,Menu2)
Farming:SetText("Farming : “…farming…” XP : “…farmingxp…” / "…LevelXP[farming] )
Farming:SetPos(340,160)
Farming:SetTextColor( Color(100,100,100,255) )
Farming:SizeToContents()

MenuSheet = vgui.Create( “DPropertySheet” )
MenuSheet:SetParent( Mainmenu )
MenuSheet:SetPos(5,40)
MenuSheet:SetSize(ScrW() / 2-15,ScrH() / 2-50)

MenuSheet:AddSheet( “Main Menu”,Menu1,“gui/silkicons/user”,false,false,“Main Menu”)
MenuSheet:AddSheet( “Info - Stats”,Menu2,“gui/silkicons/user”,false,false,“Info - Stats”)
MenuSheet:AddSheet( “Inventory”,Menu3,“gui/silkicons/user”,false,false,“Inventory”)

datastream.Hook(“cucc”, Inventory_Setup)

end

usermessage.Hook(LocalPlayer():UniqueID()…“Skills”,DA_Skills)

concommand.Add(“DA_Main”,main_menu)[/lua]

[editline]6th November 2010[/editline]

[lua]local mainlevel = 1
local totallevel = 21

local hitpoints = 10
local strength = 1
local defense = 1
local mining = 1
local woodcutting = 1
local smithing = 1
local firemaking = 1
local cooking = 1
local fishing = 1
local tailoring = 1
local prayer = 1
local farming = 1

local hitpointsxp = 1
local strengthxp = 1
local defensexp = 1
local miningxp = 1
local woodcuttingxp = 1
local smithingxp = 1
local firemakingxp = 1
local cookingxp = 1
local fishingxp = 1
local tailoringxp = 1
local prayerxp = 1
local farmingxp = 1

function main_menu()

Mainmenu = vgui.Create(“DFrame”)
Mainmenu:SetPos(ScrW() / 4,ScrH() / 4)
Mainmenu:SetSize(ScrW() / 2, ScrH() / 2+50)
Mainmenu:SetTitle(“Main Menu”)
Mainmenu:SetDraggable(true)
Mainmenu:ShowCloseButton(true)
Mainmenu:SetVisible(true)
Mainmenu:MakePopup()

MNick = vgui.Create(“DLabel”,Mainmenu)
MNick:SetText("Name : "…LocalPlayer():Nick() )
MNick:SetPos(20,ScrH()/2)
MNick:SizeToContents()

MTotalLvl = vgui.Create(“DLabel”,Mainmenu)
MTotalLvl:SetText("Total lvl : “…totallevel…” Main lvl : "…mainlevel )
MTotalLvl:SetPos(20,ScrH()/2+20)
MTotalLvl:SizeToContents()

if (inventory != nil) then

MGold = vgui.Create(“DLabel”,Mainmenu)
MGold:SetText("Gold : "…inventory.gold )
MGold:SetPos(250,ScrH()/2)
MGold:SizeToContents()

MAmount = vgui.Create(“DLabel”,Mainmenu)
MAmount:SetText("Inventory “…inventory.amount…” / "…inventory.capacity)
MAmount:SetPos(250,ScrH()/2+20)
MAmount:SizeToContents()

end

Menu1 = vgui.Create(“DPanel”)
Menu1:SetSize(ScrW() / 2-15,ScrH() / 2-50)

Menu2 = vgui.Create(“DPanel”)
Menu2:SetSize(ScrW() / 2-15,ScrH() / 2-50)

local Menu3 = vgui.Create( “DPanelList” )
Menu3:EnableVerticalScrollbar( true )
Menu3:EnableHorizontal( false )
Menu3:SetSpacing( 5 )
Menu3:SetPadding( 5 )
Menu3:SetPos(5,5)
Menu3:SetSize(200,ScrH() / 2-50)

function Inventory_Setup ( cucc, id, inv, data )

resources = {}
inventory = {}

resources = data.Resources
inventory = data.Inventory

end

if (inventory != nil) then

for k,v in pairs(inventory) do
 
    Item = k
    Amount = v

    if (Item == "amount") then
     
    elseif (Item == "capacity") then
     
    elseif (Item == "gold") then
     
    elseif (Amount > 0) then
 
    local Panel1 = vgui.Create('DPanel')
    Panel1:SetSize(200,50)
     
    local Name = vgui.Create("DLabel", Panel1)
    Name:SetPos(10,10)
    Name:SetText("Item : "..resources[Item].name )
    Name:SetFont("DefaultFixedOutline")
    Name:SizeToContents()
     
    local Value = vgui.Create("DLabel", Panel1)
    Value:SetPos(10,30)
    Value:SetText("Value : "..Amount)
    Value:SetFont("DefaultFixedOutline")
    Value:SizeToContents()
     
    local Drop = vgui.Create("DButton", Panel1)
    Drop:SetPos(150,10)
    Drop:SetSize(50,30)
    Drop:SetText("Drop")
     
    if table.HasValue( Resources.fishing , Item) then
     
    local Eat = vgui.Create("DButton", Panel1)
    Eat:SetPos(220,10)
    Eat:SetSize(50,30)
    Eat:SetText("Eat")
    Eat.DoClick = function()
     
        Food = k
         
        RunConsoleCommand("DA_InvEat",Food)

        end
     
    end
     
    Menu3:AddItem(Panel1)
     
    end
     
end

end

Clan = vgui.Create(“DButton”,Menu1)
Clan:SetPos(20,20)
Clan:SetSize(100,30)
Clan:SetText(“Clans”)
Clan.DoClick = function()
RunConsoleCommand(“DA_Clan”)
end

CreateClan = vgui.Create(“DButton”,Menu1)
CreateClan:SetPos(20,70)
CreateClan:SetSize(100,30)
CreateClan:SetText(“Create Clan”)
CreateClan.DoClick = function()
RunConsoleCommand(“DA_CreateClan”)
end

JoinClan = vgui.Create(“DButton”,Menu1)
JoinClan:SetPos(120,70)
JoinClan:SetSize(100,30)
JoinClan:SetText(“Join Clan”)
JoinClan.DoClick = function()
RunConsoleCommand(“DA_JoinClan”)
end

Save = vgui.Create(“DButton”,Menu1)
Save:SetPos(20,120)
Save:SetSize(100,30)
Save:SetText(“Save Character”)
Save.DoClick = function()

RunConsoleCommand("DA_Save",Char)

end

function DA_Skills(data_cb)

totallevel = data_cb:ReadShort()
mainlevel = data_cb:ReadShort()

strength = data_cb:ReadShort()
hitpoints = data_cb:ReadShort()
defense = data_cb:ReadShort()
mining = data_cb:ReadShort()
woodcutting = data_cb:ReadShort()
smithing = data_cb:ReadShort()
firemaking = data_cb:ReadShort()
cooking = data_cb:ReadShort()
fishing = data_cb:ReadShort()
tailoring = data_cb:ReadShort()
prayer = data_cb:ReadShort()
farming = data_cb:ReadShort()

strengthxp = data_cb:ReadShort()
hitpointsxp = data_cb:ReadShort()
defensexp = data_cb:ReadShort()
miningxp = data_cb:ReadShort()
woodcuttingxp = data_cb:ReadShort()
smithingxp = data_cb:ReadShort()
firemakingxp = data_cb:ReadShort()
cookingxp = data_cb:ReadShort()
fishingxp = data_cb:ReadShort()
tailoringxp = data_cb:ReadShort()
prayerxp = data_cb:ReadShort()
farmingxp = data_cb:ReadShort()

end

Nick = vgui.Create(“DLabel”,Menu2)
Nick:SetText("Name : "…LocalPlayer():Nick() )
Nick:SetPos(20,20)
Nick:SetTextColor( Color(100,100,100,255) )
Nick:SizeToContents()

SteamID = vgui.Create(“DLabel”,Menu2)
SteamID:SetText("SteamID : "…LocalPlayer():SteamID() )
SteamID:SetPos(20,40)
SteamID:SetTextColor( Color(100,100,100,255) )
SteamID:SizeToContents()

Clan = vgui.Create(“DLabel”,Menu2)
Clan:SetText("Clan : "…team.GetName(LocalPlayer():Team() ) )
Clan:SetPos(20,60)
Clan:SetTextColor( Color(100,100,100,255) )
Clan:SizeToContents()

Hitpoints = vgui.Create(“DLabel”,Menu2)
Hitpoints:SetText("Hitpoints : “…hitpoints…” XP : “…hitpointsxp…” / "…LevelXP[hitpoints] )
Hitpoints:SetPos(20,100)
Hitpoints:SetTextColor( Color(100,100,100,255) )
Hitpoints:SizeToContents()

Strength = vgui.Create(“DLabel”,Menu2)
Strength:SetText("Strength : “…strength…” XP : “…strengthxp…” / "…LevelXP[strength] )
Strength:SetPos(20,120)
Strength:SetTextColor( Color(100,100,100,255) )
Strength:SizeToContents()

Defense = vgui.Create(“DLabel”,Menu2)
Defense:SetText("Defense : “…defense…” XP : “…defensexp…” / "…LevelXP[defense] )
Defense:SetPos(20,140)
Defense:SetTextColor( Color(100,100,100,255) )
Defense:SizeToContents()

MainLevel = vgui.Create(“DLabel”,Menu2)
MainLevel:SetText("MainLevel : "…mainlevel)
MainLevel:SetPos(20,160)
MainLevel:SetTextColor( Color(100,100,100,255) )
MainLevel:SizeToContents()

TotalLevel = vgui.Create(“DLabel”,Menu2)
TotalLevel:SetText("Total Level : "…totallevel)
TotalLevel:SetPos(20,180)
TotalLevel:SetTextColor( Color(100,100,100,255) )
TotalLevel:SizeToContents()

Mining = vgui.Create(“DLabel”,Menu2)
Mining:SetText("Mining : “…mining…” XP : “…miningxp…” / "…LevelXP[mining] )
Mining:SetPos(170,100)
Mining:SetTextColor( Color(100,100,100,255) )
Mining:SizeToContents()

Smithing = vgui.Create(“DLabel”,Menu2)
Smithing:SetText("Smithing : “…smithing…” XP : “…smithingxp…” / "…LevelXP[smithing] )
Smithing:SetPos(170,120)
Smithing:SetTextColor( Color(100,100,100,255) )
Smithing:SizeToContents()

Woodcutting = vgui.Create(“DLabel”,Menu2)
Woodcutting:SetText("Woodcutting : “…woodcutting…” XP : “…woodcuttingxp…” / "…LevelXP[woodcutting] )
Woodcutting:SetPos(170,140)
Woodcutting:SetTextColor( Color(100,100,100,255) )
Woodcutting:SizeToContents()

Firemaking = vgui.Create(“DLabel”,Menu2)
Firemaking:SetText("Firemaking : “…firemaking…” XP : “…firemakingxp…” / "…LevelXP[firemaking] )
Firemaking:SetPos(170,160)
Firemaking:SetTextColor( Color(100,100,100,255) )
Firemaking:SizeToContents()

Cooking = vgui.Create(“DLabel”,Menu2)
Cooking:SetText("Cooking : “…cooking…” XP : “…cookingxp…” / "…LevelXP[cooking] )
Cooking:SetPos(170,180)
Cooking:SetTextColor( Color(100,100,100,255) )
Cooking:SizeToContents()

Fishing = vgui.Create(“DLabel”,Menu2)
Fishing:SetText("Fishing : “…fishing…” XP : “…fishingxp…” / "…LevelXP[fishing] )
Fishing:SetPos(340,100)
Fishing:SetTextColor( Color(100,100,100,255) )
Fishing:SizeToContents()

Tailoring = vgui.Create(“DLabel”,Menu2)
Tailoring:SetText("Tailoring : “…tailoring…” XP : “…tailoringxp…” / "…LevelXP[tailoring] )
Tailoring:SetPos(340,120)
Tailoring:SetTextColor( Color(100,100,100,255) )
Tailoring:SizeToContents()

Prayer = vgui.Create(“DLabel”,Menu2)
Prayer:SetText("Prayer : “…prayer…” XP : “…prayerxp…” / "…LevelXP[prayer] )
Prayer:SetPos(340,140)
Prayer:SetTextColor( Color(100,100,100,255) )
Prayer:SizeToContents()

Farming = vgui.Create(“DLabel”,Menu2)
Farming:SetText("Farming : “…farming…” XP : “…farmingxp…” / "…LevelXP[farming] )
Farming:SetPos(340,160)
Farming:SetTextColor( Color(100,100,100,255) )
Farming:SizeToContents()

MenuSheet = vgui.Create( “DPropertySheet” )
MenuSheet:SetParent( Mainmenu )
MenuSheet:SetPos(5,40)
MenuSheet:SetSize(ScrW() / 2-15,ScrH() / 2-50)

MenuSheet:AddSheet( “Main Menu”,Menu1,“gui/silkicons/user”,false,false,“Main Menu”)
MenuSheet:AddSheet( “Info - Stats”,Menu2,“gui/silkicons/user”,false,false,“Info - Stats”)
MenuSheet:AddSheet( “Inventory”,Menu3,“gui/silkicons/user”,false,false,“Inventory”)

datastream.Hook(“cucc”, Inventory_Setup)

end

usermessage.Hook(LocalPlayer():UniqueID()…“Skills”,DA_Skills)

concommand.Add(“DA_Main”,main_menu)[/lua]

No error but still late. It is funny

[editline]6th November 2010[/editline]

And what have you changed?

Honoustly, I think you should rewrite your system.