Check if there are mobs alive
#11
no each entity in the server has a unique ID. that way you can separate them.
Reply
Thanks given by:
#12
Yes. A number that uniquely identifies the mob throughout its life. It's used for networking and it's also used if you need to "remember" an entity between different callbacks in the plugin (you cannot store the entity object!)
Reply
Thanks given by:
#13
What's wrong with this?
function HandleCheckCommand( Player )
	local EachEntity = function( Entity )
		if Entity:IsMob() == true then
		       Mobs = Mobs + 1
              end
       end

       local loopPlayer = function ( Player )
              Player:SendMessage( "Killed " .. Mobs .. " mobs." )
              return true
       end
end
It gives me Unknown command
Reply
Thanks given by:
#14
do "return true" before the last end
Reply
Thanks given by:
#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:
#16
(05-07-2013, 05:44 AM)xoft Wrote: the code won't do what you want - supposing you fix everything, the first function will count all the *living* mobs.
I know it, to kill all mobs is Entity:Destroy()
Reply
Thanks given by:
#17
It gives me an error with GetWorld
Reply
Thanks given by:
#18
It's brokenTongue
Reply
Thanks given by:
#19
(05-08-2013, 05:31 AM)xoft Wrote: It's brokenTongue
GetWorld?
With other plugins work
Reply
Thanks given by:
#20
What else can I tell you? You didn't say what the error was, you didn't post your code, nothing. So there's really nothing else I can say.
Reply
Thanks given by:




Users browsing this thread: 8 Guest(s)