Jump to content

Fix -> Papelera de Shang con Sytem Pet Official


Recommended Posts

Posted

Hay servidores que siguen usando la papelera de shang:

Hay un bug con este sistema y es, que cuando invocas un pet (del sistema pet oficial), y eliminas el item de invocación se crashea el servidor.

Voy a dar una solución bastante sencilla y útil. Si el item se encuentra entre el rango de valores fijados no se elimina.

Lo único que he añadido ha sido la condición:

            -- Aquí hago una condición y es que si el item se encuentra entre 55701 y 55706, no se puede eliminar
            if item_vnum>55700 and item_vnum<55707 then
               syschat ("A la siguiente, que intentes bugear te reviento")
               return
            end

Muestro donde se colocaría 

quest borrar_items begin
	state start begin
		
		when login begin
			cmdchat("BORRAR QID|"..q.getcurrentquestindex())
		end
		
		when button or info begin
			cmdchat("BORRAR INPUT|1")
			local shang = split(input(cmdchat("BORRAR SEND|")), "|")
			cmdchat("BORRAR INPUT|0")
			
			if shang[1] == "BORRAR" then
				borrar_items.Borrar(tonumber(shang[2]), tonumber(shang[3]))
			end
		end
			
		function Borrar(slot, vnum)
			item.select_cell(slot)
			local item_vnum, item_count, item_id = item.get_vnum(), item.get_count(), item.get_id()
			if is_test_server() then
				syschat("---- Debug ----")
				syschat("Vnum: "..tostring(vnum))
				syschat("Slot: "..tostring(slot))
				syschat("ID: "..tostring(item.get_id()))
				syschat("---- End_Debug ----")
			end
			-- Aquí hago una condición y es que si el item se encuentra entre 55701 y 55706, no se puede eliminar
			if item_vnum>55700 and item_vnum<55707 then
			   syschat ("A la siguiente, que intentes bugear te reviento")
			   return
			end
			item.remove_stack()
		end
	end
end

Eso es todo chicos, espero que os sea de ayuda!

 

Un saludo.

Posted
hace 19 minutos, Shang dijo:

Está bien que hagas el post, pero el bug no es con la papelera, es con el pet system XD

No si ya, puse el fix en la papelera tuya, era más facil! jaja

Pd: De todas formas editaré el titulo!

Posted

Mejor usar algo así

local idsellos = {1,2,4}

for i = 0, table.getn(idsellos) do

if ítem.get_vnum() ==idsellos[1] then

chat("no puedes borrar esto")

end

end

Por que si pones "if and then", es lo mismo que > si arrastras ambos sellos al cubo no te dejare eliminarlos < cosa que no es posible y terminarias en las mismas xD

Posted
hace 1 hora, Dilong dijo:

Mejor usar algo así

local idsellos = {1,2,4}

for i = 0, table.getn(idsellos) do

if ítem.get_vnum() ==idsellos[1] then

chat("no puedes borrar esto")

end

end

Por que si pones "if and then", es lo mismo que > si arrastras ambos sellos al cubo no te dejare eliminarlos < cosa que no es posible y terminarias en las mismas xD

Si lo que quiero que no pueda eliminar el item, cuando lo arrastre al cubo, como lo puse. Funciona correctamente, no elimina el item, sale el mensaje que puse. Y los demas items si lo elimina.

Posted
hace 1 hora, Dilong dijo:

Mejor usar algo así

local idsellos = {1,2,4}

for i = 0, table.getn(idsellos) do

if ítem.get_vnum() ==idsellos[1] then

chat("no puedes borrar esto")

end

end

Por que si pones "if and then", es lo mismo que > si arrastras ambos sellos al cubo no te dejare eliminarlos < cosa que no es posible y terminarias en las mismas xD

Un for para un búsqueda 😐

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

This site uses cookies to enhance your browsing experience and provide relevant content. By continuing to browse, you agree to our 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. and Terms of Use. For more information on how we protect your data, please check our Privacy Policy.