Wiki

Clone wiki

EFLC-MP LUA / onPlayerChat

Description

This function is triggered when the player writes a chat message

Parameters

Int playerId, String text
Int playerId

String text: entire text

Return values

Bool allowChat
allowChat: True: will send the chat msg to all players, False: won't send the message.

Example

#!lua
function myChatFunction(playerid, text)
    if(string.sub(text, 1, 17) == "this server sucks") then
        sendPlayerMsg(playerid, "Thanks buddy", 0xFFFFFFFF)
        return false
    end
    return true
end
registerEvent("myChatFunction", "onPlayerChat")

Updated