Page 1 of 1

Where are registered the /grant commands?

PostPosted: Fri Jul 15, 2016 12:58
by azekill_DIABLO
Where are registered the /grant commands?

Re: where are?

PostPosted: Fri Jul 15, 2016 13:30
by rubenwardy
builtin/game/chatcommands.lua

Re: where are?

PostPosted: Fri Jul 15, 2016 13:35
by azekill_DIABLO
ok thanks!!

Re: where are?

PostPosted: Fri Jul 15, 2016 14:34
by azekill_DIABLO
i have trouble grating fly priv to someone when creative... it makes the game crashes

here is my code:
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
if creative_mode then

   local privs = minetest.get_player_privs(name)
   fly = true
   noclip = true
   fast = true
   minetest.set_player_privs(name, privs)

Re: where are?

PostPosted: Fri Jul 15, 2016 16:48
by rubenwardy
1. You start an if statement but never close it
2. You get the privs and then set them, but you never change them
3. You set variables "fly", "noclip" and "fast" but never use them

What you meant is:

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
if creative_mode then
       local privs = minetest.get_player_privs(name)
       privs.fly = true
       privs.noclip = true
       privs.fast = true
       minetest.set_player_privs(name, privs)
end


The error messages would have told you this. They would have said "unexpected end of file. Expecting end to close if statement" or something similar.

Also, where do you get "creative_mode" and "name" from?

Re: Where are registered the /grant commands?

PostPosted: Sat Jul 16, 2016 09:47
by azekill_DIABLO
1: it's a part of my code, there is an end :)
2: ok i think your modding book needs a ittle more explanation on this
3: ok ok
4: it's only a part of the creative mod from minetest_game, it's already defined :)

Re: Where are registered the /grant commands?

PostPosted: Sun Jul 17, 2016 16:35
by azekill_DIABLO
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
local creative_mode = minetest.setting_getbool("creative_mode")

if creative_mode then
   local privs = minetest.get_player_privs(name)
      privs.fly = true
      privs.noclip = true
      privs.fast = true
   minetest.set_player_privs(name, privs)
end


won't work....

Re: Where are registered the /grant commands?

PostPosted: Sun Jul 17, 2016 17:19
by rubenwardy
Where are you running that?
It needs to be in some callback, like register_on_joinplayer.
If it is, then please paste your error message and all the code needed so I could run it

Re: Where are registered the /grant commands?

PostPosted: Mon Jul 18, 2016 07:53
by azekill_DIABLO
i'm running this in the init.lua of the creative mod. no error, the game brutally stops.

Re: Where are registered the /grant commands?

PostPosted: Mon Jul 18, 2016 13:42
by rubenwardy
Please paste the last 20 lines of debug.txt
Are you sure you're running this in a call back such as join player, and name is defined?

Re: Where are registered the /grant commands?

PostPosted: Mon Jul 18, 2016 18:16
by azekill_DIABLO
...sorry i am now in win10_64bit so just wait till tomorow :)...

Re: Where are registered the /grant commands?

PostPosted: Tue Jul 26, 2016 09:16
by azekill_DIABLO
oops sorry. i totally forgot this :) i'm doing it now!

Re: Where are registered the /grant commands?

PostPosted: Tue Jul 26, 2016 09:24
by azekill_DIABLO
weird, it does not do anything now :/