23.11.2014, 04:15
Quote:
Can you explain what a shell ID actually is, and how it can be used? For instance how can I check if a program actually launched correctly? I tried doing this:
pawn Код:
I've noticed that the shell ID seems to increase by 16 steadily. Is there any reasoning for this? |
This script prints your current gamemode:
pawn Код:
new Shell:dirlist, Shell:serverinfo, Shell:gminfo;
public OnFilterScriptInit() {
dirlist = SHELL_Execute("dir"); // dump directory files and folders
}
public OnRecieveShellMessage(Shell:id, msg[])
{
if (id == dirlist) {
if (strfind(msg, "server.cfg") != -1) {
printf("server.cfg found. Dumping server info...");
serverinfo = SHELL_Execute("more server.cfg");
}
print(msg);
} else if (id == serverinfo) {
new
linepos;
if ((linepos = strfind(msg, "gamemode0")) != -1) {
new
gamemode_filename[40],
count;
// find for gamemode0 script!
for (new i = linepos+strlen("gamemode0 "); i < strlen(msg); i++) {
if (msg[i] == '\n' || msg[i] == ' ') { // gamemode text end
break;
}
gamemode_filename[count++] = msg[i]; // Copy message gamemode chars.
}
// Add file extension
strcat(gamemode_filename, ".pwn");
printf("Your gamemode is: '%s'. ", gamemode_filename);
format(gamemode_filename, 40, "more gamemodes\\%s", gamemode_filename); // Shell command for dump file data: "more filename"
printf("shell command: %s", gamemode_filename);
gminfo = SHELL_Execute(gamemode_filename);
}
} else if (id == gminfo) {
// Print gamemode
printf(msg);
}
}