Item problems
#1
in the part where you type in /i or /item number or a name is messing up, i might have messed something up but i cant find it and it helps when some one else looks it over Thanks in advance!!!

Quote:function HandleItemCommand( Split, Player )
if( #Split ~= 2 and #Split ~=3 ) then
Player:SendMessage( cChatColor.Green .. "Usage: /item [ItemID/Name] <Amount>" )
return true
end

foundItem = false

ItemID = tonumber( Split[2] )
if( ItemID == nil or not isValidItem( ItemID ) ) then
-- nothing
else
foundItem = true
end

if not foundItem then
if ( HAVE_ITEM_NAMES == true ) then
itemValue = itemsINI:GetValue('Items', ''..Split[2]..'', 0)
if itemValue ~= 0 then
ItemID = itemValue
if( ItemID == nil or not isValidItem( tonumber(itemValue) ) ) then
-- nothing
else
foundItem = true
end
end
end
end

if not foundItem then
Player:SendMessage( cChatColor.Green .. "Invalid Item ID / Name !" )
return true
end

local Amount = 1
if( #Split == 3 ) then
Amount = tonumber( Split[3] )
if( Amount == nil or Amount < 1 or Amount > 512 ) then
Player:SendMessage( cChatColor.Green .. "Invalid Amount !" )
return true
end
end

local NewItem = cItem( ItemID, Amount )
if( Player:GetInventory():AddItem( NewItem ) == true ) then
Player:SendMessage( cChatColor.Green .. "There you go !" )
LOG("Gave " .. Player:GetName() .. " " .. Amount .. " times " .. ItemID )
else
Player:SendMessage( cChatColor.Green .. "Not enough space in inventory !" )
end
return true
end
BELOW IS THE ERROR!
20:53:59] Entity #35 (cPlayer) at [19 0 13] spawning for player "justin"
[20:53:59] Spawning player "justin" at {309.59, 60.00, 218.83}
[20:54:08] 1. Stack size: 0
[20:54:08] 2. Stack size: 1
[20:54:08] 3. Stack size: 2
[20:54:08] Calling bound function!Big Grin
[20:54:08] -- Plugins/Core.lua:359: attempt to call global 'isValidItem' (a nil value)
[20:54:08] error. Stack size: 0
[20:54:21] 1. Stack size: 0
[20:54:21] 2. Stack size: 1
[20:54:21] 3. Stack size: 2
[20:54:21] Calling bound function!Big Grin
[20:54:21] -- Plugins/Core.lua:348: attempt to call global 'isValidItem' (a nil value)
[20:54:21] error. Stack size: 0
[20:54:24] Received d/c packet from "justin"
[20:54:24] Deleting client "justin"
[20:54:24] ClientHandle at 0468B008 destroyed
[20:54:24] Destroying entity #35
[20:54:24] DESTROY WINDOW
[20:54:24] DESTROY WINDOW
[20:54:24] Deleting entity 35 at pos {309.59, 218.83} ~ [19, 13]; ptr 04231D08
Reply
Thanks given by:


Messages In This Thread
Item problems - by distroyed123 - 03-14-2012, 08:44 AM
RE: Item problems - by FakeTruth - 03-14-2012, 08:52 PM
RE: Item problems - by distroyed123 - 03-15-2012, 02:02 PM
RE: Item problems - by xoft - 03-15-2012, 05:54 PM
RE: Item problems - by FakeTruth - 03-15-2012, 08:18 PM
RE: Item problems - by distroyed123 - 03-16-2012, 10:29 AM
RE: Item problems - by xoft - 03-16-2012, 06:01 PM
RE: Item problems - by distroyed123 - 03-17-2012, 02:13 AM
RE: Item problems - by FakeTruth - 03-17-2012, 02:44 AM
RE: Item problems - by distroyed123 - 03-17-2012, 04:42 AM
RE: Item problems - by xoft - 03-17-2012, 10:54 PM
RE: Item problems - by distroyed123 - 03-18-2012, 09:45 AM



Users browsing this thread: 3 Guest(s)