[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4866: Undefined array key "database_gc"
player inventory - FOSS gamedev and creative worlds

player inventory

tbillion
Member
 
Posts: 189
Joined: Wed Apr 03, 2013 16:07

player inventory

by tbillion » Sat Nov 28, 2015 20:26

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 ;)
 

tbillion
Member
 
Posts: 189
Joined: Wed Apr 03, 2013 16:07

Re: player inventory

by tbillion » Sat Nov 28, 2015 21:59

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)
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: player inventory

by rubenwardy » Sat Nov 28, 2015 22:06

http://rubenwardy.com/minetest_modding_ ... ories.html

That may help. Also, it's

player:get_player_name()

Not just get_player_name.
 

tbillion
Member
 
Posts: 189
Joined: Wed Apr 03, 2013 16:07

Re: player inventory

by tbillion » Sun Nov 29, 2015 02:30

thanks @rubenwardy. in the end i didnt need the name any way... lol.
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron