03-04-2013, 01:25 AM
when do these get fired? becouse i am now working on a sign plugin where you can right-click on a sign to make the weather or time change but they both only get fired when i created a sign.
OnUpdatingSign and OnUpdatedSign
|
03-04-2013, 01:25 AM
when do these get fired? becouse i am now working on a sign plugin where you can right-click on a sign to make the weather or time change but they both only get fired when i created a sign.
03-04-2013, 01:37 AM
Yes, they both fire only when the sign is created (when its text is set).
If you want to catch a rightclick on a sign, you need to use OnPlayerRightClick() hook.
03-04-2013, 01:41 AM
but how can the plugin know what text is on the sign?
03-04-2013, 02:03 AM
Use the cWorld::GetSignLines() function.
03-04-2013, 02:12 AM
how to use that function? i can't find it on the wiki.
03-04-2013, 02:51 AM
should be as easy as calling:
Code: local Line1, Line2, Line3, Line4 = World:GetSignLines(BlockX, BlockY, BlockZ);
03-04-2013, 03:07 AM
it wants more parameters than only BlockX, BlockY and BlockZ. it wants 4 more in total.
Hmm, then the ToLua is generating wrong lua glue code. True, it cannot know that those 4 parameters are out-only.
Until we fix that, pass in 4 more empty strings: Code: local Line1, Line2, Line3, Line4 = World:GetSignLines(BlockX, BlockY, BlockZ, "", "", "", "");
03-04-2013, 04:54 AM
i don't get the lines when i do LOG(Line1) i get nothing :S
03-04-2013, 05:08 AM
Then build a debug version of MCServer, put a breakpoint in cChunk::GetSignLines() and try to find out why it's not working
Debugging the problem is often the most fun, so why not try it? |
« Next Oldest | Next Newest »
|