Page 1 of 1

player inventory

PostPosted: Sat Nov 28, 2015 20:26
by tbillion
if i wanted to manipulate the player inventory from inside a node, like i wanted to take all their items or remove them all how would i go about that. currently any thing i try with the player_get_blah blah segment erros and gives me

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
015-11-28 14:23:06: WARNING[Server]: Undeclared global variable "get_player_name" accessed at ...oads/minetest-master/bin/../mods/tbmtesting/init.lua:442
2015-11-28 14:23:06: ERROR[Main]: ServerError: Lua: Runtime error from mod 'tbmtesting' in callback node_on_receive_fields(): ...oads/minetest-master/bin/../mods/tbmtesting/init.lua:442: attempt to call global 'get_player_name' (a nil value)
2015-11-28 14:23:06: ERROR[Main]: stack traceback:
2015-11-28 14:23:06: ERROR[Main]:       ...oads/minetest-master/bin/../mods/tbmtesting/init.lua:442: in function <...oads/minetest-master/bin/../mods/tbmtesting/init.lua:431>


maybe the tutorial guy ruben is around some where ;)

Re: player inventory

PostPosted: Sat Nov 28, 2015 21:59
by tbillion
well it would help if your global variable was player instead of sender :)

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
on_receive_fields = function(pos, formname, fields, sender)

Re: player inventory

PostPosted: Sat Nov 28, 2015 22:06
by rubenwardy
http://rubenwardy.com/minetest_modding_ ... ories.html

That may help. Also, it's

player:get_player_name()

Not just get_player_name.

Re: player inventory

PostPosted: Sun Nov 29, 2015 02:30
by tbillion
thanks @rubenwardy. in the end i didnt need the name any way... lol.