Jump to content
  • 0

Log out item will auto removed and put in his/her inventory


cmsm94

Question


  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   5
  • Joined:  08/11/13
  • Last Seen:  

I search for few list including in rathana and google for a script like this.

Possible someone make a simple script for putting a list of item that needed to be taken into inventory when players log out.

 

Example sword/knife/poring hat/ etc

 

Request 

can you do a script that will remove few certain item that let say if the players wearing at that time the item, and when he/she log out the item will be in his/her inventory but if his/her inventory is full the item will put in his/her storage(option). How can ah O.o

Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  


- script Sample -1,{

OnInit:

setarray .Items[0],1201, 1202, 5035;

.size = getarraysize( .Items );

end;

OnPCLogoutEvent:

for ( .@i = 1; .@i < 22; .@i++ ) {

for ( .@x = 0; .@x < .size; .@x++ ) {

if ( getequipid( .@i ) == .Items[ .@x ] )

unequip( .@i );

}

}

end;

}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   13
  • Joined:  06/20/12
  • Last Seen:  

Basically, you want the equip to be unnequiped, right?

May I ask why you want this behavior? Very odd.

Anyway, to do it, you would use

OnPCLogoutEvent:
  if( isequipped(id) ) {
    set @slot
$,getiteminfo(id,10); // retrieve item slot info, not sure about the var type ($@), don't remember well, it should be string and temporary.

    unequip(@slot$);

 }

Something like this, if you want to create a list of itens, define an array, and make a loop lace to check all equips

 

Edited by PcPocket
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   5
  • Joined:  08/11/13
  • Last Seen:  

Basically, you want the equip to be unnequiped, right?

May I ask why you want this behavior? Very odd.

Anyway, to do it, you would use

OnPCLogoutEvent:

  if( isequipped(id) ) {

    set @slot$,getiteminfo(id,10); // retrieve item slot info, not sure about the var type ($@), don't remember well, it should be string and temporary.

    unequip(@slot$);

 }

Something like this, if you want to create a list of itens, define an array, and make a loop lace to check all equips

 

 

Haha its because a certain item have a bug if it is logged out the effect still remains while the equip is off. Therefore i need it to be remove from its equipment(unequip) thats what i mean(LOL I HOPE U UNDERSTAND). Btw how do u work that for item 1201 and 1202, can u do an array for me?

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  


- script eq_remover -1,{

OnPCLogoutEvent:

setarray .@item, 1201, 1202;

set .@len, getarraysize(.@item);

while( .@a<.@len ) {

if(isequipped(.@item[.@a]))

unequip(getiteminfo(.@item[.@a],10));

.@a++;

}

}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   5
  • Joined:  08/11/13
  • Last Seen:  

-	script	eq_remover	-1,{
OnPCLogoutEvent:
	setarray .@item, 1201, 1202;
	set .@len, getarraysize(.@item);
	while( .@a<.@len ) {
		if(isequipped(.@item[.@a]))
			unequip(getiteminfo(.@item[.@a],10));
		.@a++;
	}
}

It seems like it didnt work SKORM. Well my item is a costume it didnt remove when i log out O.o huh

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   13
  • Joined:  06/20/12
  • Last Seen:  

It's just an effect bug then, no need for npc

 

It's very simple to fix it, just go to 'char' table on your database, and search for chars that have 1201 or 1202 in some of these column

  `weapon` smallint(6) unsigned NOT NULL default '0',

  `shield` smallint(6) unsigned NOT NULL default '0',

  `head_top` smallint(6) unsigned NOT NULL default '0',

  `head_mid` smallint(6) unsigned NOT NULL default '0',

  `head_bottom` smallint(6) unsigned NOT NULL default '0',

  `robe` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '0'

By the id, I guess it will be in 'weapon'.

Simply replace it for 0.

@Edit

Wait, what do you mean by 'effect', the item bonuses or the sprite?

And, this happens everytime that you log out your char with this equipment equiped?

Look for a way to fix the bug instead of making an script to 'unbug' it D:

Edited by PcPocket
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   5
  • Joined:  08/11/13
  • Last Seen:  

It's just an effect bug then, no need for npc

 

It's very simple to fix it, just go to 'char' table on your database, and search for chars that have 1201 or 1202 in some of these column

  `weapon` smallint(6) unsigned NOT NULL default '0',

  `shield` smallint(6) unsigned NOT NULL default '0',

  `head_top` smallint(6) unsigned NOT NULL default '0',

  `head_mid` smallint(6) unsigned NOT NULL default '0',

  `head_bottom` smallint(6) unsigned NOT NULL default '0',

  `robe` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '0'

By the id, I guess it will be in 'weapon'.

Simply replace it for 0.

@Edit

Wait, what do you mean by 'effect', the item bonuses or the sprite?

And, this happens everytime that you log out your char with this equipment equiped?

Look for a way to fix the bug instead of making an script to 'unbug' it D:

Actually that script that skorm gave it did work for weapon but, my item is a "costume" it seems it didnt effect is it like an item position that require so it will be remove when you log out, btw i dont get what are you trying to say at here. The bug is like if you wear it then log out it dissapear but the item still in your equip but when you log out again and log in it is there the effect is back.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   13
  • Joined:  06/20/12
  • Last Seen:  

-	script	Sample	-1,{
OnInit:
	setarray .Items[0],1201, 1202, 5035;
	.size = getarraysize( .Items );
	end;
	
OnPCLogoutEvent:
	for ( .@i = 1; .@i < 22; .@i++ ) {
		for ( .@x = 0; .@x < .size; .@x++ ) {
			if ( getequipid( .@i ) == .Items[ .@x ] ) 
				unequip( .@i );
		}
	}
	end;
}

Use this solution then, it will work. The other one wasn't working because of getiteminfo, it was returning a diferent slot probably.

Link to comment
Share on other sites

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.

×
×
  • Create New...