• Problem woith my gamemode
    19 replies, posted
Ok,i created a "shema" for cake script but the problem is,when i try to change my game mode on my server i get this. Couldn't include file 'Cakescript\gamemode\init.lua' (File not found) ********************************************** ********************************************** ********** COULDN'T LOAD GAMEMODE!! ********** ********************************************** ********************************************** There was a problem opening the gamemode file 'Cakescript/gamemode/init.lua' Registering gamemode 'Cakescript' derived from 'base' So at the end i just cannot test it. Any idea what cause this ?
Did you set up the Schema properly? Can we see the script you used/have set up.
Ok finally I make everything work,or almost... I changing gamemode and during the load of all the thing,it freeze after those line... Lua initialized (Lua 5.1) Registering gamemode 'sandbox' derived from 'base' Usually it's just after that my gamemode really load... So I was wondering what the problem ? Edit:It finally unfreeze but i get this error... "gamemodes\cakescriptg2\gamemode\schema.lua:39: Infinite Loop Detected" There is the line 39 of the schema.lua CAKE.LoadItem( schema, v ); Edit2:Ok now I get "you dont have enough memory" error.I mean I have 2GO of RAM I think I should have enough no ?
UP
Well, there's an inf loop somewhere in the schema script, which is flooding your memory.
Did there is a way to find what cause it(infinite loop) or everything is just screwed ? Note:If needed I can copy/paste files here.
Well you would have to check the schema script for anything that would cause a loop. If you post, it'll be easier to tell.
withc of the lua ? The schema.lua or the "nameotheschema".lua ? Edit:Anyway I post both... Schema.lua ////////////////////////////////////////////////// ------------------------------- -- CakeScript Generation 2 -- Author: LuaBanana ( Aka Jake ) -- Project Start: 5/24/2008 -- -- schema.lua -- Loads and configures the schema ------------------------------- CAKE.Schemas = { earthcivilwar }; function CAKE.LoadSchema( schema ) local path = "schemas/earthcivilwar.lua"; SCHEMA = { "earthcivilwar" }; include( path ); CAKE.DayLog( "script.txt", "Loading schema ", "Earth Civil War", " by ", "ManuGod", ("Fight on a earth,take in a full world civil war.Will you stay neutral in this conflict or take side ?") ); table.insert( CAKE.Schemas, SCHEMA ); -- Load the plugins local list = file.FindInLua( "CakeScriptG2/gamemode/schemas/earthcivilwar/plugins/earth_voices.lua" ); for k, v in pairs( list ) do CAKE.LoadPlugin( schema, v ); end -- Load the items local list = file.FindInLua( "schemas/earthcivilwar/items/weapon_xm8.lua", "schemas/earthcivilwar/items/ration.lua", "schemas/earthcivilwar/items/bleach.lua", "schemas/earthcivilwar/items/beans.lua", "schemas/earthcivilwar/items/shoe.lua", "schemas/earthcivilwar/items/milkcarton.lua", "schemas/earthcivilwar/items/milkjug.lua", "schemas/earthcivilwar/items/sodawoliter.lua", "schemas/earthcivilwar/items/chinese.lua", "schemas/earthcivilwar/items/breensreserve.lua", "schemas/earthcivilwar/items/lightbeer.lua", "schemas/earthcivilwar/items/crack.lua", "schemas/earthcivilwar/items/darkbeer.lua", "schemas/earthcivilwar/items/weapon_glock.lua", "schemas/earthcivilwar/items/airsupport_ac130.lua", "schemas/earthcivilwar/items/weapon_stuntstick.lua", "schemas/earthcivilwar/items/weapon_m82", "schemas/earthcivilwar/items/weapon_m60.lua", "schemas/earthcivilwar/items/weapon_svd.lua", "schemas/earthcivilwar/items/weapon_m23.lua", "schemas/earthcivilwar/items/weapon_knife.lua", "schemas/earthcivilwar/items/weapon_kis.lua", "schemas/earthcivilwar/items/weapon_magnum.lua", "schemas/earthcivilwar/items/weapon_hk21.lua", "schemas/earthcivilwar/items/weapon_dual.lua", "schemas/earthcivilwar/items/weapon_deagle.lua", "schemas/earthcivilwar/items/weapon_combatknife.lua", "schemas/earthcivilwar/items/weapon_baionnet.lua" ); for k, v in pairs( list ) do CAKE.LoadItem( schema, v ); end if( SCHEMA.Base != nil ) then CAKE.LoadSchema( SCHEMA.Base ) end end function CAKE.InitSchemas( ) for _, SCHEMA in pairs( CAKE.Schemas ) do CAKE.CallHook( "InitSchema", SCHEMA ); SCHEMA.SetUp( ); end end CAKE.ValidModels = {}; function CAKE.AddModels(mdls) if(type(mdls) == "table") then for k, v in pairs(mdls) do table.insert(CAKE.ValidModels, v) end else table.insert(CAKE.ValidModels, mdls) end end ///////////////////////////////////////////////////////////////// earthcivilwar.lua ///////////////////////////////////////////////////////////////// SCHEMA.Name = "Earth Civil War" SCHEMA.Author = "ManuGod"; SCHEMA.Description = "Fight on the earth for it's liberation or it's conquest !"; SCHEMA.Base = "global"; function SCHEMA.SetUp( ) local team = CAKE.EarthTeam(); -- name, color, model_path, default_model, partial_model, weapons, flag_key, door_groups, radio_groups, sound_groups, item_groups, salary, public, business, broadcast -- Item Groups -- NEA Market: 1 -- Tracker market: 2 -- Medical: 3 -- Citizen: 4 -- Civil Protection market: 5 -- Black Market: 6 -- NEA Radio Operator: 7 -- NEA: 1 -- Tracker: 2 -- Citizen: 3 -- Civil Protection: 4 -- Door Groups -- NEA: 1 -- Radio Groups -- NEA: 1 -- Tracker: 2 -- Civil Protection: 3 -- Citizen CAKE.AddTeam( CAKE.EarthTeam( "Civil Protection Trainee", nil, "models/Lillwasa/mecop1.mdl", true, false, {"weapon_stunstick"}, "cpt", nil, {3}, {1}, nil, {100}, false, true, false) ); --Civil Protection Trainee CAKE.AddTeam( CAKE.EarthTeam( "Civil Protection", nil, "models/player/police.mdl", true, false, {"weapon_stuntstick", "weapon_glock"}, "cp", nil, {3}, {1}, {5}, {200}, false, true, false) ); --Civil Protection CAKE.AddTeam( CAKE.EarthTeam( "Black Market's contact", "models/player/monk.mdl", true, false, {"weapon_dual", "weapon_knife"}, "bmc", nil, nil, nil, {6}, nil, nil, true, false) ); --Black Market's Contact -- NEA CAKE.Add.Team( CAKE.EarthTeam( "NEA Recruit", nil, "models/upusmcdesert/Us/soldier_01.mdl", true, false, {"weapon_combatknife"}, "neare", {1}, nil, nil, nil, {100}, false, true, false) ); --NEA Recruit CAKE.Add.Team( CAKE.EarthTeam( "NEA Rifleman", nil, "models/upusmcdesert/Us/soldier_01.mdl", true, false, {"weapon_m23", "weapon_combatknife"}, "near", {1}, {1}, nil, nil, {200}, false, true, false) ); --NEA Rifleman CAKE.Add.Team( CAKE.EarthTeam( "NEA Machinegunner", nil, "models/upusmcdesert/Us/soldier_01.mdl", true, false, {"weapon_hk21", "weapon_combatknife"}, "neam", {1}, {1}, nil, nil, {200}, false, true, false) ); --NEA Machinegunner CAKE.Add.Team( CAKE.EarthTeam( "NEA Sniper", nil, "models/upusmcdesert/Us/mask.mdl", true, false, {"weapon_m82", "weapon_combatknife"}, "neas", {1}, {1}, nil, {1}, {200}, false, true, false) ); --NEA Sniper CAKE.Add.Team( CAKE.EarthTeam( "NEA Commanding Officer", nil, "models/upusmcdesert/Us/soldier_01.mdl", true, false, {"weapon_m23", "weapon_deagle"}, "neaco", {1}, {1}, nil, nil, {400}, false, true, false) ); --NEA Commanding Officer CAKE.Add.Team( CAKE.EarthTeam( "NEA Logistic Officer", nil, "models/upusmcdesert/Us/soldier_01.mdl", true, false, {"weapon_xm8", "weapon_combatknife"}, "nealo", {1}, {1}, nil, {1}, {300}, false, true, false) ); --NEA Logistic Officer CAKE.Add.TEam( CAKE.EarthTeam( "Prime minister", nil, "models/player/breen.mdl", true, false, nil, "pm", {1}, {1}, nil, nil, {1000}, false, true, true) ); --Prime minister CAKE.Add.Team( CAKE.EarthTeam( "NEA Radio Operator", nil, "models/upusmcdesert/Us/soldier_01.mdl", true, false, {"weapon_xm8", "weapon_combatknife", airsupport_ac130}, "donators", {1}, {1}, nil, {7}, {300}, false, true, false) ); --NEA Radio Operator --Tracker Militia CAKE.Add.Team( CAKE.EarthTeam( "Refugee", nil, "models/humans/group02/", true, false, nil, "refugee", nil, nil, nil, nil, nil, false, true, false) ); --Refugee CAKE.Add.Team( CAKE.EarthTeam( "Militia Warrior", nil, "models/opforc/opforguy.mdl", true, false, {"weapon_kis"}, "warrior", nil, {2}, nil, nil, nil, false, true, false) ); --Militia Warrior CAKE.Add.Team( CAKE.EarthTeam( "Militia Fighter", nil, "models/opforc/opforguy2.mdl", true, false, {"weapon_m60"}, "fighter", nil, {2}, nil, nil, nil, false, true, false) ); --Militia Fighter CAKE.Add.Team( CAKE.EarthTeam( "Militia Leader", nil, "models/opforc/opforguy3.mdl", true, false, {"weapon_svd"}, "leader", nil, {2}, nil, nil, nil, false, true, false) ); --Militia Leader CAKE.Add.Team( CAKE.EarthTeam( "Warlord", nil, "models/opforc/opforc.mdl", true, false, {"weapon_svd", "weapon_baionnet", "weapon_magnum"}, "warlord", nil, {2}, nil, nil, nil, false, true, false) ); --Warlord CAKE.Add.Team( CAKE.EarthTeam( "Militia Supplier", nil, "models/humans/group01/", true, false, {"weapon_glock"}, "supplier", nil, {2}, nil, {2, 6}, {500}, false, true, false) ); --Militia Supplier -- Selectable models on character creation -- Bogus models were needed because the shitty derma doesn't wanna scroll unless it has a certain amount of models. CAKE.AddModels({ "models/humans/group01/male_01.mdl", "models/humans/group01/male_02.mdl", "models/humans/group01/male_03.mdl", "models/humans/group01/male_04.mdl", "models/humans/group01/male_06.mdl", "models/humans/group01/male_07.mdl", "models/humans/group01/male_08.mdl", "models/humans/group01/male_09.mdl", "models/humans/group01/female_01.mdl", "models/humans/group01/female_02.mdl", "models/humans/group01/female_03.mdl", "models/humans/group01/female_04.mdl", "models/humans/group01/female_06.mdl",
i think from the OP the problem is that the LUA cache is not being sent. To Test: change sv_downloadurl to sv_downloadurl ""
No change,thank you for the idea...
CAKE.Add.Team( CAKE.EarthTeam( "Militia Supplier", nil, "models/humans/group01/", true, false, {"weapon_glock"}, "supplier", nil, {2}, nil, {2, 6}, [u]{500},[/u] false, true, false) ); Salary shouldn't be in brackets. CAKE.AddTeam( CAKE.EarthTeam( "<name>", Color(0,0,0,0), "<modeldir>", true, false, { "weapons" }, "<flag>", {<doorgroup>}, {<radiogroup>}, {<soundgroup>}, {<itemgroup>}, <salary>, <public>, <business>, <broadcast>) );
[QUOTE=DatMeg;23663711]CAKE.Add.Team( CAKE.EarthTeam( "Militia Supplier", nil, "models/humans/group01/", true, false, {"weapon_glock"}, "supplier", nil, {2}, nil, {2, 6}, [u]{500},[/u] false, true, false) ); Salary shouldn't be in brackets. CAKE.AddTeam( CAKE.EarthTeam( "<name>", Color(0,0,0,0), "<modeldir>", true, false, { "weapons" }, "<flag>", {<doorgroup>}, {<radiogroup>}, {<soundgroup>}, {<itemgroup>}, <salary>, <public>, <business>, <broadcast>) );[/QUOTE] OK I'll give a try,I'll keep you inform ;) [editline]01:06PM[/editline] Mmmm,no change,but I think,maybee,I could help finfing the problem. Last time before it says not enough memory I get, "gamemodes\cakescriptg2\gamemode\schema.lua:39 : Infinite Loop Detected" Witch was in this part... //////////////////////////// -- Load the items local list = file.FindInLua([...]) for k, v in pairs( list ) do ------> CAKE.LoadItem( schema, v ); <------ end /////////////////////////////
[QUOTE=manugod;23663782]OK I'll give a try,I'll keep you inform ;) [editline]01:06PM[/editline] Mmmm,no change,but I think,maybee,I could help finfing the problem. Last time before it says not enough memory I get, "gamemodes\cakescriptg2\gamemode\schema.lua:39 : Infinite Loop Detected" Witch was in this part... //////////////////////////// -- Load the items local list = file.FindInLua([...]) for k, v in pairs( list ) do ------> CAKE.LoadItem( schema, v ); <------ end /////////////////////////////[/QUOTE] Well is that for loop in the LoadItem or Schema itself?
[QUOTE=SomeFaggot;23668526]Well is that for loop in the LoadItem or Schema itself?[/QUOTE] All,I think,I understand is that the section of the schema.lua where it start loading the items create the loop,but for the rest I don't really know. I just begin doing some lua. Maybee it's the items.lua that create the loop ? items.lua //////////////////////////////// CAKE.ItemData = { }; function CAKE.LoadItem( schema, filename ) local path = "schemas/earthcivilwar/items/weapon_xm8.lua", "schemas/earthcivilwar/items/ration.lua", "schemas/earthcivilwar/items/bleach.lua", "schemas/earthcivilwar/items/beans.lua", "schemas/earthcivilwar/items/shoe.lua", "schemas/earthcivilwar/items/milkcarton.lua", "schemas/earthcivilwar/items/milkjug.lua", "schemas/earthcivilwar/items/sodawoliter.lua", "schemas/earthcivilwar/items/chinese.lua", "schemas/earthcivilwar/items/breensreserve.lua", "schemas/earthcivilwar/items/lightbeer.lua", "schemas/earthcivilwar/items/crack.lua", "schemas/earthcivilwar/items/darkbeer.lua", "schemas/earthcivilwar/items/weapon_glock.lua", "schemas/earthcivilwar/items/airsupport_ac130.lua", "schemas/earthcivilwar/items/weapon_stuntstick.lua", "schemas/earthcivilwar/items/weapon_m82", "schemas/earthcivilwar/items/weapon_m60.lua", "schemas/earthcivilwar/items/weapon_svd.lua", "schemas/earthcivilwar/items/weapon_m23.lua", "schemas/earthcivilwar/items/weapon_knife.lua", "schemas/earthcivilwar/items/weapon_kis.lua", "schemas/earthcivilwar/items/weapon_magnum.lua", "schemas/earthcivilwar/items/weapon_hk21.lua", "schemas/earthcivilwar/items/weapon_dual.lua", "schemas/earthcivilwar/items/weapon_deagle.lua", "schemas/earthcivilwar/items/weapon_combatknife.lua", "schemas/earthcivilwar/items/weapon_baionnet.lua"; ITEM = { }; include( path ); CAKE.ItemData[ ITEM.Class ] = ITEM; end function CAKE.CreateItem( class, pos, ang ) if( CAKE.ItemData[ class ] == nil ) then return; end local itemtable = CAKE.ItemData[ class ]; local item = ents.Create( "item_prop" ); item:SetModel( itemtable.Model ); item:SetAngles( ang ); item:SetPos( pos ); for k, v in pairs( itemtable ) do item[ k ] = v; if( type( v ) == "string" ) then item:SetNWString( k, v ); end end item:Spawn( ); item:Activate( ); end function ccCreateItem( ply, cmd, args ) if( ply:IsAdmin( ) or ply:IsSuperAdmin( ) ) then -- Drop the item 80 units infront of him. CAKE.CreateItem( args[ 1 ], ply:CalcDrop( ), Angle( 0,0,0 ) ); end end concommand.Add( "rp_createitem", ccCreateItem ); function ccDropItem( ply, cmd, args ) local inv = CAKE.GetCharField( ply, "inventory" ); for k, v in pairs( inv ) do if( v == args[ 1 ] ) then CAKE.CreateItem( args[ 1 ], ply:CalcDrop( ), Angle( 0,0,0 ) ); ply:TakeItem( args[ 1 ] ); return; end end end concommand.Add( "rp_dropitem", ccDropItem ); function ccBuyItem( ply, cmd, args ) if( CAKE.ItemData[ args[ 1 ] ] != nil ) then if( CAKE.Teams[ ply:Team( ) ][ "business" ] ) then if(table.HasValue(CAKE.Teams[ ply:Team( ) ][ "item_groups" ], CAKE.ItemData[ args[ 1 ] ].ItemGroup)) then if( CAKE.ItemData[ args[ 1 ] ].Purchaseable and tonumber(CAKE.GetCharField(ply, "money" )) >= CAKE.ItemData[ args[ 1 ] ].Price ) then CAKE.ChangeMoney( ply, 0 - CAKE.ItemData[ args[ 1 ] ].Price ); CAKE.CreateItem( args[ 1 ], ply:CalcDrop( ), Angle( 0,0,0 ) ); else CAKE.SendChat( ply, "You do not have enough money to purchase this item!" ); end else CAKE.SendChat( ply, "You cannot purchase this item!" ); end else CAKE.SendChat( ply, "You do not have access to Business!" ); end end end concommand.Add( "rp_buyitem", ccBuyItem ); ///////////////////////////////////
I seriously doubt this is your problem, but I want to make sure we cover all the bases. Have you changed the default schema in the configuration.lua? Are you trying to use characters from a previous schema? If you are using old characters, have you changed the rate of salary payout? Also I don't think [lua]function CAKE.LoadItem( schema, filename ) local path = "schemas/" .. schema .. "/items/" .. filename; ITEM = { }; include( path ); CAKE.ItemData[ ITEM.Class ] = ITEM; end[/lua] That should be changed. I believe it looks in the schema's folder under /items for any Lua coded items and it shouldn't be modified. If your "earthweapons" should be automatically loaded with garrysmod so long as their addons. If you want to add a description and price to a weapon you need to make an Lua for it. For example:[lua] ITEM.Name = "Overwatch Standard-Issue AR2"; ITEM.Class = "weapon_ar2"; ITEM.Description = "Pulse Rifle Technology"; ITEM.Model = "models/weapons/w_irifle.mdl"; ITEM.Purchaseable = true; ITEM.Price = 1500; ITEM.ItemGroup = 2; function ITEM:Drop(ply) end function ITEM:Pickup(ply) self:Remove(); end function ITEM:UseItem(ply) ply:Give("weapon_ar2"); self:Remove(); end [/lua]
ok you will probably thinking I'm stupid(and this week I am),but after doing some research,I found that I only need to replace the line in hl2rp locate in schema folder to my own liking,and adding my own items too.. So I finally been able to run my server with it,but I get a problem. I can't choose player model during character creation and I get this line write in yello. lua\vgui\dmodelpanel.lua:69: bad argument #1 to 'ClientsideModel' (string expected, got nil)l What did I need to do to corect this ?
[QUOTE=manugod;23722603]ok you will probably thinking I'm stupid(and this week I am),but after doing some research,I found that I only need to replace the line in hl2rp locate in schema folder to my own liking,and adding my own items too.. So I finally been able to run my server with it,but I get a problem. I can't choose player model during character creation and I get this line write in yello. lua\vgui\dmodelpanel.lua:69: bad argument #1 to 'ClientsideModel' (string expected, got nil)l What did I need to do to corect this ?[/QUOTE] You either need to add quotation marks to the model name, making it a string, or it might have no argument between the parentheses.
Ok so this line self.Entity = ClientsideModel( strModelName, RENDER_GROUP_OPAQUE_ENTITY ) Should be like that,is that what you mean ? self.Entity = ClientsideModel( "strModelName", RENDER_GROUP_OPAQUE_ENTITY )
UP
UP
Sorry, you need to Log In to post a reply to this thread.