CakeScript G2

[release]CakeScript G2 1.0.3

Last Update: June 14, 2008

Latest Updates:
[ul]Permaflag[/ul]
[ul]New GUI[/ul]

http://www.garrysmod.org/img/dl/41551_1.jpg

Download:
http://www.garrysmod.org/img/?t=dll&id=41551

[/release][release]Requirements:
• Half a brain

• Basic LUA Knowledge (Not too much needed)

• Global schema must always be loaded

• Malawar’s Tools NOT installed on server/client.
[/release][release]Upcoming Features:
• Bug fixing
[/release][release]Images:
Getting some
[/release][release]
FAQ:

Q: My Garry’s Mod freaks out when I first spawn!
A: Still not sure why this happens, but in previous experiences apparently Malawar’s Tools was doing it. If you experience this, please post screenshots and any LUA errors you find in your console.
**Q: Where is the documentation? **
A: I’m creating a wiki.
**Q: How easy is this to use? **
A: Let’s just say for something that takes a month in TacoScript to make and massive gamemode modifications, you can make in CakeScript in under an hour without any gamemode modifications.
**Q: Does this conflict with anything? **
A: Malawars tools (clientside), ULX sometimes conflicts (apparently the CID), still figuring out other things.
Q: Animations are screwed up!
A: Extract “source 2007 shared models.gcf” and upload/copy everything to your server.
[/release]
[release]
How to make a Team
Teams are relatively easy to make, but you need to first make your own schema (Unless you are running an HL2RP server).

To make a schema, you need a schema definition file (schemas/myrp.lua), a schema folder, (schemas/myrp/), and a plugins and items folder inside of the schema folder.

Here is a basic schema definition file.
[lua]
SCHEMA.Name = “My Awesome RP”;
SCHEMA.Description = “Omg!! My first RP schema!”;
SCHEMA.Author = “LuaNoob”;
SCHEMA.Base = “global”;

function SCHEMA.SetUp()

-- Team Initialization Functions Go Here

end
[/lua]

For an easier way to make teams, I’d suggest you make team ‘templates’.
You can find an example set of templates in the hl2rp schema plugin, hl2rp_templates.lua

There are other methods of adding teams which I will cover soon enough, but templates is the easiest way.

Here would be an example template file
[lua]
PLUGIN.Name = “Team Templates”;
PLUGIN.Author = “LuaNoob”;
PLUGIN.Description = “My first template, yay!”;

function PLUGIN.Init()
– Nothing going on in here
end

function CAKE.CitizenTeam(name, color, flag_key, business, public, item_groups, canvote)

local team = CAKE.TeamObject();

team.name = name or "Citizen";
team.color = color or Color(0, 255, 0, 255);
team.flag_key = flag_key or "citizen";
team.business = business or false;
team.public = public or true;
team.item_groups = item_groups or { };

-- This is used for the voteflags plugin. It isn't neccessary but I'm just putting it in here incase you need it
team.canvote = canvote or true;

return team;

end
[/lua]

Now, we would go back into our schema definition file and add these lines.
I’ll make a pharmacist, grocery seller, black market, and regular citizen. (Item groups 1, 2, and 3 respectively, of which I will cover later)
[lua]
CAKE.AddTeam(CAKE.CitizenTeam());
CAKE.AddTeam(CAKE.CitizenTeam(“Pharmacist”, Color(255, 0, 0, 255), “pharmacist”, true, true, { 1 }, false));
CAKE.AddTeam(CAKE.CitizenTeam(“Grocery Seller”, Color(0, 0, 255, 255), “grocery”, true, true, { 2 }, false));
CAKE.AddTeam(CAKE.CitizenTeam(“Gun Dealer”, Color(255, 255, 0, 255), “gundealer”, true, false, { 3 }, true));
[/lua]
Please note, the FIRST team that is added will be the default team.

Now we need to add selectable player models (for character creation).
Here is every single citizen model.
[lua]
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/group02/male_01.mdl”,
“models/humans/group02/male_02.mdl”,
“models/humans/group02/male_03.mdl”,
“models/humans/group02/male_04.mdl”,
“models/humans/group02/male_06.mdl”,
“models/humans/group02/male_07.mdl”,
“models/humans/group02/male_08.mdl”,
“models/humans/group02/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”,
“models/humans/group02/female_01.mdl”,
“models/humans/group02/female_02.mdl”,
“models/humans/group02/female_03.mdl”,
“models/humans/group02/female_04.mdl”,
“models/humans/group02/female_06.mdl”,
“models/humans/group02/female_07.mdl”
});
[/lua]
Please note, ALL models must be in lowercase.
You’ll need to add the models to the animations.lua file later if you want them to be animated. (Citizen models are already added, as well as NPC models)

Now, items are pretty simple and straightforward. Here is an example item.
[lua]
ITEM.Name = “Watermelon”;
ITEM.Class = “watermelon”; – Classname, if this is a weapon it should be the weapon’s classname so you can use rp_dropweapon
ITEM.Description = “A ripe juicy watermelon”;
ITEM.Model = “models/props_junk/watermelon01.mdl”;
ITEM.Purchaseable = true;
ITEM.Price = 3;
ITEM.ItemGroup = 2; – Our grocery seller, remember?

function ITEM:Drop(ply)

-- What happens when the player drops the item

end

function ITEM:Pickup(ply)

-- What happens when the player picks up the item
self:Remove();

end

function ITEM:UseItem(ply)

-- What happens when the player uses the item (TAB + RightClick)
ply:ConCommand("say /me eats a watermelon.");
self:Remove();

end
[/lua]
Just put that in schemas/myrp/items/! The lua file MUST be the same name as the classname.

You can always find the latest team table structure in teams.lua under the TeamObject function.
[/release]

Thanks to bios element for helping me here and there, as well as the community owners that run my script. :smiley:

Sweet Jesus it’s released! Now I need to figure out how to use CakeScriptG2.

At first I was like :geno:
Then I lol’d :v:

I like cake. I Download now

Cake I like download I now.

This is pretty much sexy. I look forward to seeing this on some hot servers.

At first I lol’d :v:
Then I was like :geno:

I really enjoyed beta testing this. :excited:

Woah It really is you I was all thinking you were an impostor of sorts coming to steal my soul.

:argh:

If your having a bug with items touching a door and spamming



Error: Function (Touch) not found! on Scripted Entity (item_prop)
Error: Function (EndTouch) not found! on Scripted Entity (item_prop)


in console, go to CakeScriptG2\entities\entities\item_prop\cl_init.lua and add this code.



function ENT:Touch( hitEnt )
   
end


how’s about screenshots of it?

I can’t make myself admin to become civil protection

Add your STEAMID to the SuperAdmins table, or Admins… either way.

(of which is in admins.lua)

Downloaded,

Is there an SVN for it?

Nope.

No pictures or what’s new on this release?

I need to decide if I should update or not.

Oh shit,

it’s released.

AWESOME
But shit, I have to remake all my old plugins, SSTRP is temporarily dead.

-snip-