Spawn Mob problem
#1
Im trying to create a plugin that spawns a mob via command, having downloaded the newest version from the website this is the error message I am receiving and my code.

Code:
Warn [15:45:42] LUA: Plugins/mine/spawnmob.lua:30: error in function 'SpawnMob'.
     argument #-1806946488 is array of '[no object]'; array of 'H‹\$@¸' expected.

Warn [15:45:42] Stack trace:
Warn [15:45:42]   [C](-1): SpawnMob
Warn [15:45:42]   Plugins/mine/spawnmob.lua(30): (no name)
Warn [15:45:42] Stack trace end
Warn [15:45:42] Error in plugin mine calling function <callback>()

function HandleSpawnMobCommand(Split, Player)

	-- Make sure there are a correct number of arguments.
	if ((#Split ~= 2) and (#Split ~=3)) then
		Player:SendMessage("Usage: /spawnmob <mobname> [number]" )
		return true
	end

    -- Mob name as typed in by the player
    local MobName = Split[2]
    -- Mob Type based
    local MobType = cMonster:StringToMobType(Split[2])
    if MobType == -1 then
        Player:SendMessage("Mob " .. MobName .. " not found")
        return true
    end
    if Split[3] ~= nil then
        -- Don\'t allow more then 10 mobs to be spawned at once.
        local ammount = tonumber(Split[3])
        if ammount > 10 then
            Player:SendMessage("Max mob spawn is 10.")
            ammount = 10
        end
        for i=0,ammount do
            Player:GetWorld():SpawnMob(Player:GetPosX(), Player:GetPosY(), Player:GetPosZ(), MobType)
        end
            Player:SendMessage("Spawned " .. ammount .. " " .. MobName .. "s")
        return true
    else
        Player:GetWorld():SpawnMob(Player:GetPosX(), Player:GetPosY(), Player:GetPosZ(), MobType)
        Player:SendMessage("Spawned 1 " .. MobName)
    end
		return true;
end
Reply
Thanks given by:


Messages In This Thread
Spawn Mob problem - by StevasaurousREX - 10-10-2014, 07:06 AM
RE: Spawn Mob problem - by xoft - 10-10-2014, 05:12 PM
RE: Spawn Mob problem - by VeryBlackMan - 12-17-2014, 03:56 AM
RE: Spawn Mob problem - by xoft - 12-17-2014, 04:18 AM
RE: Spawn Mob problem - by Howaner - 12-17-2014, 06:35 AM
RE: Spawn Mob problem - by worktycho - 12-18-2014, 11:02 AM
RE: Spawn Mob problem - by xoft - 12-18-2014, 10:24 PM
RE: Spawn Mob problem - by worktycho - 12-19-2014, 12:40 AM



Users browsing this thread: 1 Guest(s)