• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Coordinates!

Joined
May 13, 2012
Messages
637
Reaction score
18
Location
127.0.0.1
This edit will make it easier for you to copy & paste the coordinates to a .lua script.

9wih.png


In this function:
[cpp]bool Game::playerLookAt(uint32_t playerId, const Position& pos, uint16_t spriteId, int16_t stackpos)[/cpp]

From this:
[cpp] if(player->hasCustomFlag(PlayerCustomFlag_CanSeePosition))
{
ss << std::endl << "Position: [X: " << thingPos.x << "] [Y: " << thingPos.y << "] [Z: " << thingPos.z << "]";
if(Tile* tile = getTile(thingPos))
{
if(House* house = tile->getHouse())
ss << " [House: " << house->getId() << "]";
}

ss << ".";
}[/cpp]

To this:
[cpp] if(player->hasCustomFlag(PlayerCustomFlag_CanSeePosition))
{
ss << std::endl << "Position: {x = " << thingPos.x << ", y = " << thingPos.y << ", z = " << thingPos.z << "}";
if(Tile* tile = getTile(thingPos))
{
if(House* house = tile->getHouse())
ss << " [House: " << house->getId() << "]";
}

ss << ".";
}[/cpp]

Credits goes to Ralcoral ^_^

Yours,
Pandarohoo.
 
I did one MOD like this...

XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Coordinates Look" enabled="yes">
	<config name="coordinates-config"><![CDATA[
		cfg = {
			access = 5,
			msg = "local position = { x = |x|, y = |x|, z = |z|, stackpos = |stackpos| }",
			msgType = MESSAGE_EVENT_ORANGE
		}
	]]></config>	
	<event type="login" name="coordinates-login" event="script"><![CDATA[
		function onLogin(cid)
			registerCreatureEvent(cid, "coordinates-look")
			return true
		end	
	]]></event>	
	<event type="look" name="coordinates-look" event="script"><![CDATA[
		domodlib("coordinates-config")
			
		function onLook(cid, thing, position, lookDistance)
			if getPlayerAccess(cid) >= cfg.access then
				doPlayerSendTextMessage(cid, cfg.msgType, tostring(cfg.msg:gsub("|(.-)|", function(v) return position[v] end)))
			end
			return true
		end
	]]></event>
</mod>
 
I did one MOD like this...

XML:
			msg = "local position = { x = |x|, y = |x|, z = |z|, stackpos = |stackpos| }",

Typo fixed:

XML:
{ x = |x|, y = |y|, z = |z|, stackpos = |stackpos| }
 
Back
Top