Working on Portals, related questions
Because ChestShop can't be done right now, I switched my attention at portals plugin.
Idea is: you create a warp (exit) point, then you select an entrance volume using wooden sword, add some chat command magic and TADA - you got one-way portal, which could be used for both in-world and interworld travels.

If you need two-way portal, you simply create warp points inside two entrances and link them cross-like.

Right now I faced a problem: I can't get player's name inside OnBlockPlace() hookBig Grin

Simple code like this:
function OnBlockPlace(PacketData, Player)    -- RIGHTCLICK!
    LOG("PLAYER NAME IS: "..Player:GetName())
    return false
Gave me an error like that:
-- Plugins/Portal/portal_main.lua:73: attempt to index local 'Player' (a number value)

Whose fault it that and how to fix it? Blush
Thanks given by:
this is a bit off topic what i am gonna say (maybe) but you mean nether portals? Smile
Thanks given by:
The OnBlockPlace() callback has a completely different signature since the repacketing; I thought I've written that somewhere, but obviously I've forgotten.

These are the signatures in C++, they should be directly equivalent to the callbacks (taken from cPlugin_NewLua.h, left out the C++ specifiers):
bool OnBlockDig        (cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status, BLOCKTYPE a_OldBlock, NIBBLETYPE a_OldMeta);
bool OnBlockPlace      (cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, const cItem & a_HeldItem);
bool OnBlockToPickup   (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, const cPlayer * a_Player, const cItem & a_EquippedItem, cItems & a_Pickups);
bool OnChat            (cPlayer * a_Player, const AString & a_Message);
void OnChunkGenerated  (cWorld * a_World, int a_ChunkX, int a_ChunkZ);
bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk );
bool OnCollectPickup   (cPlayer * a_Player, cPickup * a_Pickup);
bool OnCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
bool OnDisconnect      (cPlayer * a_Player, const AString & a_Reason);
bool OnKilled          (cPawn* a_Killed, cEntity* a_Killer );
bool OnLogin           (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username);
bool OnPlayerJoin      (cPlayer* a_Player );
void OnPlayerMove      (cPlayer* a_Player );
void OnPlayerSpawn     (cPlayer* a_Player );
bool OnPostCrafting    (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
bool OnPreCrafting     (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
void OnTakeDamage      (cPawn* a_Pawn, TakeDamageInfo* a_TakeDamageInfo );
bool OnUpdatedSign     (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player);
bool OnUpdatingSign    (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ,       AString & a_Line1,       AString & a_Line2,       AString & a_Line3,       AString & a_Line4, cPlayer * a_Player);
bool OnWeatherChanged  (cWorld * a_World);
Thanks given by: Taugeshtu
Quote:you mean nether portals?
No. Right now I don't feel like making them, but they'll be easy enough to implement once I'm done with this plugin.
Thanks given by:
Woooooow. I found literally crazy bug! Angel (r816)
After I apply /ptoggle command (this enables point selection with a wooden sword) and select a region I can't enter any single command! I mean, I send them to chat window and they are gone, but I get no confirmation about the fact that they are accepted or executed.
More than that, even usual chat messages can't be sent!

That's totally weird.
I upload an unfinished plugin in case someone needs to reproduce the bug. Just follow my steps:
1. Install plugin. You should know, how;
2. Launch MCS with it, connect to it (don't forget to give yourself a "portal.create" permission!);
3. Type in chat: "/ptoggle". You should get a message, saying that your wooden sword will now act as region selection tool;
4. Left-click on any block, right-click on any block;
5. You're here. Try to do ANYTHING chat-related - you won't get response.

Looks like whenever I'm going with plugins - I got striked by lightingBig Grin

Attached Files
.zip (Size: 2.54 KB / Downloads: 182)
Thanks given by:
eh i don't have that bug :O i use R824 and i can chat and use commands when i did all the steps you did :O
Thanks given by:
I'll wait for the fresh nightbuild, I guess...
Thanks given by:
Sorry for the missing nightbuilds, the internet connection at my home died so my computer couldn't upload the nightbuilds. And I wasn't here to fix things until now. A fresh nightbuild is on its way.
Thanks given by:
Yep, bug is still there, somehow...
But now I was kicked for "[00:56:58] Unknown packet type 0x40 from client "Taugeshtu" @"
Thanks given by:
i had the unknown packet when i installed a smp mod in my client :O
Thanks given by:

Users browsing this thread: 1 Guest(s)