Cakescript G2 Fixes Here. Get them while they are hot.
25 replies, posted
OK, I've been working on a new gamemode (it's not SeriousRP, that's still underway)
The new gamemode is based on Cakescript G2. As you all know, Cakescript G2 1.0.4 is broken
Here are the fixes:
CakeScriptG2/gamemode/charactercreate.lua
replace:
[code]
local PlyCharTable = CAKE.PlayerData[ CAKE.FormatSteamID( ply:SteamID() ) ]["characters"];
[/code]
with:
[code]
local PlyCharTable = CAKE.PlayerData[ CAKE.FormatSteamID( ply:SteamID() ) ]["characters"] or {};
[/code]
CakeScriptG2/gamemode/cl_charactercreate.lua (Fix for vgui error)
replace:
[code]
models = {};
[/code]
with:
[code]
ValidCakeModels = {};
[/code]
replace:
[code]
table.insert( models, data:ReadString( ) )
[/code]
with:
[code]
table.insert( ValidCakeModels, data:ReadString( ) )
[/code]
replace:
[code]
table.insert( models, data:ReadString( ) )
[/code]
with:
[code]
table.insert( ValidCakeModels, data:ReadString( ) )
[/code]
CakeScriptG2/gamemode/cl_playermenu.lua:
replace:
[code]
mdlPanel:SetModel( models[1] )
[/code]
with:
[code]
mdlPanel:SetModel( ValidCakeModels[1] )
[/code]
replace:
[code]
i = #models;
[/code]
with:
[code]
i = #ValidCakeModels;
[/code]
replace:
[code]
mdlPanel:SetModel(models[i]);
[/code]
with:
[code]
mdlPanel:SetModel(ValidCakeModels[i]);
[/code]
replace:
[code]
if(i > #models) then
[/code]
with:
[code]
if(i > #ValidCakeModels) then
[/code]
replace:
[code]
mdlPanel:SetModel(models[i]);
[/code]
with:
[code]
mdlPanel:SetModel(ValidCakeModels[i]);
[/code]
replace:
[code]
if(!table.HasValue(models, ChosenModel)) then
[/code]
with:
[code]
if(!table.HasValue(ValidCakeModels, ChosenModel)) then
[/code]
CakeScriptG2/gamemode/cl_init.lua: (cl_binds errors Fix)
- Move cl_binds.lua include to the bottom of the list of includes
CakeScriptG2/gamemode/concmd.lua: (Spelling fix)
replace:
[code]
CAKE.SendChat( ply, "This is not a purchaseable door!" );
[/code]
with:
[code]
CAKE.SendChat( ply, "This is not a purchasable door!" );
[/code]
CakeScriptG2/gamemode/init.lua: (make sure files are copied client side) maybe they are already who knows.
replace:
[code]
GM.Name = "Cakescript G2";
[/code]
with:
[code]
GM.Name = "Cakescript G2";
-- Add Client Side files
AddCSLuaFile( "cl_binds.lua" );
AddCSLuaFile( "shared.lua" );
AddCSLuaFile( "player_shared.lua" );
AddCSLuaFile( "cl_hud.lua" );
AddCSLuaFile( "cl_charactercreate.lua" );
AddCSLuaFile( "cl_playermenu.lua" );
AddCSLuaFile( "cl_init.lua" );
[/code]
- Move the util.lua include between error_handling and hooks lua includes (fixes adding admin commands in admin_cc.lua)
[code]
include( "error_handling.lua" ); -- Error handling functions
include( "util.lua" ); -- Functions
include( "hooks.lua" ); -- CakeScript Hook System
[/code]
Would anyone like a diff version of this? :3
[editline]05:51PM[/editline]
I could make one. (In case you don't know what diff is, [url]http://en.wikipedia.org/wiki/Diff[/url] )
I used a diff to create it in the first place but I've edited the script quite a bit so it's not quite the same any more to make a diff from.
Someone can release a 1.0.4a if they like with these fixes / make a diff. I mainly posted this here like that so people can update their already-deployed-but-broken scripts.
I'm still looking for a solution for the broken hands / weapons. They are just not usable at the moment. If anyone knows the solution to that, please do post it so we can get all the fixes together. Cakescript G3 may be coming... but G2 is broken and I'm currently trying to use it, I'm sure many others are too.
Well, good job on fixing all these problems. CSG3 is well under way and I've been betatesting it with many scripters and community owners so they can get a feel for it.
You made a mistake on the last 2 of cl_charactercreate the ones above them and those are the same.
Thanks a lot for this phil :3, again you're a benefit to us.
[QUOTE=philxyz;19253313]I used a diff to create it in the first place but I've edited the script quite a bit so it's not quite the same any more to make a diff from.
Someone can release a 1.0.4a if they like with these fixes / make a diff. I mainly posted this here like that so people can update their already-deployed-but-broken scripts.
I'm still looking for a solution for the broken hands / weapons. They are just not usable at the moment. If anyone knows the solution to that, please do post it so we can get all the fixes together. Cakescript G3 may be coming... but G2 is broken and I'm currently trying to use it, I'm sure many others are too.[/QUOTE]
I did the 1.0.4a and released it in Gamemodes, All credits to you guys mostly. I gave myself 1 credit point :3 I feel special.
Some of the guns don't work because the animations are broken.
Simplest solution?
change this in init.lua:
include("animations.lua")
--include("animations.lua")
Anyone know how soon until G3 is released?
May try out G2 with these fixes in the meantime...
Nice bump man!
Doesn't Really matter, this is a good thread, I'm glad this was bumped so I could find it.
OP I love you :)
Due to these fixes I decided to give cakescript another try. However when I try to press ok to select a model I get:
[lua]
includes/extensions/table.lua:103: bad argument #1 to 'pairs' (table expected, got nil) is not a valid model!
[/lua]
I didn't spot any mistakes that I could have made while copieing.
Edit:
Fixed it. The line
[lua] if( table.HasValue( models, mdl ) ) then [/lua]
in cl_charactercreate had to be ValidCakeModels instead of models.
Sorry, but I am wondering.
I have downloaded [url]http://www.garrysmod.org/downloads/?a=view&id=87145[/url] that is using your fixes. But when I type "rp_setflags" it says that its an invalid command. Any clue?
rp_admin setflags player flag
[editline]05:18PM[/editline]
or rp_admin setflag player flag
dont remember
Thanks Knallex ;)
Also, Animations are broken.
Opened "Init.lua" and changed
[code]include("animations.lua")[/code]
to
[code] --include("animations.lua")[/code]
Now it uses default animations, but it fixed it.
[editline]08:06PM[/editline]
But now,
] rp_admin setflag Heineken CP
Unknown Command: 'rp_admin'
Why?
[editline]08:08PM[/editline]
NVM, rejoined, fixed,
[editline]08:20PM[/editline]
But, animations are tlike T-Minges, howto fix?
Awesome work. This could maybe turn out like a serious alternative to DarkRP now.
Can anyone help me? I have broken animations!
OWS etc. walk like they are snowboarding!
[QUOTE=Heinserver;21704555]Can anyone help me? I have broken animations!
OWS etc. walk like they are snowboarding![/QUOTE]
Install source 2007 models on your server.
I did.
So I put them in Garrysmod/Garrysmod?
garrysmod/models is where they should go.
Unless they come out in a models folder, in which case it goes in your root garrysmod folder, meaning the second one, or the one after orangebox if you are running a server from XenonServers and are using an FTP client.
Sorry for bumping an extremely like old thread. Like not that old but you get the point. I thought this would be considered a nice addition. I see people hate the fact there isn't a drop weapon command to drop a weapon and pick it up. So here is the script for you all.
[CODE]
-- Weapon dropping script by flash
local shoulddropweapon = true
-- Allows admins to disable/enable the drop weapon command.
local function shoulddropweapontoggle(ply)
if(ply:IsAdmin()) then
ply:PrintMessage(HUD_PRINTNOTIFY, "Weapon Drop Is Disabled.")
shoulddropweapon = false
else
ply:PrintMessage(HUD_PRINTNOTIFY, "Weapon Drop Is Enabled.")
shoulddropweapon = true
end
end
end
-- Allows the player to drop his weapon.
local function dropweaponplayer(ply)
if (shoulddropweapon == true and ply:GetActiveWeapon():IsValid()) then
ply:DropWeapon(ply:GetActiveWeapon())
end
end
-- Adds the console commands and a small hook to allow players to bind the command.
concommand.Add( "dropweapon", dropweaponplayer )
concommand.Add( "dropweapon_toggle", shoulddropweapontoggle )
hook.Add("DoPlayerDeath", "dropweaponondeath", dropweaponplayer)
[/CODE]
simply save the code above as dropweapon.lua and place it in gamemodes/CakeScriptG2/gamemode. You then have to do the usual and tell the client to download and run the script which is done in init.lua simply find a suitable place in init and edit with AddCSLuaFile.
Thanks,
Flash
I'm not trying to bring this thread up, I only need help. When I press f1 this error shows up:
ERROR: GAMEMODE:'ShowHelp' Failed: gamemodes\cakescriptg2\gamemode\concmd.lua:39: attempt to index field '?' (a nil value)
I've been trying to make my own schema but I'm not that good..
This is how the schema looks like: (I've only changed the model of the flags and name!) [code]SCHEMA.Name = "Black Mesa Roleplay";
SCHEMA.Author = "PetruZ";
SCHEMA.Description = "A normal day at work.";
SCHEMA.Base = "global";
function SCHEMA.SetUp( )
local team = CAKE.HL2Team();
-- 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
-- Groceries: 1
-- Black Market: 2
-- Medical: 3
-- Rebel Market: 4
-- Combine Market: 5
-- Monk Market: 6
-- Humans: 1
-- Combine: 2
-- Vortigaunt: 3
-- Door Groups
-- Combine: 1
-- Radio Groups
-- Combine: 1
-- Rebel: 2
-- Visitor
CAKE.AddTeam( CAKE.BmrpTeam( ) ); -- Visitor
-- Scientists
CAKE.AddTeam( CAKE.BmrpTeam( "Research and Development", Color(255, 166, 0, 255), "models/blackmesasciences/male_06.mdl", true, true, nil, "rad", nil, { 2 }, nil, { 4 }, nil, true, true, nil) ); -- Research and Development
CAKE.AddTeam( CAKE.BmrpTeam( "Research Associate", Color(255, 166, 0, 255), "models/blackmesasciences/male_08.mdl", true, false, nil, "ra", nil, { 2 }, nil, { 4 }, nil, false, true, nil) ); -- Research Associate
CAKE.AddTeam( CAKE.BmrpTeam( "Hazardous Environment Supervisor", Color(255, 166, 0, 255), "models/blackmesasciences/male_09.mdl", true, true, nil, "hes", nil, { 2 }, nil, { 4 }, nil, false, true, nil) ); -- Hazardous Environment Supervisor
CAKE.AddTeam( CAKE.BmrpTeam( "Instructor", Color(255, 166, 0, 255), "models/blackmesasciences/male_02.mdl", true, false, nil, "ins", nil, { 2 }, nil, { 4 }, nil, false, true, nil) ); -- Instructor
CAKE.AddTeam( CAKE.BmrpTeam( "Survey Team", Color(255, 166, 0, 255), "models/blackmesasciences/kleiner.mdl, true, true, nil, "st", nil, { 2 }, nil, { 4 }, nil, false, true, nil) ); -- Survey Team
-- Security
CAKE.AddTeam( CAKE.BmrpTeam( "Security Officer", Color(0, 0, 200, 255), "models/securityguards/male_02.mdl", true, false, {}, "so", {1}, {1}, nil, {5}, 0, false, true, false) ); -- Security Officer
CAKE.AddTeam( CAKE.BmrpTeam( "Section Manager", Color(0, 0, 200, 255), "models/securityguards/male_03.mdl", true, false, {"weapon_stunstick"}, "sm", {1}, {1}, {2}, {5}, 30, false, true, false) ); -- Section Manager
CAKE.AddTeam( CAKE.BmrpTeam( "Instructor", Color(0, 0, 200, 255), "models/securityguards/male_05.mdl", true, false, {"weapon_stunstick", "weapon_pistol"}, "inst", {1}, {1}, {2}, {5}, 50, false, true, true) ); -- Instructor
-- Other
CAKE.AddTeam( CAKE.BmrpTeam( "Administration personnel", Color(0, 0, 200, 255), "models/breen.mdl", true, false, {"weapon_357"}, "adm", {1}, {1}, {2}, {5}, 200, false, true, true) ); -- Administration personnel
CAKE.AddTeam( CAKE.BmrpTeam( "Service personnel", Color(0, 0, 200, 255), "models/blackmesasciences/male_05.mdl", true, false, {"weapon_357"}, "sp", {1}, {1}, {2}, {5}, 200, false, true, true) ); -- Service personnel
-- 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",
"models/humans/group01/female_07.mdl"
});
end
[/code]
And the template (If you need it): [code]PLUGIN.Name = "Black Mesa Team Templates"; -- What is the pugin name
PLUGIN.Author = "PetruZ"; -- Author of the plugin
PLUGIN.Description = "A collection of team making functions."; -- The description or purpose of the plugin
function PLUGIN.Init( )
end
function CombineDeath(ply)
util.PrecacheSound( "npc/metropolice/die2.wav" );
util.PrecacheSound( "npc/overwatch/radiovoice/lostbiosignalforunit.wav" );
ply:EmitSound( "npc/metropolice/die2.wav" );
local function EmitThatShit()
ply:EmitSound("npc/overwatch/radiovoice/lostbiosignalforunit.wav");
end
timer.Simple(3, EmitThatShit);
end
function CAKE.BmrpTeam(name, color, model_path, default_model, partial_model, weapons, flag_key, door_groups, radio_groups, sound_groups, item_groups, salary, public, business, broadcast, iscombine)
local team = CAKE.TeamObject();
team.name = CAKE.NilFix(name, "Visitor");
team.color = CAKE.NilFix(color, Color(0, 255, 0, 255));
team.model_path = CAKE.NilFix(model_path, "");
team.default_model = CAKE.NilFix(default_model, false);
team.partial_model = CAKE.NilFix(partial_model, false);
team.weapons = CAKE.NilFix(weapons, {});
team.flag_key = CAKE.NilFix(flag_key, "visitor");
team.door_groups = CAKE.NilFix(door_groups, { });
team.radio_groups = CAKE.NilFix(radio_groups, { });
team.sound_groups = CAKE.NilFix(sound_groups, { 1 });
team.item_groups = CAKE.NilFix(item_groups, { });
team.salary = CAKE.NilFix(salary, 25);
team.public = CAKE.NilFix(public, true);
team.business = CAKE.NilFix(business, false);
team.broadcast = CAKE.NilFix(broadcast, false);
team.iscombine = CAKE.NilFix(iscombine, false);
if(team.iscombine == true) then
CAKE.AddTeamHook("PlayerDeath", team.flag_key .. "_combinedeath", CombineDeath, team.flag_key);
end
return team;
end
[/code]
[QUOTE=Killer_Steel;21734316]garrysmod/models is where they should go.
Unless they come out in a models folder, in which case it goes in your root garrysmod folder, meaning the second one, or the one after orangebox if you are running a server from XenonServers and are using an FTP client.[/QUOTE]
Installing these files does not fix the problem for me. Sorry to bump a REALLY old thread, but I need help.
[QUOTE=CampisGrinde;31911685]Installing these files does not fix the problem for me. Sorry to bump a REALLY old thread, but I need help.[/QUOTE]
[url]http://www.garrysmod.org/downloads/?a=view&id=121800[/url]
Hello everybody, I have this error in multiplayer: [gamemodes\cakescriptg2\gamemode\player_util.lua:180] attempt to index field '?' (a nil value)
I can't fix it! Can someone help me please? Thanks!
Sorry, you need to Log In to post a reply to this thread.