Easy to run and easy to work with, very good for mere mortals/people new to lua.
Gr...question.
How do I edit the help menu?I've gone to "cl_playermenu" and added lines with quotes,below the old one and ended the string with "}" yet I still get errors.
Pretty sure Cakescript is bugged.
Yes, I seem to get this error:
[lua]ERROR: GAMEMODE:'ScoreboardShow' Failed: CakeScriptG2\gamemode\cl_binds.lua:38: attempt to index global 'HiddenButton' (a nil value)
ERROR: GAMEMODE:'ScoreboardHide' Failed: CakeScriptG2\gamemode\cl_binds.lua:46: attempt to index global 'HiddenButton' (a nil value)[/lua]
Hey guys. Recently I picked up Cakescript and wanted to make a Stalker: Clear Sky RP. (Yes I Know of the Other Script) Anyways, so far, so good. The only problems I'm having right now is that the [i]rp_givemoney[/i] commands are broke for some reason.
I get an error in console, when trying to give money. The same goes with Weapon Dropping, which I know was so violently argued about earlier.
Anyways, here's the code snippet from the document.
[lua]function ccGiveMoney( ply, cmd, args )
if( player.GetByID( args[ 1 ] ) != nil ) then
local target = player.GetByID( args[ 1 ] );
if( tonumber( args[ 2 ] ) > 0 ) then
if( tonumber( CAKE.GetCharField( ply, "money" ) ) >= tonumber( args[ 2 ] ) ) then
CAKE.ChangeMoney( target, args[ 2 ] );
CAKE.ChangeMoney( ply, 0 - args[ 2 ] );
CAKE.SendChat( ply, "You gave " .. target:Nick( ) .. " " .. args[ 2 ] .. " chitz!" );
CAKE.SendChat( target, ply:Nick( ) .. " gave you " .. args[ 2 ] .. " chitz" );
else
CAKE.SendChat( ply, "You do not have that many chitz!" );
end
else
CAKE.SendChat( ply, "Invalid amount of chitz" );
end
else
CAKE.SendChat( ply, "Target not found!" );
end
end
concommand.Add( "rp_givemoney", ccGiveMoney );
function ccOpenChat( ply, cmd, args )
ply:SetNWInt( "chatopen", 1 )
end
concommand.Add( "rp_openedchat", ccOpenChat );
function ccCloseChat( ply, cmd, args )
ply:SetNWInt( "chatopen", 0 )
end
concommand.Add( "rp_closedchat", ccCloseChat );[/lua]
I haven't changed any of the coding by the way. Only the messages it says when you do not have enough money. (I beta'd yesterday and got this error)
May i ask what the error is?
[lua]-------------------------------
-- CakeScript Generation 2
-- Author: LuaBanana ( Aka Jake )
-- Project Start: 5/24/2008
--
-- concmd.lua
-- Contains the concommands and changes the way other concommands work.
-------------------------------
-- Deprecated, PlayerGiveSwep does the same thing.
-- function NoSweps( ply, cmd, args )
--
-- if( ply:IsSuperAdmin( ) ) then ply:Give( args[ 1 ] ); else return false; end
--
-- end
-- concommand.Add( "gm_giveswep", NoSweps );
function GM:PlayerSpawnSWEP( ply, class )
CAKE.CallTeamHook( "PlayerSpawnSWEP", ply, class ); -- Perhaps allow certain flags to use sweps, eh?
if( ply:IsSuperAdmin( ) ) then return true; end
return false;
end
function GM:PlayerGiveSWEP( ply )
CAKE.CallTeamHook( "PlayerGiveSWEP", ply, class ); -- Perhaps allow certain flags to use sweps, eh?
if( ply:IsSuperAdmin( ) ) then return true; end
return false;
end
-- This is the F1 menu
function GM:ShowHelp( ply )
local PlyCharTable = CAKE.PlayerData[ CAKE.FormatSteamID( ply:SteamID() ) ]["characters"]
for k, v in pairs( PlyCharTable ) do
umsg.Start( "ReceiveChar", ply );
umsg.Long( k );
umsg.String( v[ "name" ] );
umsg.String( v[ "model" ] );
umsg.End( );
end
umsg.Start( "playermenu", ply );
umsg.End( )
end
-- NO SENT FOR YOU.
function GM:PlayerSpawnSENT( ply, class )
CAKE.CallTeamHook( "PlayerSpawnSWEP", ply, class ); -- Perhaps allow certain flags to use sents, eh?
if( ply:IsSuperAdmin( ) ) then return true; end
return false;
end
-- Disallows suicide
function GM:CanPlayerSuicide( ply )
if( CAKE.ConVars[ "SuicideEnabled" ] != "1" ) then
ply:ChatPrint( "Suicide is disabled!" )
return false
end
return true;
end
-- Set Title
function ccSetTitle( ply, cmd, args )
local title = args[ 1 ];
if( string.len( title ) > 33 ) then
CAKE.SendChat( ply, "Title is too long! Max 32 characters" );
return;
end
function ChangeTitle( ply, title )
ply:ConCommand( "rp_title ".. title );
return "";
end
CAKE.ChatCommand( "/title", ChangeTitle );
CAKE.SetCharField( ply, "title", title );
ply:SetNWString("title", title);
return;
end
concommand.Add( "rp_title", ccSetTitle );
-- Change IC Name
function ccChangeName( ply, cmd, args )
local name = args[ 1 ];
CAKE.SetCharField(ply, "name", name );
ply:SetNWString("name", name);
end
concommand.Add( "rp_changename", ccChangeName );
-- Allows a player to skip the respawn timer.
function ccAcceptDeath( ply, cmd, args )
ply.deathtime = 120;
end
concommand.Add( "rp_acceptdeath", ccAcceptDeath );
function ccFlag( ply, cmd, args )
local FlagTo = "";
for k, v in pairs( CAKE.Teams ) do
if( v[ "flag_key" ] == args[ 1 ] ) then
FlagTo = v;
FlagTo.n = k;
break;
end
end
if( FlagTo == "" ) then
CAKE.SendChat( ply, "Incorrect Flag!" );
return;
end
if( ( CAKE.GetCharField(ply, "flags" ) != nil and table.HasValue( CAKE.GetCharField( ply, "flags" ), args[ 1 ] ) ) or FlagTo[ "public" ] ) then
ply:SetTeam( FlagTo.n );
ply:RefreshBusiness();
ply:Spawn( );
return;
else
CAKE.SendChat( ply, "You do not have this flag!" );
end
end
concommand.Add( "rp_flag", ccFlag );
function ccLockDoor( ply, cmd, args )
local entity = ents.GetByIndex( tonumber( args[ 1 ] ) );
if( CAKE.IsDoor( entity ) ) then
if( entity.owner == ply ) then
entity:Fire( "lock", "", 0 );
else
CAKE.SendChat( ply, "This is not your door!" );
end
end
end
concommand.Add( "rp_lockdoor", ccLockDoor );
function ccUnLockDoor( ply, cmd, args )
local entity = ents.GetByIndex( tonumber( args[ 1 ] ) );
if( CAKE.IsDoor( entity ) ) then
if( entity.owner == ply ) then
entity:Fire( "unlock", "", 0 );
else
CAKE.SendChat( ply, "This is not your door!" );
end
end
end
concommand.Add( "rp_unlockdoor", ccUnLockDoor );
function ccOpenDoor( ply, cmd, args )
local entity = ply:GetEyeTrace( ).Entity;
if( entity != nil and entity:IsValid( ) and CAKE.IsDoor( entity ) and ply:GetPos( ):Distance( entity:GetPos( ) ) < 200 ) then
local pos = entity:GetPos( );
for k, v in pairs( CAKE.Doors ) do
if( tonumber( v[ "x" ] ) == math.ceil( tonumber( pos.x ) ) and tonumber( v[ "y" ] ) == math.ceil( tonumber( pos.y ) ) and tonumber( v[ "z" ] ) == math.ceil( tonumber( pos.z ) ) ) then
for k2, v2 in pairs( CAKE.Teams[ ply:Team( ) ][ "door_groups" ] ) do
if( tonumber( v[ "group" ] ) == tonumber( v2 ) ) then
entity:Fire( "toggle", "", 0 );
end
end
end
end
end
end
concommand.Add( "rp_opendoor", ccOpenDoor );
function ccPurchaseDoor( ply, cmd, args )
local door = ents.GetByIndex( tonumber( args[ 1 ] ) );
local pos = door:GetPos( );
for k, v in pairs( CAKE.Doors ) do
if( tonumber( v[ "x" ] ) == math.ceil( tonumber( pos.x ) ) and tonumber( v[ "y" ] ) == math.ceil( tonumber( pos.y ) ) and tonumber( v[ "z" ] ) == math.ceil( tonumber( pos.z ) ) ) then
CAKE.SendChat( ply, "This is not a purchaseable door!" );
return;
end
end
if( CAKE.IsDoor( door ) ) then
if( door.owner == nil ) then
if( tonumber( CAKE.GetCharField( ply, "money" ) ) >= 50 ) then
-- Enough money to start off, let's start the rental.
CAKE.ChangeMoney( ply, -50 );
door.owner = ply;
local function Rental( ply, doornum )
local door = ents.GetByIndex( tonumber( doornum ) );
if( door.owner == ply ) then
if( tonumber( CAKE.GetCharField( ply, "money" ) ) >= 50 ) then
CAKE.ChangeMoney( ply, 0 - 50 );
CAKE.SendChat( ply, "You have been charged 50 credits for a door!" );
-- Start the timer again
timer.Simple( 900, Rental, ply, doornum ); -- 15 minutes hoo rah
else
CAKE.SendChat( ply, "You have lost a door due to insufficient funds." );
door.owner = nil;
end
end
end
timer.Simple( 900, Rental, ply, tonumber( args[ 1 ] ) );
end
elseif( door.owner == ply ) then
door.owner = nil;
CAKE.SendChat( ply, "Door Unowned" );
else
CAKE.SendChat( ply, "This door is already rented by someone else!" );
end
end
end
concommand.Add( "rp_purchasedoor", ccPurchaseDoor );
function ccDropWeapon( ply, cmd, args )
local wep = ply:GetActiveWeapon( )
if( ItemData[ wep:GetClass( ) ] == nil ) then CAKE.SendChat( ply, "This weapon cannot be dropped!" ); return; end
ply:StripWeapon( wep:GetClass( ) );
CAKE.CreateItem( wep:GetClass( ), ply:CalcDrop( ), Angle( 0,0,0 ) );
end
concommand.Add( "rp_dropweapon", ccDropWeapon );
function ccPickupItem( ply, cmd, args )
local item = ents.GetByIndex( tonumber( args[ 1 ] ) );
if( item != nil and item:IsValid( ) and item:GetClass( ) == "item_prop" and item:GetPos( ):Distance( ply:GetShootPos( ) ) < 100 ) then
item:Pickup( ply );
ply:GiveItem( item.Class );
end
end
concommand.Add( "rp_pickup", ccPickupItem );
function ccUseItem( ply, cmd, args )
local item = ents.GetByIndex( tonumber( args[ 1 ] ) );
if( ply:GetNWInt( "tiedup" ) == 1 ) then return false; end
if( item != nil and item:IsValid( ) and item:GetClass( ) == "item_prop" and item:GetPos( ):Distance( ply:GetShootPos( ) ) < 100 ) then
item:UseItem( ply );
end
end
concommand.Add( "rp_useitem", ccUseItem );
function ccGiveMoney( ply, cmd, args )
if( player.GetByID( args[ 1 ] ) != nil ) then
local target = player.GetByID( args[ 1 ] );
if( tonumber( args[ 2 ] ) > 0 ) then
if( tonumber( CAKE.GetCharField( ply, "money" ) ) >= tonumber( args[ 2 ] ) ) then
CAKE.ChangeMoney( target, args[ 2 ] );
I can't tell what line 355 is because the lua tags are blockiong half of each number..
[QUOTE=Averice]I can't tell what line 355 is because the lua tags are blockiong half of each number..[/QUOTE]
if( tonumber( args[ 2 ] ) > 0 ) then
That's line 355.
when is next release I'm dying here, current is old and i need a new one!
I've got a problem, when I use my server hosted my art of war, with cakescript all the citizens/models that players are seem to cower when they have a weapon out. Could anyone tell me how to fix this? It doesn't happen when I host a listen server though.
I was wondering if there's any way to set a limit to amount of people alowd for one group. all my groups are public like Cider. And want to set limits.
How do I set flags? You need to put better lines in the Help menu....
[QUOTE=Bredirish123]if( tonumber( args[ 2 ] ) > 0 ) then
That's line 355.[/QUOTE]
You didn't change the CharacterField "Money" to "Chitz" did you? because that would explain your error because of this:
[lua]
if( tonumber( CAKE.GetCharField( ply, "money" ) ) >= tonumber( args[ 2 ] ) ) then
[/lua]
ok ya sorry but where would I put this in becuse when i just extract it in to garrysmod/garrysmod nothing happenss. AND/OR how do i get it started if thats how you do it?
[b]Edit:[/b]
where do i pput this. when I put it into garrysmod/garrysmod it did not work. and if so that's the right place to put it how would i get it runing?
doghunter,
Put it in garrysmod/garrysmon/gamemodes
I added doors to the combine door group (1), I made sure that the team's door was set 1 one, and I still can't unlock/open it.
Shooping woop.
CakeScript G3 is under official non-stop development in my free time (Eh, 2-3 hours a day, all day on weekends).
CakeScript G3 is also now known as Janork to remove any confusion, and it will have the option of either MySQL based or text-based data storage.
One of my fun facts:
Items can have parameters that save. That's right. :3:
Are you Nori?!
Yes I am Nori. :excited:
Yay, Nori has returned.
I never left. :excited:
How do flags work? Because there's no known way to set them.
vgui/dmodelpanel.lua:69: bad argument #1 to 'ClientsideModel' (string expected, got nil) is not a valid model!
Any help with that one? i am the only one that gets it any i am pretty sure i don't have malawar tools...
Type rp_admin help to see admin commands.
Well, may i ask when is the G3 done? Or have i missed something?
Can anybody tell me why this is happening?
[IMG]http://img520.imageshack.us/img520/9359/anibugmz4.jpg[/IMG]
g3 better not be dead. Also, the fuck?
Hi guys, I'm new to Lua and any other scripting. I thought this would be a great gamemode to start learning, but yesterday I ran into a... annoying issue. I started making flags, most of em worked. But then after editing the flags this came up. (NOTE: I didn't install any addons before editing them so that can't be the issue)
[code]ERROR: GAMEMODE:'ShowHelp' Failed: CakeScriptG2\gamemode\concmd.lua:39: attempt to index field '?' (a nil value)
ERROR: GAMEMODE:'ScoreboardShow' Failed: CakeScriptG2\gamemode\cl_binds.lua:38: attempt to index global 'HiddenButton' (a nil value)[/code]
I hope you guys can help me.
EDIT: Oh yea, before I forget, Advanced Duplicator doesn't work...
Another edit: Well, I managed to fix it, both Advanced Duplicator and the menu. Thanks for the awesome game mode!
It seems very nice, but almost all the default flags don't have public access how do i give them public access?
[QUOTE=Dakarun]
Another edit: Well, I managed to fix it, both Advanced Duplicator and the menu. Thanks for the awesome game mode![/QUOTE]
I've got the same problem, Does anyone know how to fix the [quote]
ERROR: GAMEMODE:'ShowHelp' Failed: CakeScriptG2\gamemode\concmd.lua:39: attempt to index field '?' (a nil value)
ERROR: GAMEMODE:'ScoreboardShow' Failed: CakeScriptG2\gamemode\cl_binds.lua:38: attempt to index global 'HiddenButton' (a nil value)
[/quote]
problem?
EDIT: Great, I got that problem worked out, was missing one }, but now my animations are fucked up, whenever a character holds a gun (aside from hands) they start twitching like hell, and they just slide through the ground.
You might have a invalid Items that was a the problem for me.
Sorry, you need to Log In to post a reply to this thread.