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:
#2
It should be IsValidItem with capital I
Reply
Thanks given by:
#3
(03-14-2012, 08:52 PM)FakeTruth Wrote: It should be IsValidItem with capital I
Rofl, thanks but im having another issue now
its not showing players in game and is failing to call the GetAllPlayers function

Code:
[23:51:19] Streaming chunks centered on [26, 13]
[23:51:19] Entity #1 (cPlayer) at [26 0 13] spawning for player "justin"
[23:51:19] Spawning player "justin" at {421.00, 92.60, 214.00}
[23:51:25] 1. Stack size: 0
[23:51:25] 2. Stack size: 1
[23:51:25] 3. Stack size: 2
[23:51:25] Calling bound function! :D
[23:51:25] -- Plugins/Core.lua:283: attempt to call method 'GetAllPlayers' (a nil value)
[23:51:25] error. Stack size: 0
[23:51:53] 1. Stack size: 0
[23:51:53] 2. Stack size: 1
[23:51:53] 3. Stack size: 2
[23:51:53] Calling bound function! :D
[23:51:53] -- Plugins/Core.lua:283: attempt to call method 'GetAllPlayers' (a nil value)
[23:51:53] error. Stack size: 0
[23:52:00] 1. Stack size: 0
[23:52:00] 2. Stack size: 1
[23:52:00] 3. Stack size: 2
[23:52:00] Calling bound function! :D
[23:52:00] ok. Stack size: 0
[23:52:23] Server console command: "say WTF"
[23:52:23] ยง5[SERVER] WTF
[23:52:30] Server console command: "stop"
[23:52:30] Shutting down server...
[23:52:30] <<<<>>>>SIGNALLED SEMAPHORE
[23:52:30] Saving all chunks...
[23:52:30] Deleting client "justin"
[23:52:30] ClientHandle at 06CF03B0 destroyed

Code:
function HandlePlayerListCommand( Split, Player )
    local World = Player:GetWorld()
    local PlayerList = World:GetAllPlayers()

    local Message = cChatColor.Green .. "Connected players: (".. cChatColor.White.. #PlayerList .. cChatColor.Green .. ")"
    Player:SendMessage( Message )

    local PlayerTable = {}
    for i, TempPlayer in ipairs( PlayerList ) do
        local PlayerName = TempPlayer:GetName()
        table.insert(PlayerTable, PlayerName )
    end

    Player:SendMessage( table.concat(PlayerTable, " ") )
    return true
end

now im not sure if that is a reason why its messing up but in game when someone joins it dosnt show them in game or on the list when you press tab, but the server acknowledges them being there and it ticks and what not. if i try to warp them to me, give them something, or teleport to them i cant. it says the player cannot be found, or it just dosnt do anything i turned off all the plugins other than the ones contained within the core.lua by the way thats the segment thats calling the error so far



the map also only generates the beginning area, it dosnt go beyond that it just drops off to nothing
Reply
Thanks given by:
#4
Whoa, slow down, too many problems in a single sentence, how are we to answer to all of them?Tongue

First of all, what revision of MCS are you using?

World::GetAllPlayers() has been deprecated for some time (rev ~250) and is actually not implemented anymore in the recent versions of MCS (since rev 260), simply because it's incompatible with multithreading. You should be using World::ForEachPlayer() with a callback Lua function as a parameter. There should be an example of this in the Core plugin.

Player entities not showing to other players is a known bug and is being worked on.

World not being generated is weird, that hasn't happenned to anyone yet. Can you confirm that it's actually not generating? The server log should contain messages "Generating chunk [X, Z]" if it actually generates the chunks.
Also, there's a new Flat generator that, by default, generates a flat plain very low, aren't you seeing that instead?
Reply
Thanks given by:
#5
You're using a deprecated Core plugin, grab a new one from the repository
Reply
Thanks given by:
#6
yea im sure its not generating the flat, the logs show its not generating as well. when starting up a new mab after deleting the other one it loads the starting area of the spawn and i can do what ever i want in that but the world drops off to nothingness, ie infinite drop off all the way down and then past bedrock. which version of the server is the best to have right now. DL link? and hah i know i havnt been here in a while im trying to get caught up =P so if its out of date im sorry LOL. i think i downloaded the R300 but its SoooO unstable crashes alot.
player seeing player bug dont know if it helps but if player joins>i cant see them they can see me>i relog>i see them standing still(while there moving around and such) i can punch and kill them while there standing still and kill thm while there running around elsewhere and they will die/get hurt.>then if they relog its vise versa


Reply
Thanks given by:
#7
Rev 300 is pretty outdated, we're at rev 415 now. However, there hasn't been a "stable build" since rev 236. We're providing nightly builds for Windows and they mostly work, and mostly better than the last stable, but there are still known (and unknown) problems. Forum thread https://forum.cuberite.org/showthread.php?tid=354 has the nightbuild download link.
Reply
Thanks given by: distroyed123
#8
thanks, Zoft +thanks
In the downloaded .7z the plugins for the core are all separated in the core folder, to i have to combine them all into the main.lua then call the main.lua plugin in the settings, or would it allow me to call them individually?
Reply
Thanks given by:
#9
It's the new plugin style. You put the folder name in the settings.ini now, see the example settings
Reply
Thanks given by:
#10
(03-17-2012, 02:44 AM)FakeTruth Wrote: It's the new plugin style. You put the folder name in the settings.ini now, see the example settings

alright. a thing to note/mention for the future RUN the server with ADMIN rights!! lolzz idk why without it on my machine win7x64 it wount access the folder the plugin are in when in default. when in admin it does.
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)