Check if there are mobs alive
#15
Currently your code does nothing. You declare two local functions, but never use them.
Also, don't compare boolean vars to constants, use them directly.
And last but not least, the code won't do what you want - supposing you fix everything, the first function will count all the *living* mobs.

function HandleCheckCommand(Player)
    local CountIfMob = function(Entity)
        if Entity:IsMob() then
              Mobs = Mobs + 1;
        end
    end

    Player:GetWorld():ForEachEntity(CountIfMob);
 
    Player:SendMessage("There are currently " .. Mobs .. " mobs." );

    return true;
end
Reply
Thanks given by:


Messages In This Thread
Check if there are mobs alive - by tonibm19 - 05-06-2013, 09:28 PM
RE: Check if there are mobs alive - by NiLSPACE - 05-06-2013, 09:30 PM
RE: Check if there are mobs alive - by tonibm19 - 05-06-2013, 09:33 PM
RE: Check if there are mobs alive - by xoft - 05-06-2013, 09:38 PM
RE: Check if there are mobs alive - by NiLSPACE - 05-06-2013, 09:38 PM
RE: Check if there are mobs alive - by tonibm19 - 05-06-2013, 09:42 PM
RE: Check if there are mobs alive - by tonibm19 - 05-07-2013, 12:00 AM
RE: Check if there are mobs alive - by NiLSPACE - 05-06-2013, 09:45 PM
RE: Check if there are mobs alive - by NiLSPACE - 05-07-2013, 12:03 AM
RE: Check if there are mobs alive - by tonibm19 - 05-07-2013, 02:30 AM
RE: Check if there are mobs alive - by NiLSPACE - 05-07-2013, 02:39 AM
RE: Check if there are mobs alive - by xoft - 05-07-2013, 02:41 AM
RE: Check if there are mobs alive - by tonibm19 - 05-07-2013, 04:51 AM
RE: Check if there are mobs alive - by NiLSPACE - 05-07-2013, 05:03 AM
RE: Check if there are mobs alive - by xoft - 05-07-2013, 05:44 AM
RE: Check if there are mobs alive - by tonibm19 - 05-07-2013, 06:36 AM
RE: Check if there are mobs alive - by tonibm19 - 05-08-2013, 05:26 AM
RE: Check if there are mobs alive - by xoft - 05-08-2013, 05:31 AM
RE: Check if there are mobs alive - by tonibm19 - 05-08-2013, 05:34 AM
RE: Check if there are mobs alive - by xoft - 05-08-2013, 06:13 AM
RE: Check if there are mobs alive - by tonibm19 - 05-08-2013, 06:26 AM
RE: Check if there are mobs alive - by xoft - 05-08-2013, 06:30 AM



Users browsing this thread: 15 Guest(s)