@@ -510,6 +510,31 @@ addEventHandler("onIRCResourceStart",root,
510510 end
511511 end
512512 )
513+
514+ addIRCCommandHandler (" !checkmap" ,
515+ function (server ,channel ,user ,command ,...)
516+ local map = table.concat ({... }," " )
517+ if not map then ircNotice (user ," syntax is !changemap <name>" ) return end
518+ local maps = {}
519+ for i ,resource in ipairs (getResources ()) do
520+ if getResourceInfo (resource ," type" ) == " map" then
521+ if string.find (string.lower (getResourceName (resource )),string.lower (map ),0 ,false ) then
522+ table.insert (maps ,resource )
523+ elseif string.find (string.lower (getResourceInfo (resource ," name" )),string.lower (map ),0 ,false ) then
524+ table.insert (maps ,resource )
525+ end
526+ end
527+ end
528+ if # maps == 0 then
529+ ircNotice (user ," No maps found!" )
530+ else
531+ for i ,resource in ipairs (maps ) do
532+ maps [i ] = getResourceName (resource )
533+ end
534+ ircNotice (user ," Found " ..# maps .. " matches: " .. table.concat (maps ," , " ))
535+ end
536+ end
537+ )
513538
514539 addIRCCommandHandler (" !changemap" ,
515540 function (server ,channel ,user ,command ,...)
@@ -518,9 +543,9 @@ addEventHandler("onIRCResourceStart",root,
518543 local maps = {}
519544 for i ,resource in ipairs (getResources ()) do
520545 if getResourceInfo (resource ," type" ) == " map" then
521- if string.find (string.lower (getResourceName (resource )),string.lower (map )) then
546+ if string.find (string.lower (getResourceName (resource )),string.lower (map ), 0 , false ) then
522547 table.insert (maps ,resource )
523- elseif string.find (string.lower (getResourceInfo (resource ," name" )),string.lower (map )) then
548+ elseif string.find (string.lower (getResourceInfo (resource ," name" )),string.lower (map ), 0 , false ) then
524549 table.insert (maps ,resource )
525550 end
526551 end
@@ -646,5 +671,27 @@ addEventHandler("onIRCResourceStart",root,
646671 end
647672 end
648673 )
674+
675+ addIRCCommandHandler (" !country" ,
676+ function (server ,channel ,user ,command ,name )
677+ if not name then ircNotice (user ," syntax is !country <name>" ) return end
678+ local admin = getResourceFromName (" admin" )
679+ if admin and getResourceState (admin ) == " running" then
680+ local player = getPlayerFromPartialName (name )
681+ if player then
682+ local country = exports .admin :getPlayerCountry (player )
683+ if country then
684+ ircSay (channel ,tostring (getPlayerName (player )).. " 's country: " .. tostring (country ))
685+ else
686+ ircSay (channel ," Could not find " .. tostring (getPlayerName (player )).. " 's country." )
687+ end
688+ else
689+ ircSay (channel ," '" .. name .. " ' no such player" )
690+ end
691+ else
692+ ircNotice (user ," the admin resource is not running" )
693+ end
694+ end
695+ )
649696 end
650697)
0 commit comments