Wiki

Clone wiki

EFLC-MP LUA / onPlayerCommand

Description

This function is triggered when the player writes a chat message starting with slash "/"

Parameters

Int playerId, String text
Int playerId

String text: entire text, including the "/"

Return values


Example

#!lua
function myCommandFunction(playerid, text)
    if(string.sub(text, 1, 3) == "/hi") then
        sendPlayerMsg(playerid, "Hello", 0xFFFFFFFF)
    end
end
registerEvent("myCommandFunction", "onPlayerCommand")

Updated