Item in backpack
Posted: Sat Jan 14, 2012 1:22 am
How to check whether the item is located in backpack?
https://www.forums.polserver.com/
Code: Select all
Var cont:=item.container;
While (cont)
cont:=cont.container;
Endwhile
If cont==chr
...Code: Select all
if ( item.container == character.backpack )
Code: Select all
function IsOnBackPack (chr, item)
if(!item.container)
return 0;
elseif(item.container == chr.backpack)
return 1;
else
return IsOnBackPack(chr, item.container);
endif
endfunctionCode: Select all
function IsInBackpack(item, backpack)
while (item.container)
if (item.container == backpack)
return 1;
endif
item := item.container;
endwhile
return 0;
endfunction