@@ -11,7 +11,7 @@ function addIRCCommands ()
11
11
12
12
function say (server ,channel ,user ,command ,...)
13
13
local message = table.concat ({... }," " )
14
- if not message then ircNotice (user ," syntax is !s <message>" ) return end
14
+ if message == " " then ircNotice (user ," syntax is !s <message>" ) return end
15
15
outputChatBox (" * " .. ircGetUserNick (user ).. " on irc: " .. message ,root ,255 ,168 ,0 )
16
16
outputIRC (" 07* " .. ircGetUserNick (user ).. " on irc: " .. message )
17
17
end
@@ -23,7 +23,7 @@ addIRCCommandHandler("!pm",
23
23
function (server ,channel ,user ,command ,name ,...)
24
24
local message = table.concat ({... }," " )
25
25
if not name then ircNotice (user ," syntax is !pm <name> <message>" ) return end
26
- if not message then ircNotice (user ," syntax is !pm <name> <message>" ) return end
26
+ if message == " " then ircNotice (user ," syntax is !pm <name> <message>" ) return end
27
27
local player = getPlayerFromPartialName (name )
28
28
if player then
29
29
outputChatBox (" * PM from " .. ircGetUserNick (user ).. " on irc: " .. message ,player ,255 ,168 ,0 )
@@ -130,8 +130,8 @@ addIRCCommandHandler("!unmute",
130
130
addIRCCommandHandler (" !freeze" ,
131
131
function (server ,channel ,user ,command ,name ,...)
132
132
if not name then ircNotice (user ," syntax is !freeze <name> [reason]" ) return end
133
- local reason = table.concat ({... }," " ) or " "
134
- local reason = table.concat ({... }," " ) or " "
133
+ local reason = table.concat ({... }," " )
134
+ local reason = table.concat ({... }," " )
135
135
local t = split (reason ,40 )
136
136
local time
137
137
if # t > 1 then
@@ -172,8 +172,8 @@ addIRCCommandHandler("!unfreeze",
172
172
173
173
addIRCCommandHandler (" !slap" ,
174
174
function (server ,channel ,user ,command ,name ,hp ,...)
175
- if not name then ircNotice (user ," syntax is !slap <name> <hp> [ reason] " ) return end
176
- if not hp then ircNotice (user ," syntax is !slap <name> <hp> [ reason] " ) return end
175
+ if not name then ircNotice (user ," syntax is !slap <name> <hp> (< reason>) " ) return end
176
+ if not hp then ircNotice (user ," syntax is !slap <name> <hp> (< reason>) " ) return end
177
177
local reason = table.concat ({... }," " ) or " "
178
178
local player = getPlayerFromPartialName (name )
179
179
if player then
@@ -324,7 +324,7 @@ addIRCCommandHandler("!players",
324
324
addIRCCommandHandler (" !run" ,
325
325
function (server ,channel ,user ,command ,...)
326
326
local str = table.concat ({... }," " )
327
- if not str then ircNotice (user ," syntax is !run <string>" ) return end
327
+ if str == " " then ircNotice (user ," syntax is !run <string>" ) return end
328
328
runString (str ,root ,ircGetUserNick (user ))
329
329
end
330
330
)
@@ -333,15 +333,23 @@ addIRCCommandHandler("!crun",
333
333
function (server ,channel ,user ,command ,...)
334
334
local t = {... }
335
335
local str = table.concat (t ," " )
336
- if not str then ircNotice (user ," syntax is !crun <string>" ) return end
337
- if # getElementsByType (" player" ) == 0 then
338
- ircNotice (user ," No player ingame!" )
339
- end
340
- for i ,player in ipairs (getElementsByType (" player" )) do
341
- if i == 1 then
342
- triggerClientEvent (player ," doCrun" ,root ,str ,false )
343
- else
344
- triggerClientEvent (player ," doCrun" ,root ,str ,false )
336
+ if str == " " then ircNotice (user ," syntax is !crun (<name>) <string>" ) return end
337
+ local player = getPlayerFromPartialName (tostring (t [1 ]))
338
+ if player then
339
+ table.remove (t ,1 )
340
+ str = table.concat (t ," " )
341
+ triggerClientEvent (player ," doCrun" ,root ,str ,true )
342
+ else
343
+ if # getElementsByType (" player" ) == 0 then
344
+ ircNotice (user ," No player ingame!" )
345
+ return
346
+ end
347
+ for i ,player in ipairs (getElementsByType (" player" )) do
348
+ if i == 1 then
349
+ triggerClientEvent (player ," doCrun" ,root ,str ,true )
350
+ else
351
+ triggerClientEvent (player ," doCrun" ,root ,str ,false )
352
+ end
345
353
end
346
354
end
347
355
end
@@ -552,4 +560,73 @@ addIRCCommandHandler("!modules",
552
560
end
553
561
)
554
562
563
+ addIRCCommandHandler (" !shutdown" ,
564
+ function (server ,channel ,user ,command ,...)
565
+ local reason = table.concat ({... }," " )
566
+ if not reason then reason = " Shutdown from irc" end
567
+ shutdown (reason )
568
+ end
569
+ )
570
+
571
+ addIRCCommandHandler (" !password" ,
572
+ function (server ,channel ,user ,command ,...)
573
+ local newpass = table.concat ({... }," " )
574
+ if newpass ~= " " then
575
+ if setServerPassword (newpass ) then
576
+ ircNotice (user ," New server pass: " .. tostring (getServerPassword ()))
577
+ end
578
+ else
579
+ ircNotice (user ," Current server pass: " .. tostring (getServerPassword ()).. " use !password <newpass> to change it" )
580
+ end
581
+ end
582
+ )
583
+
584
+ addIRCCommandHandler (" !gravity" ,
585
+ function (server ,channel ,user ,command ,...)
586
+ local newgravity = table.concat ({... }," " )
587
+ if tonumber (newgravity ) then
588
+ if setGravity (tonumber (newgravity )) then
589
+ ircNotice (user ," New gravity: " .. tostring (getGravity ()))
590
+ end
591
+ else
592
+ ircNotice (user ," Current gravity: " .. tostring (getWeather ()).. " use !gravity <new gravity> to change it" )
593
+ end
594
+ end
595
+ )
596
+
597
+ addIRCCommandHandler (" !weather" ,
598
+ function (server ,channel ,user ,command ,...)
599
+ local newweather = table.concat ({... }," " )
600
+ if newweather then
601
+ if setWeather (tonumber (newweather )) then
602
+ ircNotice (user ," New weather: " .. tostring (getWeather ()))
603
+ end
604
+ else
605
+ ircNotice (user ," Current weather: " .. tostring (getWeather ()).. " use !weather <new weather> to change it" )
606
+ end
607
+ end
608
+ )
609
+
610
+ addIRCCommandHandler (" !server" ,
611
+ function (server ,channel ,user ,command ,...)
612
+ ircSay (channel ," Server: " .. tostring (getServerName ()).. " Port: " .. tostring (getServerPort ()))
613
+ end
614
+ )
615
+
616
+ addIRCCommandHandler (" !zone" ,
617
+ function (server ,channel ,user ,command ,name )
618
+ if not name then ircNotice (user ," syntax is !zone <name>" ) return end
619
+ local player = getPlayerFromPartialName (name )
620
+ if player then
621
+ local x ,y ,z = getElementPosition (player )
622
+ if not x then return end
623
+ local zone = getZoneName (x ,y ,z ,false )
624
+ local city = getZoneName (x ,y ,z ,true )
625
+ ircSay (channel ,tostring (getPlayerName (player )).. " 's zone: " .. tostring (zone ).. " (" .. tostring (city ).. " )" )
626
+ else
627
+ ircSay (channel ," '" .. name .. " ' no such player" )
628
+ end
629
+ end
630
+ )
631
+
555
632
end
0 commit comments