• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Feature [creatureEvent] onMove very advanced

function onMoveItem(cid, item, formPosition, toPosition, fromItem, toItem, fromGround, toGround, status)
if (getTileInfo(fromPosition).house) then
--doSaveHouse({getHouseByPlayerGUID(getPlayerGUID(cid))}) It will save the house of player who is moving item no matter if he is inside of his house of anyone else
--doSaveHouse({getTileInfo(fromPosition).house)}) Will it work??
--doSaveHouse({getHouseByPlayerGUID(getTileInfo(fromPosition).house)}) Will it work??
end
return true
end


you're writing wrong...see..is form not from...no have bug's, it's a great and very valuable script to sources
 
[17/01/2013 11:31:09] [Error - CreatureEvent::configureEvent] No valid type for creature event.moveitem
[17/01/2013 11:31:09] [Warning - BaseEvents::loadFromXml] Cannot configure an event


Error =x
 
Last edited:
Where I put this??

Code:
function onMoveItem(cid, item, formPosition, toPosition, fromItem, toItem, fromGround, toGround, status)
Structure :
			fromItem, toItem = -- return the item just below the moveditem, or returns the container it was moved from
			fromGround, toGround = --returns the tile , so if tile have many items and u removed first one, you can get the gorund moved from
 
			status.inInv = 0 -- unwearing
					1 -- wearing
					2 -- rearrange in inventory
					3 -- action not included in inventory
 
			status.inInvBag= 0 -- removeing from bags
					1 -- holding in bags
					2 -- rearrange in bags
					3 -- action not included in bags
 
			status.Slot = contain the slot that the item is moved to if it is included in inventory
 
			status.inDepot= 0 -- removeing from depot
					1 -- holding in depot
					2 -- rearrange in depot
					3 -- action not included in depot

and this

Code:
function onMoveItem(cid, item, formPosition, toPosition, fromItem, toItem, fromGround, toGround, status)
	if item.itemid == 2466 then
		if (status.inInv == 0 and status.inInvBag == 3 and status.inDepot == 3) or (status.inDepot == 0 and status.inInv == 3 and status.inInvBag == 3 ) or (status.inInvBag == 0 and status.inDepot == 3 and status.inInv == 3) then
			doPlayerSendCancel(cid,"you can't throw this item on ground.")
			return false
		end
	end
	return true
end
 
erro --'

../creatureevent.cpp: In member function 'uint32_t CreatureEvent::executeOnMove(Player*, Item*, const Position&, const Position&, Item*, Item*, Item*, Item*, std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> > >)':
../creatureevent.cpp:2157: error: 'LuaScriptInterface' has not been declared
../creatureevent.cpp:2158: error: 'LuaScriptInterface' has not been declared

../creatureevent.cpp:2159: error: 'LuaScriptInterface' has not been declared
../creatureevent.cpp:2161: error: 'LuaScriptInterface' has not been declared
../creatureevent.cpp:2162: error: 'LuaScriptInterface' has not been declared
../creatureevent.cpp:2163: error: 'LuaScriptInterface' has not been declared
../creatureevent.cpp:2164: error: 'LuaScriptInterface' has not been declared

mingw32-make: *** [../creatureevent.o] Error 1

- - - Updated - - -

Version SVN - 0.3.7.0?
 
Doggynub, is possible to do a script that make impossible to players drop the itens on ground, by ground i want to say, to don't make a lot trash.
So: only is possible to player drop itens on the dump, except if the player is on a house's area and is the owner/subowner/guest.
Somebody don't understood what i was to say?

Thanks adv :]
 
I wonder if doing the same procedure as in the topic will work or has already been proven that it will not?
 
Code:
...\game.cpp In member function `bool Game::playerMoveItem(uint32_t, const Position&, uint16_t, int16_t, const Position&, uint8_t)':

...\game.cpp `RET_NOTMOVABLE' was not declared in this scope

...\Makefile.win [Build Error]  [obj//game.o] Error 1

@Edit

i Fix it. sorry for spam

Code:
player->sendCancelMessage(RET_NOTMOVABLE);

to

Code:
player->sendCancelMessage(RET_NOTMOVEABLE);


Really good job, usefull function

Usefull fix :)
 
The 0.3.6 code can crash the server:
Code:
Cylinder* fromCylinder = internalGetCylinder(player, fromPos);

//custom move
Item* fromItem = NULL;
Item* fromGround = NULL;
Player* fromPlayer= 0;

//

uint8_t fromIndex = 0;
if(fromPos.x == 0xFFFF)
{
if(fromPos.y & 0x40)
{
fromIndex = static_cast<uint8_t>(fromPos.z);

fromItem = fromCylinder->getItem();
Since internalGetCylinder can return NULL, and then, without checking, it's used in fromCylinder->getItem() (use of nullptr)
So to fix you gotta check if fromCylinder isn't nullptr. This was case on my server.
 
Code:
if(variable == 0) then
Is rly outdated..
Use:
Code:
if(not variable) then
 
Code:
if status.inDepot ==1 then
    return false
 
Last edited:
@WibbenZ
As I see it just now I want to clarify that:
var == 0
and
not var
are not equivalent. So if var can have values 0 or 1 etc. checking == 0 is correct.
 
Last edited:
@WibbenZ
As I see it just now I want to clarify that:
var == 0
and
not var
do not equivalent. So if var can have values 0 or 1 etc. checking == 0 is correct.

I ment as most users did when 0.3 was "new" insted of checking
Code:
if(isPlayer(cid) == 0) then return true end

And today id say its better to use

if(not isPlayer(cid)) then return true end

But ofc if we are trying to check a numeric value of something ex.

Code:
if(getPlayersOnline(cid) == 0) then
In this case we should ofc use 0 and not use the not function.
 
There is no real "better" arguement, it is rather a style thing and where you use it.
In the case where you said we should use not instead of == 0 it will not work.

var = 0
var == 0 is true
not var is false
 
Back
Top