03-17-2013, 08:33 AM
I created a little script that checks whether someone wrote on the chat. When I use it, it sometimes works, but I noticed that if several messages appear, the plugin crashes.
detection1 and detection2 are two booleans that control whether I want to check for all messages or only for whispers. ShowToClient is used here just for debugging.
Code:
function OnChatUserMessage(chatTypechatType, nick, msg)
if detection1 then
if GetUserByName(nick):IsPlayer() then
PlaySound(GetDir() .. "silent_beep.wav");
ShowToClient("PM Guard1", "///.");
end
end
if detection2 then
if GetUserByName(nick):IsPlayer() and chatType == 2 then
PlaySound(GetDir() .. "silent_beep.wav");
ShowToClient("PM Guard2", "///.");
end
end
end;