Fix some peopls names

This commit is contained in:
Cooldude2606
2017-06-04 12:33:10 +01:00
parent dca6f9a6ea
commit 8e2e91f53c

View File

@@ -520,20 +520,29 @@ function commandInit()
end
end)
commands.add_command('autoMessage','Sends the auto message to all players',function(event) autoMessage() end)
--debug
commands.add_command('debugPrint','just for testing',function(event)
if event.player_index then else return end
local byPlayer = game.players[event.player_index]
byPlayer.print(('Event = '..table.tostring(event)))
if event.parameter then else byPlayer.print('NIL') return end
local args = {} for word in event.parameter:gmatch('%S+') do table.insert(args,word) end
byPlayer.print(('Arguments = '..table.tostring(args)))
end)
--base layout for all commands
commands.add_command('onlineTime','<player_name> Get a players online time',function(event)
if event.player_index then --is it a player or the server
local byPlayer = game.players[event.player_index] -- it's a player so gets them
if event.parameter then else byPlayer.print('Invaild Input, /onlineTime <player>') return end -- are there any arguments
if getRank(byPlayer).power > 4 then byPlayer.print('401 - Unauthorized: Access is denied due to invalid credentials') return end -- is the user have vaild rank to use command
local args = {} for word in event.parameter:gmatch('%w+') do table.insert(args,word) end -- gets all the arguments passed
local args = {} for word in event.parameter:gmatch('%S+') do table.insert(args,word) end -- gets all the arguments passed
if #args == 1 then else byPlayer.print('Invaild Input, /onlineTime <player> ') return end -- is enouth arguments passed to aloow the command to work
local player = game.players[args[1]] if player then else byPlayer.print('Invaild Player Name,'..args[1]..', try using tab key to auto-coomplet the name') return end -- arguments vaildtion
byPlayer.print(ticktohour(player.online_time)..'H '..(ticktominutes(player.online_time)-60*ticktohour(player.online_time))..'M') -- finally the command is done
else -- when the server runs commands no output is given to any user, also server has no rank validation
return -- example as this code can't work from there server as no output
--if event.parameter then else return end -- are there any arguments
--local args = {} for word in event.parameter:gmatch('%w+') do table.insert(args,word) end -- gets all the arguments passed
--local args = {} for word in event.parameter:gmatch('%S+') do table.insert(args,word) end -- gets all the arguments passed
--if #args == 1 then else return end -- is enouth arguments passed to aloow the command to work
--local player = game.players[args[1]] if player then else return end -- arguments vaildtion
--byPlayer.print(ticktohour(player.online_time)..'H '..(ticktominutes(player.online_time)-60*ticktohour(player.online_time))..'M') -- finally the command is done
@@ -546,7 +555,7 @@ function commandInit()
if event.parameter then else byPlayer.print('Invaild Input, /reviveEntities <range/all>') return end
local pos = byPlayer.position
if getRank(byPlayer).power > 4 then byPlayer.print('401 - Unauthorized: Access is denied due to invalid credentials') return end
local args = {} for word in event.parameter:gmatch('%w+') do table.insert(args,word) end
local args = {} for word in event.parameter:gmatch('%S+') do table.insert(args,word) end
if #args == 1 then else byPlayer.print('Invaild Input, /reviveEntities <range/all>') return end
local range = tonumber(args[1]) if range or args[1] == 'all' then else byPlayer.print('Invaild Range, must be number below 50') return end
if args[1] == 'all' then
@@ -565,7 +574,7 @@ function commandInit()
local byPlayer = game.players[event.player_index]
if event.parameter then else byPlayer.print('Invaild Input, /tp <player> <to_player>') return end
if getRank(byPlayer).power > 4 then byPlayer.print('401 - Unauthorized: Access is denied due to invalid credentials') return end
local args = {} for word in event.parameter:gmatch('%w+') do table.insert(args,word) end
local args = {} for word in event.parameter:gmatch('%S+') do table.insert(args,word) end
if #args == 2 then else byPlayer.print('Invaild Input, /tp <player> <to_player>') return end
local p1 = game.players[args[1]] if p1 then else byPlayer.print('Invaild Player Name,'..args[1]..', try using tab key to auto-coomplet the name') return end
local p2 = game.players[args[2]] if p2 then else byPlayer.print('Invaild Player Name,'..args[2]..', try using tab key to auto-coomplet the name') return end
@@ -575,7 +584,7 @@ function commandInit()
p1.teleport(game.surfaces[p2.surface.name].find_non_colliding_position("player", p2.position, 32, 1))
else
if event.parameter then else return end
local args = {} for word in event.parameter:gmatch('%w+') do table.insert(args,word) end
local args = {} for word in event.parameter:gmatch('%S+') do table.insert(args,word) end
if #args == 2 then else return end
local p1 = game.players[args[1]] if p1 then else return end
local p2 = game.players[args[2]] if p2 then else return end
@@ -589,7 +598,7 @@ function commandInit()
if event.player_index then
local byPlayer = game.players[event.player_index]
if event.parameter then
local args = {} for word in event.parameter:gmatch('%w+') do table.insert(args,word) end
local args = {} for word in event.parameter:gmatch('%S+') do table.insert(args,word) end
if #args == 1 then else byPlayer.print('Invaild Input, /kill <player> ') return end
local player = game.players[args[1]] if player then else byPlayer.print('Invaild Player Name,'..args[1]..', try using tab key to auto-coomplet the name') return end
if getRank(byPlayer).power > getRank(player).power and getRank(byPlayer).power > 4 then byPlayer.print('401 - Unauthorized: Access is denied due to invalid credentials') return end
@@ -600,7 +609,7 @@ function commandInit()
end
else
if event.parameter then else return end
local args = {} for word in event.parameter:gmatch('%w+') do table.insert(args,word) end
local args = {} for word in event.parameter:gmatch('%S+') do table.insert(args,word) end
if #args == 1 then else return end
local player = game.players[args[1]] if player then else return end
if player.connected then else return end
@@ -612,7 +621,7 @@ function commandInit()
if event.player_index then
local byPlayer = game.players[event.player_index]
if event.parameter then else byPlayer.print('Invaild Input, /jail <player>') return end
local args = {} for word in event.parameter:gmatch('%w+') do table.insert(args,word) end
local args = {} for word in event.parameter:gmatch('%S+') do table.insert(args,word) end
if #args == 1 then else byPlayer.print('Invaild Input, /jail <player> ') return end
local player = game.players[args[1]] if player then else byPlayer.print('Invaild Player Name,'..args[1]..', try using tab key to auto-coomplet the name') return end
if getRank(byPlayer).power > getRank(player).power and getRank(byPlayer).power > 4 then byPlayer.print('401 - Unauthorized: Access is denied due to invalid credentials') return end
@@ -621,7 +630,7 @@ function commandInit()
if player.permission_group.name ~= 'Jail' then giveRank(player,'Jail',byPlayer) end
else
if event.parameter then else return end
local args = {} for word in event.parameter:gmatch('%w+') do table.insert(args,word) end
local args = {} for word in event.parameter:gmatch('%S+') do table.insert(args,word) end
if #args == 1 then else return end
local player = game.players[args[1]] if player then else return end
if player.permission_group.name ~= 'Jail' then giveRank(player,'Jail',byPlayer) end
@@ -631,14 +640,14 @@ function commandInit()
if event.player_index then
local byPlayer = game.players[event.player_index]
if event.parameter then else byPlayer.print('Invaild Input, /unjail <player>') return end
local args = {} for word in event.parameter:gmatch('%w+') do table.insert(args,word) end
local args = {} for word in event.parameter:gmatch('%S+') do table.insert(args,word) end
if #args == 1 then else byPlayer.print('Invaild Input, /unjail <player> ') return end
local player = game.players[args[1]] if player then else byPlayer.print('Invaild Player Name,'..args[1]..', try using tab key to auto-coomplet the name') return end
if getRank(byPlayer).power > getRank(player).power and getRank(byPlayer).power > 4 then byPlayer.print('401 - Unauthorized: Access is denied due to invalid credentials') return end
if player.permission_group.name == 'Jail' then revertRank(player,byPlayer) end
else
if event.parameter then else return end
local args = {} for word in event.parameter:gmatch('%w+') do table.insert(args,word) end
local args = {} for word in event.parameter:gmatch('%S+') do table.insert(args,word) end
if #args == 1 then else return end
local player = game.players[args[1]] if player then else end
if player.permission_group.name == 'Jail' then revertRank(player,byPlayer) end
@@ -653,7 +662,7 @@ function commandInit()
if tag then byPlayer.tag = '[cTag] - '..tag..' ' else byPlayer.tag = getRank(byPlayer).tag end
else
if event.parameter then else return end
local args = {} for word in event.parameter:gmatch('%w+') do table.insert(args,word) end
local args = {} for word in event.parameter:gmatch('%S+') do table.insert(args,word) end
if #args > 0 then else return end
local player = game.players[args[1]] if player then else end
if args[2] then player.tag = '[cTag] - '..table.concat(args,' ',2)..' ' else player.tag = getRank(player).tag end