Cider car script help someone plzzz help me

hey who ever reads this im really in need of a cider car script because its the only thing i need before i can my clans cider mod server up and running so somone plzz help

Got this script just there is no pickup command:
–[[
Name: “sh_jeep.lua”.
Product: “Cider (Roleplay)”.
–]]

if ( !cider.plugin.get(“Generic”) ) then return; end;

– Define the item table.
local ITEM = {};

– Set some information about the item.
ITEM.name = “911 Turbo Car”;
ITEM.size = 1;
ITEM.cost = 10;
–ITEM.team = TEAM_REBELDEALER;
ITEM.model = “models/sickness/911turbo.mdl”;
ITEM.max = 1;
ITEM.batch = 1;
ITEM.store = true;
ITEM.plural = “Turbo”;
ITEM.uniqueID = “Turbo”;
ITEM.description = “A test car.”;

– Called when a player drops the item.
function ITEM:onDrop(player, position)
local turbo = ents.Create( “prop_vehicle_jeep” ) – Create our jeep
turbo:SetModel(“models/sickness/911turbo.mdl”)
turbo:SetKeyValue(“vehiclescript”, “scripts/vehicles/911.txt”)
turbo:Spawn() – Spawn it.
turbo:Activate() – Activate it.
end;

function ITEM:onUse( player, ent )
local turbo = ents.Create( “prop_vehicle_jeep” ) – Create our jeep
turbo:SetModel(“models/sickness/911turbo.mdl”)
turbo:SetKeyValue(“vehiclescript”, “scripts/vehicles/911.txt”)
turbo:SetPos(player:GetEyeTrace().HitPos + player:GetEyeTrace().HitNormal * 32)
turbo:Spawn() – Spawn it.
turbo:Activate() – Activate it.
end

function ITEM:onPU() end;

– Called when a player destroys the item.
function ITEM:onDestroy(player) end;

– Register the item.
cider.item.register(ITEM);

If anyone can help me add me on this steam user: drgrum

Put the code between [noparse][lua] and [/lua][/noparse]. Also, what exactly are you asking for again?

Do you want to add a pickup command?, if you are try this out.

Add this in your cl_inventory.lua line 156:
[lua]elseif (self.itemFunctions* == “Pickup”) then
self.itemButton*.DoClick = function()
RunConsoleCommand(“cider”, “inventory”, self.item, “pickup”);

cider.menu.toggle();[/lua]

And this on line 103:
[lua]if (cider.item.stored[self.item].onPickup) then table.insert(self.itemFunctions, “Pickup”); end;[/lua]

In your sv_commands.lua line 551:
[lua]elseif (arguments[2] == “pickup”) then
local trace = player:GetEyeTrace();
if player:GetPos():Distance(trace.HitPos) <= 80 and ValidEntity(trace.Entity) then
if trace.Entity:IsVehicle() then
if (trace.Entity:GetNWEntity(“owner”) == player) then
constraint.RemoveAll( trace.Entity )
trace.Entity:SetNotSolid( true )
trace.Entity:SetMoveType( MOVETYPE_NONE )
trace.Entity:SetNoDraw( true )
trace.Entity:Remove( true )
else
cider.player.notify(player, “This car is not yours!”,1)
end
end
else
if trace.Entity:IsVehicle() then
cider.player.notify(player, “You have to be close to your vehicle!”, 1);
end
end;[/lua]

And in your sh_jeep.lua at the bottom:
[lua]function ITEM:onPickup() end;[/lua]

About the lines, they might be wrong.

I just downloaded a brand new cider mod. and not all the lines seems correct…?

This belongs in the Questions subforum. Please read the sticky before posting.

Wich one?

EDIT:

  • cl_inventory.lua line 156 = place it under your other things such as Destroy and Use.
  • And this on line 103 = Place it with the others aswell such as Destroy and Use.
  • sv_commands.lua line 551 = Place it under the Use function.
  • sh_jeep.lua at the bottom = Above ore under your OnDestroy

cl_inventory - line 156 : – Set the position of the name and description.
self.name:SetPos(x, 4);
self.description:SetPos(x, 24);

[editline]6th February 2011[/editline]

You know what… i can try to send you a link for the dl of the gamemode. then you can try to make it work. because i cant.

Do you even have vehicles?, if you could code vehicles but not a pickup command there is something wrong xD. Its really not that hard…

Put the cl_inventory.lua code i have posted under this:

[lua]if (self.itemFunctions* == “Use”) then
self.itemButton*.DoClick = function()
RunConsoleCommand(“cider”, “inventory”, self.item, “use”);
end;[/lua]

Hey sepatrick could I add you on MSN and steam then you could send me the correct script so we worn mess with it more:P ps I’m with techload

Yea that explains it a lot. its on line 120 >:D

[editline]7th February 2011[/editline]

Else you are welcome to take a look at the lua file

[lua]
–[[
Name: “cl_inventory.lua”.
Product: “Cider (Roleplay)”.
–]]

local PANEL = {};

– Called when the panel is initialized.
function PANEL:Init()
self:SetSize(cider.menu.width, cider.menu.height - 8);

-- Create a panel list to store the items.
self.itemsList = vgui.Create("DPanelList", self);
self.itemsList:SizeToContents();
self.itemsList:SetPadding(2);
self.itemsList:SetSpacing(3);
self.itemsList:StretchToParent(4, 4, 12, 44);
self.itemsList:EnableVerticalScrollbar();

-- Set this to true to begin with so that we do one starting update.
cider.inventory.updatePanel = true;

-- We call think just once on initialize so that we can update.
self:Think();

end;

– Called when the layout should be performed.
function PANEL:PerformLayout()
self:StretchToParent(0, 22, 0, 0);
self.itemsList:StretchToParent(0, 0, 0, 0);
end;

– Called every frame.
function PANEL:Think()
if (cider.inventory.updatePanel) then
cider.inventory.updatePanel = false;

	-- Clear the current list of items.
	self.itemsList:Clear();
	self.itemsList:AddItem( vgui.Create("cider_Inventory_Information", self) );
	
	-- Loop through the player's inventory and add the items.
	for k, v in pairs(cider.inventory.stored) do
		self.currentItem = k;
		
		-- Check if this item exists.
		if (cider.item.stored[k]) then
			self.itemsList:AddItem( vgui.Create("cider_Inventory_Item", self) ) ;
		end;
	end;
	
	-- Rebuild the items list.
	self.itemsList:Rebuild();
end;

end;

– Register the panel.
vgui.Register(“cider_Inventory”, PANEL, “Panel”);

– Define a new panel.
local PANEL = {};

– Called when the panel is initialized.
function PANEL:Init()
self.itemFunctions = {};

-- Set the size and position of the panel.
self:SetSize(cider.menu.width, 75);
self:SetPos(1, 5);

-- Set the item that we are.
self.item = self:GetParent().currentItem;

-- Create a label for the name.
self.name = vgui.Create("DLabel", self);
self.name:SetText(cider.inventory.stored[self.item].." "..cider.item.stored[self.item].name.." (Size: "..cider.item.stored[self.item].size..")");
self.name:SizeToContents();
self.name:SetTextColor( Color(255, 255, 255, 255) );

-- Check the amount that the player has.
if (cider.inventory.stored[self.item] &gt; 1) then
	self.name:SetText(cider.inventory.stored[self.item].." "..cider.item.stored[self.item].plural.." (Size: "..cider.item.stored[self.item].size..")");
end;

-- Create a label for the description.
self.description = vgui.Create("DLabel", self); 
self.description:SetText(cider.item.stored[self.item].description);
self.description:SizeToContents();
self.description:SetTextColor( Color(255, 255, 255, 255) );

-- Create the spawn icon.
self.spawnIcon = vgui.Create("SpawnIcon", self);

-- Set the model of the spawn icon to the one of the item.
self.spawnIcon:SetModel(cider.item.stored[self.item].model);
self.spawnIcon:SetToolTip();
self.spawnIcon.DoClick = function() return; end;
self.spawnIcon.OnMousePressed = function() return; end;

-- Check to see if the item has an on use callback.
if (cider.item.stored[self.item].onUse) then table.insert(self.itemFunctions, "Use"); end;
if (cider.item.stored[self.item].onDrop) then table.insert(self.itemFunctions, "Drop"); end;
if (cider.item.stored[self.item].onDestroy) then table.insert(self.itemFunctions, "Destroy All"); end;
if (cider.item.stored[self.item].onPickup) then table.insert(self.itemFunctions, "Pickup"); end;

-- Create the table to store the item buttons.
self.itemButton = {};

-- Loop through the item functions.
for i = 1, #self.itemFunctions do
	if (self.itemFunctions*) then
		self.itemButton* = vgui.Create("DButton", self);
		self.itemButton*:SetText(self.itemFunctions*);
		
		-- Check what type of button it is.
		if (self.itemFunctions* == "Use") then
			self.itemButton*.DoClick = function()
				RunConsoleCommand("cider", "inventory", self.item, "use");
			end;
			end;
		elseif (self.itemFunctions* == "Pickup") then
			self.itemButton*.DoClick = function()
			RunConsoleCommand("cider", "inventory", self.item, "pickup");  
			  
			cider.menu.toggle();

end;
elseif (self.itemFunctions* == “Drop”) then
self.itemButton*.DoClick = function()
RunConsoleCommand(“cider”, “inventory”, self.item, “drop”);

				-- Close the main menu.
				cider.menu.toggle();
			end;
		elseif (self.itemFunctions* == "Destroy All") then
			self.itemButton*.DoClick = function()
				local menu = DermaMenu();
				
				-- Add an option for yes and no.
				menu:AddOption("No", function() end);
				menu:AddOption("Yes", function()
					RunConsoleCommand("cider", "inventory", self.item, "destroy");
				end);
				
				-- Open the menu.
				menu:Open() ;
			end;
		end;
	end;
end;

end;

– Called when the layout should be performed.
function PANEL:PerformLayout()
self.spawnIcon:SetPos(4, 5);
self.name:SizeToContents();
self.description:SetPos(75, 24);
self.description:SizeToContents();

-- Define the x position of the item functions.
local x = self.spawnIcon.x + self.spawnIcon:GetWide() + 8;

-- Set the position of the name and description.
self.name:SetPos(x, 4);
self.description:SetPos(x, 24);

-- Loop through the item functions and set the position of their button.
for i = 1, #self.itemFunctions do
	if (self.itemButton*) then
		self.itemButton*:SetPos(x, 47);
		
		-- Increase the x position for the next item function.
		x = x + self.itemButton*:GetWide() + 4;
	end;
end;

end;

– Register the panel.
vgui.Register(“cider_Inventory_Item”, PANEL, “DPanel”);

– Define a new panel.
local PANEL = {};

– Called when the panel is initialized.
function PANEL:Init()
local maximumSpace = cider.inventory.getMaximumSpace();

-- Create the space used label.
self.spaceUsed = vgui.Create("DLabel", self);
self.spaceUsed:SetText("Space Used: "..cider.inventory.getSize(true).."/"..maximumSpace);
self.spaceUsed:SizeToContents();
self.spaceUsed:SetTextColor( Color(255, 255, 255, 255) );

end;

– Called when the layout should be performed.
function PANEL:PerformLayout()
local maximumSpace = cider.inventory.getMaximumSpace();

-- Set the position of the label.
self.spaceUsed:SetPos( (self:GetWide() / 2) - (self.spaceUsed:GetWide() / 2), 5 );
self.spaceUsed:SetText("Space Used: "..cider.inventory.getSize(true).."/"..maximumSpace);

end;

– Register the panel.
vgui.Register(“cider_Inventory_Information”, PANEL, “DPanel”);
[/lua]

It looks fine, did you add the other things?

Yea i did… i can show you the diffrent files :), but the inventory isnt even showing…

Can you give me the errors?

Sure… i hear you have added druglord over steam?

[editline]7th February 2011[/editline]

[gamemodes\cider\gamemode\core\derma\cl_inventory.lua:150] ´<eof>´ expected near ´end´

Try replace all in your cl_inventory.lua with this:

[lua]–[[
Name: “cl_inventory.lua”.
Product: “Cider (Roleplay)”.
–]]

local PANEL = {};

– Called when the panel is initialized.
function PANEL:Init()
self:SetSize(cider.menu.width, cider.menu.height - 8);

-- Create a panel list to store the items. 
self.itemsList = vgui.Create("DPanelList", self); 
self.itemsList:SizeToContents(); 
self.itemsList:SetPadding(2); 
self.itemsList:SetSpacing(3); 
self.itemsList:StretchToParent(4, 4, 12, 44); 
self.itemsList:EnableVerticalScrollbar(); 
  
-- Set this to true to begin with so that we do one starting update. 
cider.inventory.updatePanel = true; 
  
-- We call think just once on initialize so that we can update. 
self:Think(); 

end;

– Called when the layout should be performed.
function PANEL:PerformLayout()
self:StretchToParent(0, 22, 0, 0);
self.itemsList:StretchToParent(0, 0, 0, 0);
end;

– Called every frame.
function PANEL:Think()
if (cider.inventory.updatePanel) then
cider.inventory.updatePanel = false;

    -- Clear the current list of items. 
    self.itemsList:Clear(); 
    self.itemsList:AddItem( vgui.Create("cider_Inventory_Information", self) ); 
      
    -- Loop through the player's inventory and add the items. 
    for k, v in pairs(cider.inventory.stored) do
        self.currentItem = k; 
          
        -- Check if this item exists. 
        if (cider.item.stored[k]) then
            self.itemsList:AddItem( vgui.Create("cider_Inventory_Item", self) ) ; 
        end; 
    end; 
      
    -- Rebuild the items list. 
    self.itemsList:Rebuild(); 
end; 

end;

– Register the panel.
vgui.Register(“cider_Inventory”, PANEL, “Panel”);

– Define a new panel.
local PANEL = {};

– Called when the panel is initialized.
function PANEL:Init()
self.itemFunctions = {};

-- Set the size and position of the panel. 
self:SetSize(cider.menu.width, 75); 
self:SetPos(1, 5); 
  
-- Set the item that we are. 
self.item = self:GetParent().currentItem; 
  
-- Create a label for the name. 
self.name = vgui.Create("DLabel", self); 
self.name:SetText(cider.inventory.stored[self.item].." "..cider.item.stored[self.item].name.." (Size: "..cider.item.stored[self.item].size..")"); 
self.name:SizeToContents(); 
self.name:SetTextColor( Color(255, 255, 255, 255) ); 
  
-- Check the amount that the player has. 
if (cider.inventory.stored[self.item] &gt; 1) then
    self.name:SetText(cider.inventory.stored[self.item].." "..cider.item.stored[self.item].plural.." (Size: "..cider.item.stored[self.item].size..")"); 
end; 
  
-- Create a label for the description. 
self.description = vgui.Create("DLabel", self);  
self.description:SetText(cider.item.stored[self.item].description); 
self.description:SizeToContents(); 
self.description:SetTextColor( Color(255, 255, 255, 255) ); 
  
-- Create the spawn icon. 
self.spawnIcon = vgui.Create("SpawnIcon", self); 
  
-- Set the model of the spawn icon to the one of the item. 
self.spawnIcon:SetModel(cider.item.stored[self.item].model); 
self.spawnIcon:SetToolTip(); 
self.spawnIcon.DoClick = function() return; end; 
self.spawnIcon.OnMousePressed = function() return; end; 
  
-- Check to see if the item has an on use callback. 
if (cider.item.stored[self.item].onUse) then table.insert(self.itemFunctions, "Use"); end; 
if (cider.item.stored[self.item].onDrop) then table.insert(self.itemFunctions, "Drop"); end; 
if (cider.item.stored[self.item].onPickup) then table.insert(self.itemFunctions, "Pickup"); end;  
if (cider.item.stored[self.item].onDestroy) then table.insert(self.itemFunctions, "Destroy All"); end; 
  
-- Create the table to store the item buttons. 
self.itemButton = {}; 
  
-- Loop through the item functions. 
for i = 1, #self.itemFunctions do
    if (self.itemFunctions*) then
        self.itemButton* = vgui.Create("DButton", self); 
        self.itemButton*:SetText(self.itemFunctions*); 
          
        -- Check what type of button it is. 
        if (self.itemFunctions* == "Use") then
            self.itemButton*.DoClick = function() 
                RunConsoleCommand("cider", "inventory", self.item, "use"); 
            end; 
        elseif (self.itemFunctions* == "Drop") then
            self.itemButton*.DoClick = function() 
                RunConsoleCommand("cider", "inventory", self.item, "drop"); 
                  
                -- Close the main menu. 
                cider.menu.toggle(); 
            end; 
        elseif (self.itemFunctions* == "Destroy All") then
            self.itemButton*.DoClick = function() 
                local menu = DermaMenu(); 
                  
                -- Add an option for yes and no. 
                menu:AddOption("No", function() end); 
                menu:AddOption("Yes", function() 
                    RunConsoleCommand("cider", "inventory", self.item, "destroy"); 
                end); 
                  
                -- Open the menu. 
                menu:Open() ; 
            end;  
        elseif (self.itemFunctions* == "Pickup") then
            self.itemButton*.DoClick = function() 
                RunConsoleCommand("cider", "inventory", self.item, "pickup");   
                -- Close the main menu. 
                cider.menu.toggle(); 
            end; 
        end; 
    end; 
end; 

end;

– Called when the layout should be performed.
function PANEL:PerformLayout()
self.spawnIcon:SetPos(4, 5);
self.name:SizeToContents();
self.description:SetPos(75, 24);
self.description:SizeToContents();

-- Define the x position of the item functions. 
local x = self.spawnIcon.x + self.spawnIcon:GetWide() + 8; 
  
-- Set the position of the name and description. 
self.name:SetPos(x, 4); 
self.description:SetPos(x, 24); 
  
-- Loop through the item functions and set the position of their button. 
for i = 1, #self.itemFunctions do
    if (self.itemButton*) then
        self.itemButton*:SetPos(x, 47); 
          
        -- Increase the x position for the next item function. 
        x = x + self.itemButton*:GetWide() + 4; 
    end; 
end; 

end;

– Register the panel.
vgui.Register(“cider_Inventory_Item”, PANEL, “DPanel”);

– Define a new panel.
local PANEL = {};

– Called when the panel is initialized.
function PANEL:Init()
local maximumSpace = cider.inventory.getMaximumSpace();

-- Create the space used label. 
self.spaceUsed = vgui.Create("DLabel", self); 
self.spaceUsed:SetText("Space Used: "..cider.inventory.getSize(true).."/"..maximumSpace); 
self.spaceUsed:SizeToContents(); 
self.spaceUsed:SetTextColor( Color(255, 255, 255, 255) ); 

end;

– Called when the layout should be performed.
function PANEL:PerformLayout()
local maximumSpace = cider.inventory.getMaximumSpace();

-- Set the position of the label. 
self.spaceUsed:SetPos( (self:GetWide() / 2) - (self.spaceUsed:GetWide() / 2), 5 ); 
self.spaceUsed:SetText("Space Used: "..cider.inventory.getSize(true).."/"..maximumSpace); 

end;

– Register the panel.
vgui.Register(“cider_Inventory_Information”, PANEL, “DPanel”);[/lua]

That should fix the problem.

Just so i am sure, you said put all this in.

In your sv_commands.lua line 551:

[lua]elseif (arguments[2] == “pickup”) then
local trace = player:GetEyeTrace();
if player:GetPos():Distance(trace.HitPos) <= 80 and ValidEntity(trace.Entity) then
if trace.Entity:IsVehicle() then
if (trace.Entity:GetNWEntity(“owner”) == player) then
constraint.RemoveAll( trace.Entity )
trace.Entity:SetNotSolid( true )
trace.Entity:SetMoveType( MOVETYPE_NONE )
trace.Entity:SetNoDraw( true )
trace.Entity:Remove( true )
else
cider.player.notify(player, “This car is not yours!”,1)
end
end
else
if trace.Entity:IsVehicle() then
cider.player.notify(player, “You have to be close to your vehicle!”, 1);
end
end;[/lua]

And this in my sh_jeep.lua at the bottom:

[lua]function ITEM:onPickup() end;[/lua]

And finally replace your whole cl_inventorie. With that code you gave us. I am right, or is this wrong?

  • Because my cider just bugged…

Agreed

Im not gonna make it all for you guys this is not the request section.

the lines are probably wrong since this is from a gamemode i had and i may have changed in it,
but i told you where to put it.

cl_inventorie what are you talking about?. And i can’t help you if you dont give me any errors.
What do you mean by bugged?

EDIT: if you can’t get it to work add me on steam and i will send you the files from my gamemode and they works.

It Tells me; You are stuck Please ‘JUMP’ And no it’s not a sql error. Right after i puttet your code those ‘locations’ you wan’t be to put them in it’s getting bugged.

And i think it is because i’m putting the code wrong in… Please take a look of this.

I putted the code between… [lua] – Use the item.
cider.item.use(player, item)
end;
end;
else
cider.player.notify(player, “You do not own a “…cider.item.stored[item].name…”!”, 1);
end;
end;
else[/lua]
PUTTED THE CODE HERE O.o

And [lua]cider.player.notify(player, “You cannot do that in this state!”, 1);
end;
end, “Commands”, “<item> <destroy|drop|use>”, “Perform an inventory action on an item.”);
[/lua]

EDIT: What’s your steam name, bro?

No thats wrong. put under this end;

[lua] – Use the item.
cider.item.use(player, item)
end;[/lua]

So it would be something like this:

[lua] – Use the item.
cider.item.use(player, item)
end;
elseif (arguments[2] == “pickup”) then
local trace = player:GetEyeTrace();
if player:GetPos():Distance(trace.HitPos) <= 80 and ValidEntity(trace.Entity) then
if trace.Entity:IsVehicle() then
if (trace.Entity:GetNWEntity(“owner”) == player) then
constraint.RemoveAll( trace.Entity )
trace.Entity:SetNotSolid( true )
trace.Entity:SetMoveType( MOVETYPE_NONE )
trace.Entity:SetNoDraw( true )
trace.Entity:Remove( true )
else
cider.player.notify(player, “This car is not yours!”,1)
end
end
else
if trace.Entity:IsVehicle() then
cider.player.notify(player, “You have to be close to your vehicle!”, 1);
end
end;
end;
else
cider.player.notify(player, “You do not own a “…cider.item.stored[item].name…”!”, 1);
end;
end;
else
cider.player.notify(player, “You cannot do that in this state!”, 1);
end;
end, “Commands”, “<item> <destroy|drop|use>”, “Perform an inventory action on an item.”);[/lua]