Jump to content

Player is in the same guild quest


Recommended Posts

Hi. I have quest(tp to friend)

quest teleport_to_player begin
	state start begin
		when login begin
			cmdchat("teleport "..q.getcurrentquestindex())
		end
		when button or info begin
		if get_time() < pc.getqf("duration_tp") then
			return
		end	
			sname = getinput("getinput")
			if sname == "" then
				return
			end	

			local u_vid = find_pc_by_name(sname)
			local m_vid = pc.get_vid()
			if u_vid == 0 then
				return
			end
			
			local m_name = pc.name
			local old = pc.select(u_vid)
			local x,y = pc.get_x()*100,pc.get_y()*100
			local is_blocked = pc.getf("teleport_to_player_block", m_name)				
			pc.select(old)
			if u_vid == m_vid then
				return
			end		
			if is_blocked == 1 then
				syschat("Player: "..sname.." blocked tp.")
			else	
				local ok_sign = confirm(u_vid, string.format("Player "..m_name.." wants tp.", pc.name), 30) 
				if ok_sign == CONFIRM_OK then
					pc.setqf("duration_tp",get_time()+1*5*1)
					pc.warp(x,y)		
				end	
			end	
		end
	end
end	
		
		

but i don't know how can i make that players can tp only to players from the same guild. Any ideas? 

Link to comment
Share on other sites

Try that.

local x, y, targetGuild = pc.get_x() * 100, pc.get_y() * 100, pc.get_guild()
			if is_blocked == 1 then
				syschat("Player: "..sname.." blocked tp.")
			elseif pc.get_guild() == 0 then
				syschat("You have to be in a guild.")
			elseif targetGuild == 0 then
				syschat("Player: "..sname.." is not in a guild.")
			elseif targetGuild ~= pc.get_guild() then
				syschat("Player: "..sname.." is not member of same guild as you.")
			else
				[......................]
			end

 

  • Love 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.