-void GameCommand_playerdemo(float request, float argc)
-{
- switch (request)
- {
- case CMD_REQUEST_COMMAND:
- {
- if (argv(2) && argv(3))
- {
- entity client;
- float i, n, accepted;
-
- switch (argv(1))
- {
- case "read":
- {
- client = GetIndexedEntity(argc, 2);
- accepted = VerifyClientEntity(client, false, true);
-
- if (accepted <= 0)
- {
- LOG_INFO("playerdemo: read: ", GetClientErrorString(accepted, argv(2)), ".");
- return;
- }
-
- playerdemo_open_read(client, argv(next_token));
- return;
- }
-
- case "write":
- {
- client = GetIndexedEntity(argc, 2);
- accepted = VerifyClientEntity(client, false, false);
-
- if (accepted <= 0)
- {
- LOG_INFO("playerdemo: write: ", GetClientErrorString(accepted, argv(2)), ".");
- return;
- }
-
- playerdemo_open_write(client, argv(next_token));
- return;
- }
-
- case "auto_read_and_write":
- {
- n = GetFilteredNumber(argv(3));
- cvar_set("bot_number", ftos(n));
-
- localcmd("wait; wait; wait\n");
- for (i = 0; i < n; ++i)
- localcmd("sv_cmd playerdemo read ", ftos(i + 2), " ", argv(2), ftos(i + 1), "\n");
- localcmd("sv_cmd playerdemo write 1 ", ftos(n + 1), "\n");
- return;
- }
-
- case "auto_read":
- {
- n = GetFilteredNumber(argv(3));
- cvar_set("bot_number", ftos(n));
-
- localcmd("wait; wait; wait\n");
- for (i = 0; i < n; ++i)
- localcmd("sv_cmd playerdemo read ", ftos(i + 2), " ", argv(2), ftos(i + 1), "\n");
- return;
- }
- }
- }
- }
-
- default:
- LOG_INFO("Incorrect parameters for ^2playerdemo^7");
- case CMD_REQUEST_USAGE:
- {
- LOG_INFO("Usage:^3 sv_cmd playerdemo command (entitynumber filename | entitynumber botnumber)");
- LOG_INFO(" Full list of commands here: \"read, write, auto_read_and_write, auto_read.\"");
- return;
- }
- }
-}
-