×

Langue

Fermer
Atelier 801
  • Forums
  • Dev Tracker
  • Connexion
    • English Français
      Português do Brasil Español
      Türkçe Polski
      Magyar Română
      العربية Skandinavisk
      Nederlands Deutsch
      Bahasa Indonesia Русский
      中文 Filipino
      Lietuvių kalba 日本語
      Suomi עברית
      Italiano Česky
      Hrvatski Slovensky
      Български Latviešu
      Estonian
  • Langue
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • [Script] Configurable item spawning
[Script] Configurable item spawning
Force_shaman
« Censeur »
1381374540000
    • Force_shaman#0000
    • Profil
    • Derniers messages
    • Tribu
#1
  0
--[[
I made this to fool around in the tribe house and figured i'd share it.

Only the person whose username is set as MainAdmin (other admins can be added) can use these commands with the exception of respawnme.
However, everyone will be able to use the spacebar to spawn items once the admin has selected one.

Key:
~ = All players have access
# = Admins have access
* = The Main Admin has access

Commands:

!respawnme - Respawn yourself ~
!respawn playername - Respawn the specified player #
!respawn all - Respawn everyone #
!kill playername - Kill the specified player #
!kill all - kill everyone #
!spawn amount ID - Select the item and amount of it to spawn #
!shooting on/off - Toggle placing and shooting items #
!ghost on/off - Toggle spawning solid objects and ghost ones #
!cooldown seconds/off - Choose the cooldown on spawning or turn it off. It is 1 second by default. #
!power power - Choose the power of fired items, default 30 #
!mirror on/off - Toggle if mice should shoot items in both directions #
!fly on/off - Toggle flying with W/up #
!tp target - Teleport yourself to the specified mouse #
!tph target - Teleport the specified mouse to you #
!tpa - Teleport all mice to you #
!tpo target1 target2 - Teleport The first mouse to the second #
!tpao target - Teleport all mice to the specified one #
!tpc x y - Teleport yourself to a set of coordinates #
!tpoc target x y - Teleport the specified mouse to a set of coordinates #
!admin mouse - Make another mouse admin *
!deadmin mouse - Revoke admin rights from a mouse *

ALL COMMANDS INVOLVING A USERNAME ARE CASE-SENSITIVE!

So for example, if i typed these commands:

!spawn 3 2
!shooting on
!ghost on

Each mouse would fire 3 invisible large boxes when pressing the spacebar.

]]--
Script a dit :

MainAdmin="Tomdizzy"
admins={"Tomdizzy"}
players={}
arg={}
obj=0
amt=0
shooting=false
ghost = false
cooldown = 1000
power = 30
mirror = false
fly = false

function table.exists(table, element)
for var, value in pairs(table) do
if value == element then
return true
end
end
return false
end

function eventNewPlayer(name)
tfm.exec.bindKeyboard(name,32,true,true)
tfm.exec.bindKeyboard(name,90,true,true)
tfm.exec.bindKeyboard(name,38,true,true)
players[name]={
timestamp=os.time()
}
end

for name,player in pairs(tfm.get.room.playerList) do
eventNewPlayer(name)
players[name]={
timestamp=os.time()
}
end

function eventChatCommand(name,msg)
arg={}
for argument in msg:gmatch("[^%s]+") do
table.insert(arg,argument)
end

if arg[1]=="spawn" and type(tonumber(arg[2]))~="nil" and type(tonumber(arg[3]))~="nil" and table.exists(admins,name) then
if (tonumber(arg[2])>10) then
amt = 10
print("You can only spawn 10 items at a time!")
else
amt = arg[2]
end
obj = arg[3]
print("Spawning " .. tostring(amt) .. " " .. tostring(obj) .. "s!")
end
if arg[1]=="respawnme" then
tfm.exec.respawnPlayer(name)
end
if (arg[1]=="kill" and table.exists(admins,name) and arg[2]~=MainAdmin) or (arg[1]=="kill" and name==MainAdmin) then
tfm.exec.killPlayer(arg[2])
end
if arg[1]=="respawn" and arg[2]=="all" and table.exists(admins,name) then
for name,player in pairs(tfm.get.room.playerList) do
tfm.exec.respawnPlayer(name)
end
end
if arg[1]=="kill" and arg[2]=="all" and table.exists(admins,name) then
for name,player in pairs(tfm.get.room.playerList) do
if name~=MainAdmin then
tfm.exec.killPlayer(name)
end
end
end
if arg[1]=="respawn" and table.exists(admins,name) then
tfm.exec.respawnPlayer(arg[2])
end
if arg[1]=="shooting" and arg[2]=="on" and table.exists(admins,name) then
shooting = true
print("Shooting on! Boop!")
end
if arg[1]=="shooting" and arg[2]=="off" and table.exists(admins,name) then
shooting = false
print("Shooting off! Boop!")
end

if arg[1]=="ghost" and arg[2]=="on" and table.exists(admins,name) then
ghost = true
print("Spawning Ghost items.")
end
if arg[1]=="ghost" and arg[2]=="off" and table.exists(admins,name) then
ghost = false
print("Spawning Solid items.")
end

if arg[1]=="power" and type(tonumber(arg[2]))~="nil"and table.exists(admins,name) then
power = arg[2]
if tonumber(power) > 9000 then
print("IT'S OVER 9000!!!!!")
else
print("Shooting power "..tostring(power))
end
end

if arg[1]=="mirror" and arg[2]=="on" and table.exists(admins,name) then
mirror = true
print("Mirroring fired items.")
end
if arg[1]=="mirror" and arg[2]=="off" and table.exists(admins,name) then
mirror = false
print("Mirroring off.")
end

if arg[1]=="fly" and arg[2]=="on" and table.exists(admins,name) then
fly = true
print("Flying on. Whee!")
end
if arg[1]=="fly" and arg[2]=="off" and table.exists(admins,name) then
fly = false
print("Flying off.")
end

if arg[1]=="cooldown" and type(tonumber(arg[2]))~="nil" and table.exists(admins,name) then
cooldown = arg[2]*1000
print("Spawning limited to once every "..arg[2].." seconds.")
end
if arg[1]=="cooldown" and arg[2]=="off" and table.exists(admins,name) then
cooldown = 0
print("Cooldown removed.")
end
if arg[1]=="tp" and tfm.get.room.playerList[tostring(arg[2])] ~=nil and not tfm.get.room.playerList[name].isDead and not tfm.get.room.playerList[arg[2]].isDead and table.exists(admins,name) then
tfm.exec.movePlayer(name,tfm.get.room.playerList[arg[2]].x,tfm.get.room.playerList[tostring(arg[2])].y)
end
if arg[1]=="tph" and tfm.get.room.playerList[tostring(arg[2])]~=nil and not tfm.get.room.playerList[name].isDead and not tfm.get.room.playerList[arg[2]].isDead and table.exists(admins,name) then
tfm.exec.movePlayer(arg[2],tfm.get.room.playerList[name].x,tfm.get.room.playerList[name].y)
end
if arg[1]=="tpa" and not tfm.get.room.playerList[name].isDead and table.exists(admins,name) then
for pname,player in pairs(tfm.get.room.playerList) do
tfm.exec.movePlayer(pname,tfm.get.room.playerList[name].x,tfm.get.room.playerList[name].y)
end
end
if arg[1]=="tpo" and tfm.get.room.playerList[tostring(arg[2])]~=nil and not tfm.get.room.playerList[name].isDead and tfm.get.room.playerList[tostring(arg[3])]~=nil and not tfm.get.room.playerList[arg[2]].isDead and not tfm.get.room.playerList[arg[3]].isDead and table.exists(admins,name) then
tfm.exec.movePlayer(arg[2],tfm.get.room.playerList[arg[3]].x,tfm.get.room.playerList[arg[3]].y)
end
if arg[1]=="tpao" and not tfm.get.room.playerList[name].isDead and table.exists(admins,name) and tfm.get.room.playerList[tostring(arg[2])]~=nil and not tfm.get.room.playerList[arg[2]].isDead then
for pname,player in pairs(tfm.get.room.playerList) do
tfm.exec.movePlayer(pname,tfm.get.room.playerList[arg[2]].x,tfm.get.room.playerList[name].y)
end
end
if arg[1]=="tpc" and tonumber(arg[2])~=nil and tonumber(arg[3])~=nil and not tfm.get.room.playerList[name].isDead and table.exists(admins,name) then
tfm.exec.movePlayer(name,arg[2],arg[3])
end
if arg[1]=="tpoc" and tfm.get.room.playerList[tostring(arg[2])] ~=nil and tonumber(arg[3])~=nil and tonumber(arg[4])~=nil and not tfm.get.room.playerList[name].isDead and table.exists(admins,name) then
tfm.exec.movePlayer(arg[2],arg[3],arg[4])
end
if arg[1]=="admin" and name==MainAdmin and tfm.get.room.playerList[tostring(arg[2])]~=nil and table.exists(admins,name) and not table.exists(admins,arg[2]) then
table.insert(admins,arg[2])
print(arg[2].." is now admin!")
end

if arg[1]=="deadmin" and name==MainAdmin and tfm.get.room.playerList[tostring(arg[2])]~=nil and table.exists(admins,name) and table.exists(admins,arg[2]) then
for key,admin in pairs(admins) do
if admin==arg[2] and arg[2]~=MainAdmin then
table.remove(admins,key)
print(arg[2].." is no longer admin.")
break
end
end
end

end
function eventKeyboard(name,key,down,xpos,ypos)
if (key==90 or key==38) and fly then
tfm.exec.movePlayer(name,0,0,true,0,-30,true)
end
if key==32 and players[name].timestamp < os.time()-cooldown and shooting==false and not tfm.get.room.playerList[name].isDead then
for var=1,amt do
tfm.exec.addShamanObject(obj,xpos,ypos+5,0,0,0,ghost)
players[name].timestamp=os.time()
end

elseif key==32 and players[name].timestamp < os.time()-cooldown and shooting==true and not tfm.get.room.playerList[name].isDead then
if tfm.get.room.playerList[name].isFacingRight or mirror then
for var=1,amt do
tfm.exec.addShamanObject(obj,xpos+10,ypos+5,0,power,0,ghost)
players[name].timestamp=os.time()
end
end
if not tfm.get.room.playerList[name].isFacingRight or mirror then
for var=1,amt do
tfm.exec.addShamanObject(obj,xpos-10,ypos+5,0,-1*power,0,ghost)
players[name].timestamp=os.time()
end
end
end
end

tfm.exec.disableAutoNewGame(true)

Nekoava
« Citoyen »
1381379400000
    • Nekoava#0000
    • Profil
    • Derniers messages
    • Tribu
#2
  0
This could bee helpful o3o
Championrs
« Citoyen »
1381382220000
    • Championrs#0000
    • Profil
    • Derniers messages
#3
  0
Nekoava a dit :
This could bee helpful o3o

It could not be helpful.
It is helpful
Force_shaman
« Censeur »
1381409880000
    • Force_shaman#0000
    • Profil
    • Derniers messages
    • Tribu
#4
  0
Added a configurable cooldown.

It is 1 second by default

Also added some other stuff.
Voke
« Citoyen »
1381413720000
    • Voke#0000
    • Profil
    • Derniers messages
    • Tribu
#5
  0
Tomdizzy a dit :
--[[
if tonumber(power) &gt; 9000 then
print("IT'S OVER 9000!!!!!")
else
print("Shooting power "..tostring(power))
end

This part of the code is the best for sure :D
Yapale
« Citoyen »
1381448700000
    • Yapale#0000
    • Profil
    • Derniers messages
    • Tribu
#6
  0
yes omg ty now i can pew pew pew 10 arrows and flood myself under the elevator

HOW DO YOU CLEAR THIS
Force_shaman
« Censeur »
1381452540000
    • Force_shaman#0000
    • Profil
    • Derniers messages
    • Tribu
#7
  0
Yapale a dit :
yes omg ty now i can pew pew pew 10 arrows and flood myself under the elevator

HOW DO YOU CLEAR THIS

If by clear you mean stop the script, /module stop
Plumbob
« Citoyen »
1381459680000
    • Plumbob#8439
    • Profil
    • Derniers messages
    • Tribu
#8
  0
what is this used for, the tribe house ?
Boygawgaw
« Citoyen »
1381473120000
    • Boygawgaw#0000
    • Profil
    • Derniers messages
    • Tribu
#9
  0
Yes. ^
Thewildnes
« Citoyen »
1381512780000
    • Thewildnes#0000
    • Profil
    • Derniers messages
    • Tribu
#10
  0
Great ..
Force_shaman
« Censeur »
1381529580000
    • Force_shaman#0000
    • Profil
    • Derniers messages
    • Tribu
#11
  0
Added a bunch of teleport commands!

Also added the ability to have multiple admins. The person whose name is set as "MainAdmin" (The script runner) will be immune to the !deadmin command.
Liivahiireke
« Citoyen »
1381581000000
    • Liivahiireke#0000
    • Profil
    • Derniers messages
    • Tribu
#12
  0
it's not working too.. :D
Jsilv
« Citoyen »
1381582560000
    • Jsilv#0000
    • Profil
    • Derniers messages
#13
  0
Liivahiireke a dit :
it's not working too.. :D

Where it says Tomdizzy/name etc you have to change it to Liivahiireke.
Kathiehuang
« Citoyen »
1383169140000
    • Kathiehuang#0000
    • Profil
    • Derniers messages
    • Tribu
#14
  0
This is long :L

How can you like erase this on the /lua box to put another code in instead of this? .3.
Jsilv
« Citoyen »
1383169740000
    • Jsilv#0000
    • Profil
    • Derniers messages
#15
  0
Kathiehuang a dit :
This is long :L

How can you like erase this on the /lua box to put another code in instead of this? .3.

Ctrl + A
Delete
Leafileaf
« Citoyen »
1383200640000
    • Leafileaf#0000
    • Profil
    • Derniers messages
    • Tribu
#16
  0
This will be prone to crashing. What if someone did something like:
Crashy commands a dit :

!spawn 9999 62
!shooting on

Once a mouse presses space everyone would crash. Suggestion: Limit the number of item spawns to 10.
Magicface
« Citoyen »
1384386300000
    • Magicface#0000
    • Profil
    • Derniers messages
#17
  0
Wow I Cant Wait To play It : D
Force_shaman
« Censeur »
1384396380000
    • Force_shaman#0000
    • Profil
    • Derniers messages
    • Tribu
#18
  0
Leafileaf a dit :
This will be prone to crashing. What if someone did something like:


Once a mouse presses space everyone would crash. Suggestion: Limit the number of item spawns to 10.

I thought about this a while ago and was thinking that the script runner should choose his/her admins carefully.
It is a good idea however and I added it
Mochi
« Citoyen »
1429737600000
    • Mochi#0132
    • Profil
    • Derniers messages
    • Tribu
#19
  0
I really like this script :o

Dernière modification le 1468877640000
Nubforx
1429739340000
    • Nubforx#0000
    • Profil
    • Derniers messages
#20
[Modéré par Sabusha, raison : Do not speak Portuguese on the English forums!]
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • [Script] Configurable item spawning
© Atelier801 2018

Equipe Conditions Générales d'Utilisation Politique de Confidentialité Contact

Version 1.27