[HELP NEEDED] SWAT Mod

tinoesroho
Member
 
Posts: 570
Joined: Fri Feb 17, 2012 21:55

[HELP NEEDED] SWAT Mod

by tinoesroho » Mon Feb 27, 2012 20:22

I'm coding a mod that grants the priv holders the ability to "SWAT" a player sky-high. Sadly, I'm a little stuck (as you can see, it swats the swatter sky-high, not the target.) Can I get a hand?

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
minetest.register_on_chat_message(function(name)
local cmd = "/swat"
minetest.env:get_player_by_name(name):setpos({x=0, y=300, z=0})
minetest.chat_send_all('Zeus smote a displeasing fool!')
        return true
end)
We are what we create.

I tinker and occasionally make (lousy) mods. Currently building an MMO subgame and updating mods. Pirate Party of Canada member. Sporadic author. 21 years old.

My github:
https://github.com/tinoesroho/
 

Gatharoth
Member
 
Posts: 196
Joined: Thu Dec 22, 2011 02:54

by Gatharoth » Mon Feb 27, 2012 23:41

Right now, your code is sending the person that types it in. Because of this line.

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
minetest.env:get_player_by_name(name):setpos({x=0, y=300, z=0})


You need to change the command, to require a name. And instead of using "(name)" use what was entered into the command.

As such, the on_chat_message function takes the name of the player typing the message. So again, "(name)" is going to be the one typing the message.
 


Return to WIP Mods

Who is online

Users browsing this forum: Bing [Bot] and 14 guests

cron