This file is indexed.

/usr/share/games/netpanzer/scripts/servercommands.lua is in netpanzer-data 0.8.4.debian.1-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
local splitsay = function(player, prefix, tbl)
    local s = "";
    local i = 0;
    while ( i < #tbl )
    do
        i = i + 1;
        if ( #s + #tbl[i] > 80 ) then
            netpanzer.serversayto(player, prefix .. s);
            s = tbl[i];
        else
            if ( #s > 0 ) then s = s .. ',' end
            s = s .. tbl[i];
        end
    end

    if ( #s > 0 ) then
        netpanzer.serversayto(player, prefix .. s);
    end
end;

local base_modes = {};
base_modes[0] = "Can't capture";
base_modes[1] = "Helipad capture";
base_modes[2] = "Full base capture";


ServerCommands =
{
    say_help = "Says something to all players as server.",
    say = function(param, player)
        if param then
            netpanzer.serversay(param);
        end
    end,

    listplayers_help = "List the players with their Id",
    listplayers = function(param, player)
        netpanzer.serversayto(player, 'Listing players:');
        local players = netpanzer.listplayers();
        local i = 0;
        while ( i < #players )
        do
            i = i + 1;
            local p = players[i];
            netpanzer.serversayto(player, p.id .. " - " .. p.name .. " ip: " .. p.ip);
        end
    end,

    kick_help = "Kicks a player, use the player number (starts in 0)",
    kick = function(param, player)
        if param then
            netpanzer.kick(param);
        end
    end,

    map_help = "Change the map",
    map = function(param, player)
        netpanzer.serversayto(player, netpanzer.map(param));
    end,

    listmaps_help = "List the available maps in server",
    listmaps = function(param, player)
        netpanzer.serversayto(player, 'Listing maps:');
        splitsay(player, '', netpanzer.listmaps());
    end,

    listprofiles_help = "List the available unit profiles in server",
    listprofiles = function(param, player)
        netpanzer.serversayto(player, 'Listing profiles:');
        splitsay(player, '', netpanzer.listprofiles());
    end,

    listcommands_help = "List the server commands",
    listcommands = function(param, player)
        netpanzer.serversayto(player, 'Listing commands:');
        local out = {};
        for k,v in pairs(ServerCommands) do
            if type(v) == "function" then
                table.insert(out,k);
            end
        end
        splitsay(player, '', out);
    end,

    _help = "Type /server help <wanted_command> or /server listcommands",
    help_help = "Provides this kind of help",
    help = function(param, player)
        local ht = ServerCommands[param .. "_help"];
        if ht then
            netpanzer.serversayto( player, param .. ": " .. ht);
        else
            netpanzer.serversayto( player, "Help not found for " .. param .. ". Use /server listcommands");
        end
    end,

    autokick_help = "sets the idle time for kicking a player automatically",
    autokick = function(param, player)
        if ( param == "" ) then
            netpanzer.serversayto( player, "autokick time is " .. config.game.autokicktime);
        else
            config.game.autokicktime = param;
            netpanzer.serversayto( player, "autokick time was set to " .. config.game.autokicktime);
        end
    end,

    unitprofiles_help = "sets or get list of unit profiles loaded",
    unitprofiles = function(param, player)
        if ( param == "" ) then
            netpanzer.serversayto( player, "Unit profile list: " .. config.game.unit_profiles);
        else
            config.game.unit_profiles = param;
            netpanzer.serversayto( player, "Unit profile list set to: " .. config.game.unit_profiles);
        end
    end,

    unitspawnlist_help = "sets or get the unitspawnlist",
    unitspawnlist = function(param, player)
        if ( param == "" ) then
            netpanzer.serversayto( player, "Unit spawn list: " .. config.game.unit_spawnlist);
        else
            config.game.unit_spawnlist = param;
            netpanzer.serversayto( player, "Unit spawn list set to: " .. config.game.unit_spawnlist);
        end
    end,

    baselimit_help = "sets or get the base limit for players",
    baselimit = function(param, player)
        if ( param == "" ) then
            netpanzer.serversayto( player, "Base limit: " .. config.game.base_limit);
        else
            config.game.base_limit = param;
            netpanzer.serversayto( player, "Base limit set to: " .. config.game.base_limit);
        end
    end,

    basemode_help = "sets or get the base capture mode: 0- no capture, 1- helipad capture, 2- all base capture",
    basemode = function(param, player)
        if ( param == "" ) then
            netpanzer.serversayto( player, "Base capture mode: " .. config.game.base_capture_mode .. "- " .. base_modes[config.game.base_capture_mode]);
        else
            local v = tonumber(param);
            if ( v ~= nil and v >= 0 and v <= 2 ) then
                config.game.base_capture_mode = v;
                netpanzer.serversayto( player, "Base capture mode set to: " .. config.game.base_capture_mode .. "- " .. base_modes[config.game.base_capture_mode]);
            else
                netpanzer.serversayto( player, "Capture mode is invalid");
            end
        end
    end,

    gamepass_help = "sets or get the password for connecting to the server",
    gamepass = function(param, player)
        if ( param == "" ) then
            if ( config.game.gamepass == "" ) then
                netpanzer.serversayto( player, "There is no password set");
            else
                netpanzer.serversayto( player, "Current game password: " .. config.game.gamepass);
            end
        else
            if ( param == "." ) then
                config.game.gamepass = "";
                netpanzer.serversayto( player, "Game password was removed");
            else
                config.game.gamepass = param;
                netpanzer.serversayto( player, "Game password set to: " .. config.game.gamepass);
            end

        end
    end,

    countdown_help = "Do a countdown, use 'countdown <time> <message>'",
    countdown = function(param, player)
        if game.hasTask('countdown') then
            netpanzer.serversayto( player, "There is already a countdown running");
            return;
        end
        local counttime, message = string.match(param, "(%d+) *(.*)");
        counttime = tonumber(counttime) or 5;

        if counttime > 20 then
            netpanzer.serversayto( player, "Time is too big");
            return;
        end

        message = (message and message:find("%S") and message) or "Countdown...";
        local count = 0;
        netpanzer.serversay(message .. " " .. counttime);

        game.addTask('countdown', function()
                count = count + game.frametime;
                if count > 1.0 then
                    count = count - 1.0;
                    counttime = counttime - 1;
                    if counttime == 0 then
                        netpanzer.serversay(message .. " FIGHT!!!!");
                    else
                        netpanzer.serversay(message .. " " .. counttime);
                    end
                end
                return counttime == 0;
            end);
    end,

    flagtimer_help = "sets the time for changing flag",
    flagtimer = function(param, player)
        if ( param == "" ) then
            netpanzer.serversayto( player, "flagtimer time is " .. config.game.changeflagtime);
        else
            config.game.changeflagtime = param;
            netpanzer.syncflagtimer();
            netpanzer.serversayto( player, "flagtimer time was set to " .. config.game.changeflagtime);
        end
    end
};