OnPlayerChatCommand
From Onset Developer Wiki
Description
Called when a player executes a command in the chat. See AddCommand to handle specific commands. You can call CancelChatCommand in this event to prevent the command from further processing.
Syntax
OnPlayerChatCommand(player, command, exists)
Parameters
- player
The player who has executed the command. - command
The command name without slashes. For example: help - exists
false if the command is not bound by AddCommand. true if there is such handler.
Example
function OnPlayerChatCommand(player, cmd, exists)
if (GetTimeSeconds() - PlayerData[player].cmd_cooldown < 0.5) then
CancelChatCommand()
return AddPlayerChat(player, "Slow down with your commands")
end
PlayerData[player].cmd_cooldown = GetTimeSeconds()
if (exists == 0) then
AddPlayerChat(player, "Command '/"..cmd.."' not found!")
end
end
AddEvent("OnPlayerChatCommand", OnPlayerChatCommand)
See also
Player
- OnPlayerServerAuth
- OnPlayerSteamAuth
- OnPlayerDownloadFile
- OnPlayerStreamIn
- OnPlayerStreamOut
- OnPlayerPickupHit
- OnPlayerJoin
- OnPlayerQuit
- OnPlayerSpawn
- OnPlayerDeath
- OnPlayerWeaponShot
- OnPlayerDamage
- OnPlayerChat
- OnPlayerChatCommand
- OnPlayerInteractDoor
- OnPlayerChangeDimension
Vehicle
- OnPlayerEnterVehicle
- OnPlayerLeaveVehicle
- OnPlayerStateChange
- OnVehicleRespawn
- OnVehicleStreamIn
- OnVehicleStreamOut
- OnVehicleDamage
- OnVehicleChangeDimension
- OnVehicleCreated
- OnVehicleDestroyed
Game
Package
NPC
- OnNPCReachTarget
- OnNPCDamage
- OnNPCSpawn
- OnNPCDeath
- OnNPCStreamIn
- OnNPCStreamOut
- OnNPCChangeDimension
- OnNPCCreated
- OnNPCDestroyed
Object
- OnObjectStopMoving
- OnObjectChangeDimension
- OnObjectCreated
- OnObjectDestroyed
- OnObjectStreamIn
- OnObjectStreamOut