Jump to content

Recommended Posts

I solved the problem that how to get the vid from player name if the player is on other map.

Its a python-quest communication. 

 

quest:

quest send_vid begin
	state start begin			
		function GetPlayerName()			
			cmdchat("init_getInfo")			
			local name = input(cmdchat("getInfo"))
			cmdchat("ignore_getInfo")	
			return name		
		end		
		
		when button or info begin
			local vid = find_pc_by_name(send_vid.GetPlayerName())
			cmdchat("sendInfo "..vid)
		
		end		
		when login begin			
			cmdchat("saveInfo "..q.getcurrentquestindex())		
		end		
	end
end

python(game.py):

	#GET PLAYER VID FROM SERVER
	def InitPlayerNameInfo(self):
		constInfo.IGNORE_SEND_PLAYER_NAME = 1
	def IgnorePlayerNameInfo(self):
		constInfo.IGNORE_SEND_PLAYER_NAME = 0
	def SendPlayerNameInfo(self):
		net.SendQuestInputStringPacket(constInfo.PLAYER_NAME)
	def GetPlayerVIDInfo(self, vid):
		constInfo.PLAYER_VID = vid
	def SavePlayerVIDInfo(self, value):
		constInfo.get_vid = value
	#END OF GET PLAYER VID FROM SERVER

for example i used this for whisper trade

python(uiwhisper.py):

	def StartExchange(self):
		constInfo.PLAYER_NAME = self.targetName
		event.QuestButtonClick(int(constInfo.get_vid))
		vid = int(constInfo.PLAYER_VID)
		if vid != 0:
			chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.EXCHANGE_TARGET.format(self.targetName)) #if player is online
			net.SendExchangeStartPacket(vid)
			self.interface.StartExchange(self.targetName)
		else:
			chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.EXCHANGE_NO_TARGET.format(self.targetName)) #if player is offline

	def EndExchange(self):
		self.interface.EndExchange()
        
   	def RefreshExchange(self):
		self.interface.RefreshExchange()

and of course i connected a button for the function:

self.tradeButton.SetEvent(ui.__mem_func__(self.StartExchange))

 

 

Edited by pixelshasHUN
  • Metin2 Dev 2
Link to comment
https://metin2.dev/topic/27409-get-vid-from-name/
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

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.