• Getting Register NPC name
    1 replies, posted
Hello, i'm having trouble in finding a way to know which registered NPC i'm talking with. (Registered in table) Let me explain; I use some NPC on my server, these NPC are registered like : NPC 1 / NPC 2 / NPC 3... Which code should i use to know that i'm talking with NPC 1 for exemple ? I hope you understood what i just said, not easy to explain in english.
Cycle through all the NPCs using a for-loop and if you found a match return it. [code] local t = {"npc2","npc100","npc341","npc231"} for id, npc in pairs(t)do if ( npc == "npc100" ) then -- This is our NPC, do something here end end[/code]
Sorry, you need to Log In to post a reply to this thread.