mg support
This commit is contained in:
parent
4efd426893
commit
01fad8b648
@ -9,6 +9,9 @@
|
|||||||
#define API_URL ""
|
#define API_URL ""
|
||||||
#define BOT_TOKEN ""
|
#define BOT_TOKEN ""
|
||||||
|
|
||||||
|
|
||||||
|
int i_port = 0;
|
||||||
|
|
||||||
public Plugin myinfo =
|
public Plugin myinfo =
|
||||||
{
|
{
|
||||||
name = "livechat stoat",
|
name = "livechat stoat",
|
||||||
@ -26,7 +29,6 @@ public void OnMapStart()
|
|||||||
|
|
||||||
public Action SendMapNotificationToStoat(Handle timer)
|
public Action SendMapNotificationToStoat(Handle timer)
|
||||||
{
|
{
|
||||||
int i_port = GetConVarInt(FindConVar("hostport"));
|
|
||||||
if (i_port == 27015)
|
if (i_port == 27015)
|
||||||
{
|
{
|
||||||
char sText[1024];
|
char sText[1024];
|
||||||
@ -59,6 +61,7 @@ void SendToMapNotifications_endpoint(const char[] msg) {
|
|||||||
|
|
||||||
public void OnPluginStart()
|
public void OnPluginStart()
|
||||||
{
|
{
|
||||||
|
i_port = GetConVarInt(FindConVar("hostport"));
|
||||||
AddCommandListener(CommandListener_SmChat_stoat, "say");
|
AddCommandListener(CommandListener_SmChat_stoat, "say");
|
||||||
|
|
||||||
RegServerCmd("sm_printtoallchat_stoat", Command_PrintToAllChat_stoat, "Stoat Integration");
|
RegServerCmd("sm_printtoallchat_stoat", Command_PrintToAllChat_stoat, "Stoat Integration");
|
||||||
@ -95,8 +98,15 @@ public Action CommandListener_SmChat_stoat(int client, const char[] sCommand, in
|
|||||||
}
|
}
|
||||||
|
|
||||||
//LogMessage("sText: %s. sText[0]: %c", sText, sText[0]);
|
//LogMessage("sText: %s. sText[0]: %c", sText, sText[0]);
|
||||||
|
|
||||||
SendToStoat(sUsername, sText, "");
|
if (i_port == 27015)
|
||||||
|
{
|
||||||
|
SendToStoat(sUsername, sText, "");
|
||||||
|
}
|
||||||
|
else if (i_port == 27017)
|
||||||
|
{
|
||||||
|
SendToStoat(sUsername, sText, "");
|
||||||
|
}
|
||||||
|
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
@ -119,7 +129,34 @@ void SendToStoat(const char[] name, const char[] msg, const char[] channel_id) {
|
|||||||
delete data;
|
delete data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnHTTPResponse(HTTPResponse response, any value) {
|
void OnHTTPResponse(HTTPResponse response, any value, const char[] error) {
|
||||||
|
/*
|
||||||
|
if (strlen(error) > 0)
|
||||||
|
{
|
||||||
|
LogError("HTTP request failed: %s", error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int status = response.Status;
|
||||||
|
|
||||||
|
if (status != HTTPStatus_OK && status != HTTPStatus_Created)
|
||||||
|
{
|
||||||
|
LogError("Unexpected HTTP status: %d", status);
|
||||||
|
|
||||||
|
// Optionally log the response body to see what the server returned
|
||||||
|
JSONObject body = view_as<JSONObject>(response.Data);
|
||||||
|
if (body != null)
|
||||||
|
{
|
||||||
|
char bodyStr[1024];
|
||||||
|
body.ToString(bodyStr, sizeof(bodyStr));
|
||||||
|
LogError("Response body: %s", bodyStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogMessage("Message sent successfully, status: %d", status);
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action Command_PrintToAllChat_stoat(int args)
|
public Action Command_PrintToAllChat_stoat(int args)
|
||||||
@ -163,6 +200,21 @@ public void GetDiscordToStoat(const char[] username, const char[] message, int t
|
|||||||
//type = 4. admin logs ze ban evasion
|
//type = 4. admin logs ze ban evasion
|
||||||
//type = 5. Calladmin
|
//type = 5. Calladmin
|
||||||
//type = 6. admin chat ze
|
//type = 6. admin chat ze
|
||||||
|
|
||||||
|
if (i_port == 27017)
|
||||||
|
{
|
||||||
|
if (type == 1)
|
||||||
|
{
|
||||||
|
SendToStoat(username, message, "");
|
||||||
|
}
|
||||||
|
else if (type == 2)
|
||||||
|
{
|
||||||
|
SendToStoat(username, message, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (type == 1)
|
if (type == 1)
|
||||||
{
|
{
|
||||||
SendToStoat(username, message, "");
|
SendToStoat(username, message, "");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user