• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

(Request) Henchman NPC

Rielx

FOOL
Joined
Aug 23, 2010
Messages
67
Reaction score
1
I need npc, that serves guild leader;

This is how to check if player is guild leader:

local leader = getPlayerNameByGUID(getGlobalStorageValue(20002))
if leader == getCreatureName(cid) then ...

I need when you say to him (prison ''payername') to tp that person to specific location;
even if payer is offline. That is if player's guild id is x...
 
OK, i came up with this script, only thing I'm missing here is that u cant prison players that are offline;

I looked in my lua functions, and i guess the only way to make it is from sql queue, anyone can make me one pls??

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid)                  	 npcHandler:onCreatureAppear(cid)         end
function onCreatureDisappear(cid)            	     npcHandler:onCreatureDisappear(cid)      end
function onCreatureSay(cid, type, msg)               npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                   				 npcHandler:onThink()                     end

function creatureSayCallback(cid, type, msg)
local leader = "Fool" --getPlayerNameByGUID(getGlobalStorageValue(20002))

    if(not npcHandler:isFocused(cid)) then
        return false
    end

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

--------------------MESSAGES------------------------------------------------------------------------------
    if msgcontains(msg, 'prison') then
 talkState[talkUser] = 1
    end
	 if msgcontains(msg, 'boss') then
 talkState[talkUser] = 7
    end
----------------------Prison-------------------------------------------------------
    if talkState[talkUser] == 1 then
	
			if leader == getCreatureName(cid) then
			selfSay('Who would you like to prison?', cid)
			talkState[talkUser] = 2
			else
			selfSay('How dare you giving me the orders? Begone before i call the guards!', cid)
			talkState[talkUser] = 0
			end
    elseif talkState[talkUser] == 2 then
            n = msg
			if getCreatureByName(n) ~= nil then 
			if not(isPlayerPzLocked(getCreatureByName(n))) then
			if getPlayerGuildId(getCreatureByName(n)) == 8 then
			 doPlayerSendTextMessage(getCreatureByName(n),22,"you have been imprisoned by "  ..  leader  ..  "'s  henchman.")
			 selfSay("It's done, "  ..  n  ..  " is behind the bars.", cid)
			 doPlayerSetTown(getCreatureByName(n),4) 
			 doTeleportThing(getCreatureByName(n), {x = 666, y = 850, z = 5}, true)
			 talkState[talkUser] = 0
			 else
			 selfSay("`But boss, that man aint one of ours! ", cid) 
			 talkState[talkUser] = 0
			 end
			 else    
			 selfSay("Ohh, boss, that person has blood on its hands right now. ", cid) 
			 talkState[talkUser] = 0
			end		
			else			
			 selfSay("Sorry boss, can't find that person! ", cid) 
			 talkState[talkUser] = 0
			 end
	 elseif talkState[talkUser] == 7 then
			selfSay("Yes, " ..  leader ..  " is my boss.", cid) 
	 
		   
    end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top