-
Notifications
You must be signed in to change notification settings - Fork 28
How to Add Custom Commands
Muhammad Kevin edited this page Mar 7, 2023
·
1 revision
In this page will tell you how to add custom commands
- to make custom commands, you must goto events/eventClient.c file
- after you goto events/eventClient.c file, add
else if
at the end ofelse if
blocks
if (isStr(command[0], "/proxyhelp")) {
sendPacket(3, "action|log\nmsg|>> Commands: /helloworld", clientPeer);
}
else if (isStr(command[0], "/helloworld")) {
sendPacket(3, "action|log\nmsg|`2Hello World", clientPeer);
}
else if (isStr(command[0], "/testarg")) {
if (!command[1]) {
sendPacket(3, "action|log\nmsg|Please input argument", clientPeer);
free(command); // prevent memleak
break;
}
sendPacket(3, CatchMessage("action|log\nmsg|%s", command[1]), clientPeer);
}
// add else if here
else enet_peerSend(event.packet, serverPeer);
- to make your own custom commands, make code like this
- If you want to make custom commands without arguments
else if (isStr(command[0], "/yourcommand")) {
// your code here
}
- If you want to make custom commands with arguments
else if (isStr(command[0], "/yourcommandwithargs")) {
if (!command[1]) {
sendPacket(3, "action|log\nmsg|your warning message here", clientPeer);
free(command); // prevent memleak
break;
}
// your code here
}
and then, the result code is like this
if (isStr(command[0], "/proxyhelp")) {
sendPacket(3, "action|log\nmsg|>> Commands: /helloworld", clientPeer);
}
else if (isStr(command[0], "/helloworld")) {
sendPacket(3, "action|log\nmsg|`2Hello World", clientPeer);
}
else if (isStr(command[0], "/testarg")) {
if (!command[1]) {
sendPacket(3, "action|log\nmsg|Please input argument", clientPeer);
free(command); // prevent memleak
break;
}
sendPacket(3, CatchMessage("action|log\nmsg|%s", command[1]), clientPeer);
}
else if (isStr(command[0], "/yourcommand")) {
// your code here
}
else if (isStr(command[0], "/yourcommandwithargs")) {
if (!command[1]) {
sendPacket(3, "action|log\nmsg|your warning message here", clientPeer);
free(command); // prevent memleak
break;
}
// your code here
}
else enet_peerSend(event.packet, serverPeer);
Wiki
Introduction
Building the Project
- Codeblocks (Windows Version)
- Manual Build (GCC Windows Version)
- Manual Build (Linux Version)
- Manual Build (Android Version)
Connecting to GTProxy
Configuration File
- Default Configuration File
- usingServerData
- serverDataIP
- manualIP
- manualPort
- manualMeta
- usingNewPacket
- httpsPort
- skipGazette
- isSpoofed
GTProxy Tutorial