Nova
Simple Project
- Сообщения
- 262
- Реакции
- 28
Когда в чате появляется сообщение some_text, нужно отправить сообщение игроку, id которого записано в переменной g_iClient. Но при выполнении функции MyFunction(client) происходит ошибка. В чём проблема и как её решить?
PHP:
#pragma semicolon 1
new g_iClient;
public OnPluginStart()
{
HookUserMessage(GetUserMessageId("TextMsg"), HookUserMessage_TextMsg, true);
}
public Action:HookUserMessage_TextMsg(UserMsg:msg_id, Handle:msg, const players[], playersNum, bool:reliable, bool:init)
{
BfReadByte(msg);
BfReadByte(msg);
decl String:sBuffer[256];
BfReadString(msg, sBuffer, sizeof(sBuffer));
if (StrContains(sBuffer, "some_text", false) != -1)
{
MyFunction(g_iClient);
}
return Plugin_Continue;
}
public MyFunction(client)
{
PrintToChat(client, "[SM] Success!");
}
L 02/16/2019 - 22:55:24: [SM] Native "PrintToChat" reported: Could not send a usermessage
L 02/16/2019 - 22:55:24: [SM] Displaying call stack trace for plugin "plugin.smx":
L 02/16/2019 - 22:55:24: [SM] [0] Line 49, С:\...\cstrike\addons\sourcemod\scripting\doc.sp::MyFunction()
L 02/16/2019 - 22:55:24: [SM] [1] Line 41, С:\...\cstrike\addons\sourcemod\scripting\doc.sp::HookUserMessage_TextMsg()
L 02/16/2019 - 22:55:24: [SM] Displaying call stack trace for plugin "plugin.smx":
L 02/16/2019 - 22:55:24: [SM] [0] Line 49, С:\...\cstrike\addons\sourcemod\scripting\doc.sp::MyFunction()
L 02/16/2019 - 22:55:24: [SM] [1] Line 41, С:\...\cstrike\addons\sourcemod\scripting\doc.sp::HookUserMessage_TextMsg()