I have in the database folder items.lua, which contains all of my items.
for example:
[CODE]items["soda1"] = {
name = "Blueberry Soda",
desc = "The finest blueberry soda in the land",
ent = "item_basic",
model = "models/props_junk/PopCan01a.mdl",
use = (function(ply, ent)
if ply:IsValid() then
ply:SetHealth( ply:Health() + 2 )
if ent then
ent:Remove()
end
end
end),
spawn = (function(ply, ent)
ent:SetItemName( "soda" )
end),
skin = 0,
buttonDist = 32,
weight = 395, --g
volume = 355, --ml
}[/CODE]
in databse.lua, is the serverside functions for picking up and dropping items. In the inventoryPickup function, i have a problem:
[CODE]function inventoryPickup( ply )
if ply:databaseGetValue( "total_volume" ) + (I don't know how to get the volume data from the item) <= 5000 then
ply:databaseSetValue( "total_volume", ply:databaseGetValue( "total_volume" ) + (I don't know how to get the volume data from the item))
ply:databaseSetValue( "total_weight", ply:databaseGetValue( "total_weight" ) + (I don't know how to get the weight data from the item))
local trace = {}
trace.start = ply:EyePos()
trace.endpos = trace.start + ply:GetAimVector() * 85
trace.filter = ply
local tr = util.TraceLine(trace)
if (tr.HitWorld) then return end
if !tr.Entity:IsValid() then return end
if tr.Entity:GetNWBool("pickup") then
local item = getItems( tr.Entity:GetNWString( "itemName" ) )
if tr.Entity:GetNWBool("pickup") == nil then
ply:inventoryGiveItem( tr.Entity:GetNWString( "itemName" ), 1 )
tr.Entity:Remove()
else
if tr.Entity:GetNWBool("pickup") then
ply:inventoryGiveItem( tr.Entity:GetNWString( "itemName" ), 1 )
tr.Entity:Remove()
end
end
end
else
ply:PrintMessage( HUD_PRINTTALK, "You don't have enough room in your backpack for that." )
end
end[/CODE]
any help will be greatly appreciated, thanks
I don't rly know how to help you, but I'm gonna help you get help easier.. why?
simple, plz use this to read it and understand it in a more easy way..
[CO DE] (insert that whole config here) [/CO DE]
and ofc no space between "CO" and "DE" just did it because otherwise you couldn't see it since it would act and do its magic..
since this... for example..
[CODE]function GM:PostDrawViewModel( vm, ply, weapon )
if ( weapon.UseHands || !weapon:IsScripted() ) then
local hands = LocalPlayer():GetHands()
if ( IsValid( hands ) ) then hands:DrawModel() end
end
end[/CODE]
is way easier to read..
than this..
function GM:PostDrawViewModel( vm, ply, weapon )
if ( weapon.UseHands || !weapon:IsScripted() ) then
local hands = LocalPlayer():GetHands()
if ( IsValid( hands ) ) then hands:DrawModel() end
end
end
[QUOTE=NuKeRGG;46729008]I don't rly know how to help you, but I'm gonna help you get help easier.. why?
simple, plz use this to read it and understand it in a more easy way..
[CO DE] (insert that whole config here) [/CO DE]
and ofc no space between "CO" and "DE" just did it because otherwise you couldn't see it since it would act and do its magic..
since this... for example..
[CODE]function GM:PostDrawViewModel( vm, ply, weapon )
if ( weapon.UseHands || !weapon:IsScripted() ) then
local hands = LocalPlayer():GetHands()
if ( IsValid( hands ) ) then hands:DrawModel() end
end
end[/CODE]
is way easier to read..
than this..
function GM:PostDrawViewModel( vm, ply, weapon )
if ( weapon.UseHands || !weapon:IsScripted() ) then
local hands = LocalPlayer():GetHands()
if ( IsValid( hands ) ) then hands:DrawModel() end
end
end[/QUOTE]
thanks, i changed it
[QUOTE=franklesby;46728843]-snip-[/QUOTE]
Could you post the errors your getting?
[QUOTE=Apple_Bloom;46729114]Could you post the errors your getting?[/QUOTE]
im not really getting any errors, im just not sure how to get the volume value from whatever item is being picked up into the (I don't know how to get the volume data from the item) section
the only error im getting is missing variable error
Sorry, you need to Log In to post a reply to this thread.