Jump to content

Question

Posted

NPc only for admin that can delete item for all account

Example I want to delete gold coins if my players have that just type in NPc the Id of item enter and the item will disappear

18 answers to this question

Recommended Posts

Posted

Try : 

 

prontera,150,150,0    script    Delete    100,{
        set .@GMLevel,99;
        set .@npc$,strnpcinfo(1);
        if (getgmlevel() < .@GMLevel) close;
        mes .@npc$;
        mes "Input the item id";
        next;
        input .@id;
        next;
        if (getitemname(.@id) == "") {
            mes .@npc$;
            mes "Invalid id number";
            close;
        }
        mes .@npc$;
        mes "So,  you want to delete " +getitemname(.@id)+ "?";
        next;
        if (select("- Yes:- No") - 1) close;
        mes .@npc$;
        mes "Processssinnggg...";
        next;
        query_sql("DELETE FROM `auction` WHERE `nameid` = '" +.@id+ "'");
        query_sql("DELETE FROM `cart_inventory` WHERE `nameid` = '" +.@id+ "'");
        query_sql("DELETE FROM `guild_storage` WHERE `nameid` = '" +.@id+ "'");
        query_sql("DELETE FROM `inventory` WHERE `nameid` = '" +.@id+ "'");
        query_sql("DELETE FROM `mail` WHERE `nameid` = '" +.@id+ "'");
        query_sql("DELETE FROM `storage` WHERE `nameid` = '" +.@id+ "'");
        mes .@npc$;
        mes "Done!";
        close;
}
  • Upvote 2
Posted

You can't delete an item in the inventory of player online by sql

prontera,150,145,0	script	Delete	100,{
	set .@GMLevel,99;
	set .@npc$,strnpcinfo(1);
	if (getgmlevel() < .@GMLevel) close;
	mes .@npc$;
	mes "Input the item id";
	next;
	input .@id;
	next;
	if (getitemname(.@id) == "") {
		mes .@npc$;
		mes "Invalid id number";
		close;
	}
	mes .@npc$;
	mes "So,  you want to delete " +getitemname(.@id)+ "?";
	next;
	if (select("- Yes:- No") - 1) close;
	mes .@npc$;
	mes "Processssinnggg...";
	next;
	.@self = getcharid(3);
	query_sql("DELETE FROM `auction` WHERE `nameid` = '" +.@id+ "'");
	query_sql("DELETE FROM `cart_inventory` WHERE `nameid` = '" +.@id+ "'");
	query_sql("DELETE FROM `guild_storage` WHERE `nameid` = '" +.@id+ "'");
	query_sql("DELETE i FROM `inventory` i left join `char` c on c.`char_id` = i.`char_id` WHERE i.`nameid` = '501' and c.`online` = '0'");
	query_sql("DELETE FROM `mail` WHERE `nameid` = '" +.@id+ "'");
	query_sql("DELETE FROM `storage` WHERE `nameid` = '" +.@id+ "'");
	do {
		.@size = query_sql( "select `account_id` from `char` where `online` = '1' order by `account_id` desc limit "+ .@loop +", 128", .@account_id );
		.@loop += 128;
		for ( .@i = 0; .@i < .@size; .@i += 1 ) {
			attachrid .@account_id[.@i];
			delitem .@id, countitem( .@id );
		}
	}
	while( .@size > 0 );
	attachrid .@self;
	mes .@npc$;
	mes "Done!";
	close;
}

Storage etc.. will be update after the player log out log in

Posted

how about kick everyone from the server who has the items you are deleting first before proceeding to deletion process

Off topic.

lol how did that became off topic?

 

what i mean is = check first the players and kick them before you go the deleting process of item in the script posted by capuche which is 14px-U%2B2193.svg.png

since as capuche said: You can't delete an item in the inventory of player online by sql

You can't delete an item in the inventory of player online by sql

prontera,150,145,0	script	Delete	100,{
	set .@GMLevel,99;
	set .@npc$,strnpcinfo(1);
	if (getgmlevel() < .@GMLevel) close;
	mes .@npc$;
	mes "Input the item id";
	next;
	input .@id;
	next;
	if (getitemname(.@id) == "") {
		mes .@npc$;
		mes "Invalid id number";
		close;
	}
	mes .@npc$;
	mes "So,  you want to delete " +getitemname(.@id)+ "?";
	next;
	if (select("- Yes:- No") - 1) close;
	mes .@npc$;
	mes "Processssinnggg...";
	next;
	.@self = getcharid(3);
	query_sql("DELETE FROM `auction` WHERE `nameid` = '" +.@id+ "'");
	query_sql("DELETE FROM `cart_inventory` WHERE `nameid` = '" +.@id+ "'");
	query_sql("DELETE FROM `guild_storage` WHERE `nameid` = '" +.@id+ "'");
	query_sql("DELETE i FROM `inventory` i left join `char` c on c.`char_id` = i.`char_id` WHERE i.`nameid` = '501' and c.`online` = '0'");
	query_sql("DELETE FROM `mail` WHERE `nameid` = '" +.@id+ "'");
	query_sql("DELETE FROM `storage` WHERE `nameid` = '" +.@id+ "'");
	do {
		.@size = query_sql( "select `account_id` from `char` where `online` = '1' order by `account_id` desc limit "+ .@loop +", 128", .@account_id );
		.@loop += 128;
		for ( .@i = 0; .@i < .@size; .@i += 1 ) {
			attachrid .@account_id[.@i];
			delitem .@id, countitem( .@id );
		}
	}
	while( .@size > 0 );
	attachrid .@self;
	mes .@npc$;
	mes "Done!";
	close;
}

Storage etc.. will be update after the player log out log in

  • Upvote 1

Join the conversation

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

Guest
Answer this question...

×   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...