• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] Eluna command starting with '/' slash or '.' dot

Status
Not open for further replies.

stfurca

Member
Hi there!

Is there any way to read a command, for example '/teleport' as a command in Eluna?
C++ checks it first and I have no idea how to achieve the goal.

Tried with:
Code:
function SomeCommand(event, player, msg, Type, lang)
if(msg:lower() == "/teleport") then

Thanks!

Edit:

I'm also trying to create a command, that makes an NPC with entry 99999 invisible.

The problem is here, that I can't find any global function that would return the creature by entry.

Is there any way to achieve this?
 

Tommy

Founder
- Thread moved. Look where you are posting next time.

Code:
PLAYER_EVENT_ON_COMMAND                 =     42,       // (event, player, command)
:RegisterPlayerEvent

Event 42 as seen above allows you to create a command. There's no need for any special characters as "." will work by default.

Code:
local function OnCommand(event, player, command)
    if (command:find("test") == 1) then
        -- Do stuff
    end
end

RegisterPlayerEvent(42, OnCommand)

As for trying to get a creature by entry (possibly nearest creature) you can use :GetNearestCreature

Eluna API is a thing.
 

Tommy

Founder
I merged your new thread you made with this one, however, IT IS IN THE WRONG SECTION AGAIN.

Eluna Lua Engine © -> Lua IS A RELEASE section, not a support section. READ.
 

stfurca

Member
Thanks for the first answer, works perfectly!

What about this 'global calling' on a creature?
Is there any way of getting an NPC in code by it's entry?
 
Last edited:

Rochet2

Moderator / Eluna Dev
Thanks for the first answer, works perfectly!

What about this 'global calling' on a creature?
Is there any way of getting an NPC in code by it's entry?

There are several, one or no spawns of the same entry creature in the world. Some spawns exist, but are not "ingame" and some are ingame.
You should try to define where this NPC would be.

Do you mean the player's nearest NPC of given entry?
Maybe take a look at http://eluna.emudevs.com/?search=near
 
Status
Not open for further replies.
Top