I need help with fixing my gamemode !
Add me and write me in Steam .
[url]http://steamcommunity.com/id/clbanderthegamer[/url]
Hope anyone can help me becouse i love the gamemode and i dont know whats the problem is becouse the script seems okey but my game crashes and gives me :
[CODE]
[ERROR] gamemodes/basewars/gamemode/lmaollama/simplehud.lua:101: attempt to call method 'SetMaterialTexture' (a nil value)
1. unknown - gamemodes/basewars/gamemode/lmaollama/simplehud.lua:101
2. include - [C]:-1
3. unknown - gamemodes/basewars/gamemode/cl_init.lua:101
[ERROR] lua/vgui/dimage.lua:153: attempt to index local 'Mat' (a nil value)
1. FixVertexLitMaterial - lua/vgui/dimage.lua:153
2. SetImage - lua/vgui/dimage.lua:131
3. Setup - lua/vgui/dpropertysheet.lua:42
4. AddSheet - lua/vgui/dpropertysheet.lua:190
5. Populate - gamemodes/sandbox/gamemode/spawnmenu/creationmenu.lua:33
6. Init - gamemodes/sandbox/gamemode/spawnmenu/creationmenu.lua:11
7. Create - lua/includes/extensions/client/panel/scriptedpanels.lua:153
8. Init - gamemodes/sandbox/gamemode/spawnmenu/spawnmenu.lua:19
9. Create - lua/includes/extensions/client/panel/scriptedpanels.lua:153
10. fn - gamemodes/sandbox/gamemode/spawnmenu/spawnmenu.lua:213
11. unknown - addons/ulib/lua/ulib/shared/hook.lua:183
[ERROR] gamemodes/sandbox/gamemode/spawnmenu/spawnmenu.lua:141: attempt to index field 'CreateMenu' (a nil value)
1. unknown - gamemodes/sandbox/gamemode/spawnmenu/spawnmenu.lua:141
[ERROR] gamemodes/sandbox/gamemode/spawnmenu/spawnmenu.lua:141: attempt to index field 'CreateMenu' (a nil value)
1. unknown - gamemodes/sandbox/gamemode/spawnmenu/spawnmenu.lua:141
[ERROR] gamemodes/sandbox/gamemode/spawnmenu/spawnmenu.lua:141: attempt to index field 'CreateMenu' (a nil value)
1. unknown - gamemodes/sandbox/gamemode/spawnmenu/spawnmenu.lua:141
[/CODE]
For any help Thanks! Cya ..
How can we help you fix your gamemode when you don't even post the code that is causing it to cease functioning.
Oh i forgot , sorry write me on steam and i give you a download link to this .
[editline]20th August 2013[/editline]
[url]http://steamcommunity.com/id/clbanderthegamer[/url]
No, just post simplehud.lua.
If you take a look at [URL="https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA/edit"]this[/URL] you'll see that Garry changed some functions regarding to what you're doing. You should change SetMaterialTexture to SetTexture.
[QUOTE=legion_lua;41903384]If you take a look at [URL="https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA/edit"]this[/URL] you'll see that Garry changed some functions regarding to what you're doing. You should change SetMaterialTexture to SetTexture.[/QUOTE]
ok and to james , okey
[editline]20th August 2013[/editline]
Hud works but the gamemode wont work correct.. Need also for the main code help . they are errors with the include gamemode says gmod but sandbox is original ... so what the fuck is this i dont understant add me and help pls ...
[editline]20th August 2013[/editline]
[ERROR] gamemodes/basewars/gamemode/cl_msg.lua:78: bad argument #2 to 'GetInfoNum' (number expected, got no value)
1. GetInfoNum - [C]:-1
2. PaintMessages - gamemodes/basewars/gamemode/cl_msg.lua:78
3. unknown - gamemodes/basewars/gamemode/cl_init.lua:530
-
cl_msg.lua
"
local HUDNote_c = 0
local HUDNote_i = 1
HUDNotesm = {}
function GM:AddMessage( str, type, length )
local tab = {}
tab.text = str
tab.recv = SysTime()
tab.len = length
tab.velx = 0
tab.vely = 0
tab.x = 20
tab.y = 0
tab.a = 255
tab.type = type
table.insert( HUDNotesm, tab )
HUDNote_c = HUDNote_c + 1
HUDNote_i = HUDNote_i + 1
end
local function DrawMessagem( self, k, v, i )
local H = ScrH() / 1024
local x = v.x
local y = v.y
if ( !v.w ) then
surface.SetFont( "MessageFont" )
v.w, v.h = surface.GetTextSize( v.text )
end
local w = v.w
local h = v.h
w = w + 16
h = h+((i-1)*v.h)
y=y+h
//draw.RoundedBox( 4, x - w - h + 8, y - 8, w + h, h, Color( 30, 30, 30, v.a * 0.4 ) )
// Draw Icon
surface.SetDrawColor( 255, 255, 255, v.a )
//surface.SetTexture( NoticeMaterial[ v.type ] )
//surface.DrawTexturedRect( x - w - h + 16, y - 4, h - 8, h - 8 )
/*
0 logs
1 warning
2 income
3 info
4 error
*/
local textcolor = Color(0,250,0,255)
if v.type==1 then
textcolor = Color(250,0,0,255)
elseif v.type==2 then
textcolor = Color(0,100,0,255)
elseif v.type==3 then
textcolor = Color(150,150,0,255)
elseif v.type==4 then
textcolor = Color(150,0,0,255)
end
if LocalPlayer():GetInfoNum("bw_showmessages")==1 then
draw.SimpleText( v.text, "MessageFont", x+1, y+1, Color(0,0,0,150), TEXT_ALIGN_LEFT )
draw.SimpleText( v.text, "MessageFont", x, y, textcolor, TEXT_ALIGN_LEFT )
end
end
function GM:PaintMessages()
if LocalPlayer():GetInfoNum("bw_showmessages")==1 then
if ScrW()>1000 then
draw.RoundedBox( 10, 10, 10, 570, 170, Color( 30, 30, 30, 100 ) )
else
draw.RoundedBox( 10, 10, 10, 450, 130, Color( 30, 30, 30, 100 ) )
end
end
if ( !HUDNotesm ) then return end
while #HUDNotesm>10 do
table.remove(HUDNotesm, 1)
end
local i = 0
for k, v in pairs( HUDNotesm ) do
if ( k != 0 ) then
i = i + 1
DrawMessagem( self, k, v, i)
end
end
end
// lol redundant
function MsgManageMessages(msg)
local text = msg:ReadString()
local type = msg:ReadShort()
local time = msg:ReadShort()
if LocalPlayer():GetInfoNum("bw_showmessages")==nil then
CreateClientConVar("bw_showmessages", 1, true, false)
end
if LocalPlayer():GetInfoNum("bw_shownotify")==nil then
CreateClientConVar("bw_shownotify", 0, true, false)
end
if LocalPlayer():GetInfoNum("bw_messages_warningnotify")==nil then
CreateClientConVar("bw_messages_warningnotify", 1, true, false)
end
if LocalPlayer():GetInfoNum("bw_messages_dontshowincome")==nil then
CreateClientConVar("bw_messages_dontshowincome", 0, true, false)
end
local mode = LocalPlayer():GetInfoNum("bw_showmessages")
local both = LocalPlayer():GetInfoNum("bw_shownotify")
local warn = LocalPlayer():GetInfoNum("bw_messages_warningnotify")
local inc = LocalPlayer():GetInfoNum("bw_messages_dontshowincome")
if mode==0 then
GAMEMODE:AddNotify(text,type,time)
elseif mode==1 then
if inc==0 || type!=2 then
GAMEMODE:AddMessage(text,type,time)
end
end
if both==1 && mode==1 then
GAMEMODE:AddNotify(text,type,time)
end
// if 'both' is set already, we dont need to put the message twice.
if warn==1 && mode==1 && both==0 && type==1 then
GAMEMODE:AddNotify(text,type,time)
end
end
usermessage.Hook("RPDMNotify", MsgManageMessages)"
When posting Lua code, use [noparse][lua][/lua][/noparse] tags
As for the error, everytime you are calling [b][url=http://wiki.garrysmod.com/?title=Player.GetInfoNum]Player.GetInfoNum [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b], you are forgetting the second argument denoting the default value the convar should be set to. In other words, look at where you are creating the convars from line 109 to 118, and set the second argument (the default) of the Player.GetInfoNum to the same as the second argument of the CreateClientConvar functions with the same argument.
That looks really complicated when written down, but it isn't. For example:
Change this
[lua]
if LocalPlayer():GetInfoNum("bw_showmessages")==1 then
[/lua]
to this
[lua]
if LocalPlayer():GetInfoNum("bw_showmessages", 1)==1 then
[/lua]
because this
[lua]
CreateClientConVar("bw_showmessages", 1, true, false)
[/lua]
I'm not entirely sure but this seems to be the logical solution.
You are pretty nice coder ! ;) Did you have any type of chat? Steam or anything else?
[editline]20th August 2013[/editline]
What ever this thead is done , ill make this done in privacy !
This gamemode is soon playable on : 185.9.106.50:27015
James is helping me ( i hope ;D )
Sorry, you need to Log In to post a reply to this thread.