Enter to Job NPC problem

Where is problem for enter and buy?

Again same :unamused: u answer me 3 days later? @Ryan

code not showing npc items.also not buying

i have try also like this and same

goods = get_npc_item(n[0][0]['model'], args[2])

bot2

Hey Ryan,
codes are not working could you please update them ?
Best regards

@Ryan ?

1 week and this code not working and i cant fix it. why u not help me @Ryan ? also other user’s to want use this code!

@Ryan where is problm!

@Ryan seriously im asking, why u not answer me? dont be kid really

Because I’m doing other things. I’m looking at it now because I have time to do it. I gave you all the code. I’m sure you can do it yourself.

from phBot import *
import struct

def get_npc(name):
	npcs = get_npcs()
	for k, v in npcs.items():
		if v['name'].strip().lower() == name.strip().lower() or v['servername'].strip().lower() == name.strip().lower():
			return (k, v)
	return None

def get_npc_item(model, item):
	goods = get_npc_goods(model)
	if goods:
		for p, s in goods.items():
			for _s, i in s.items():
				if i['name'].strip().lower() == item.strip().lower() or i['servername'].strip().lower() == item.strip().lower():
					return (p, _s)
	return None

def npc_select(args):
	if len(args) == 2:
		n = get_npc(args[1])
		if n:
			inject_joymax(0x7045, struct.pack('I', n[0]), False)
			return 2000
	return 0

def npc_enter(args):
	if len(args) == 2:
		n = get_npc(args[1])
		if n:
			inject_joymax(0x7046, struct.pack('IB', n[0], 1), False)
			return 2000
	return 0

def npc_buy(args):
	if len(args) == 4:
		n = get_npc(args[1])
		if n:
			goods = get_npc_item(n[1]['model'], args[2])
			if goods:
				packet = struct.pack('B', 8)
				packet += struct.pack('B', goods[0]) 		# page
				packet += struct.pack('B', goods[1]) 		# slot
				packet += struct.pack('H', int(args[3]))	# quantity
				packet += struct.pack('I', n[0]) 			# npc
				inject_joymax(0x7034, packet, False)
				return 2000
	return 0

def npc_exit(args):
	if len(args) == 2:
		n = get_npc(args[1])
		if n:
			inject_joymax(0x704B, struct.pack('I', n[0]), False)
			return 2000
	return 0

log('[%s] Loaded' % __name__)

lol if i know how to fix, why need to ask u everyday.

@Ryan ty code working but when bot buy item then Switching to clientless mode. possible fix it?

Nope. The client doesn’t know what item you bought so it crashes.

hmm oke. now i need to fix load config. i try with joined_game but not worked i guess cant get char name bcz config file like char config file.

what i need to write script to use this plugin ?

i wanna buy eu thief suit but ı guess eu and ch have same name how can ı buy eu suit when i wrote this i bought ch thief suit

anyone know how can ı buy ?

Hey How can us it with command msg chat in game can help me