Samp shell plugin
From SA-MP Wiki
Contents |
SA:MP Shell Plugin
SA:MP Shell Plugin Plugin | |
---|---|
Author | BigETI |
Released | 22/11/2014 |
Latest Version | v1.0.3 (27/11/2014) |
Development Status | Active |
License | Mozilla Public License |
Forum Topic |
About
This plugin allows you to execute shell commands on your server.
Documentation
Natives
Shell:SHELL_Execute
Description:
cmd[] | The command to be executed |
Return Values:
Example Usage:
new Shell:handle; // ... handle = SHELL::Execute("echo test"); // Echoes "test". // ...
SHELL_System
Description:
cmd[] | The command to be executed |
Return Values:
Example Usage:
// ... SHELL::System("echo test"); // Echoes "test". // ...
bool:SHELL_IsActive
Description:
Shell:handle | The handle to be checked |
Return Values:
Example Usage:
new Shell:handle; // ... handle = SHELL::Execute("echo test"); // Echoes "test". // ... new bool:is_active = SHELL::IsActive(handle);
SHELL_Release
Description:
Shell:handle | The handle to release. Does not directly terminate it! Use "SHELL::IsActive()" or "OnReleaseShell()" to check, if this is truly released! |
Return Values:
Example Usage:
new Shell:handle; // ... handle = SHELL::Execute("echo test"); // Echoes "test". // ... SHELL::Release(handle); // Releases handle
SHELL_ReleaseAll
Description:
Return Values:
Example Usage:
new Shell:handle1, Shell:handle2; // ... handle1 = SHELL::Execute("echo test"); // Echoes "test". handle2 = SHELL::Execute("ping 127.0.0.1"); // Pings "127.0.0.1" // ... SHELL::ReleaseAll(); // Releases all available handles
SHELL_MEM_CleanUp
Description:
Return Values:
Example Usage:
// ... SHELL::MEM_CleanUp(); // ...
Callbacks
OnReceiveShellMessage
Description:
Shell:handle | The shell handle. |
msg[] | The message as string. |
Example Usage:
public OnReceiveShellMessage(Shell:handle, msg[]) { printf("Shell handle 0x%x", _:handle); print(msg); }
OnReleaseShell
Description:
Shell:handle | The released shell handle. |
Example Usage:
public OnReleaseShell(Shell:handle) { printf("Released shell handle 0x%x", _:handle); }
Setup
Put the plugin binary into your server's "plugins" folder and set in server.cfg
Windows
plugins sampshell
LINUX
plugins sampshell.so
Scriptwise Implementation
// On top of your script #include <sampshell> // your code
Compile and run.
Downloads
sampshell.dll (Win32), sampshell.inc - Solidfiles
sampshell.so (Debian 7 (Wheezy)), sampshell.inc - Solidfiles
sampshell.so (CentOS), sampshell.inc - Solidfiles
sampshell.so (Ubuntu 14.04.1), sampshell.inc - Solidfiles
source code - Solidfiles
sampshell.inc - Pastebin
makefile - Pastebin
main.cpp - sampshell - Pastebin
sampshelltest.pwn - Pastebin
Credits
- BigETI for the source code and compiled binaries for Windows distributions and Ubuntu 14.04.1
- SA:MP development team
- Bluescreen for compiling this for Debian 7 (Wheezy)
- Markā¢ for compiling this for CentOS