void setState(BotState state)
Событие, вызываемое при изменении состояния бота.
Параметр | Описание |
---|---|
state |
Состояние бота. |
samp.on("setState", function(state)
if state == BotState.CONNECTING then
printf("[SAMP] Connecting to %s...", samp.getServerAddress())
elseif state == BotState.RECONNECTING then
printf("[SAMP] Reconnect in %d seconds.", samp.getReconnectDelay() / 1000)
elseif state == BotState.DISCONNECTED then
print("[SAMP] Disconnected.")
elseif state == BotState.JOINING then
print("[SAMP] Connected. Joining the game...")
elseif state == BotState.CONNECTED then
printf("[SAMP] Connected to %s.", samp.getServerAddress())
elseif state == BotState.BAD_SAMP_VERSION then
print("[SAMP] Rejected: Incorrect SA-MP version.")
elseif state == BotState.BAD_NICKNAME then
print("[SAMP] Rejected: Unacceptable NickName.")
elseif state == BotState.BAD_MOD then
print("[SAMP] Rejected: Bad mod version.")
elseif state == BotState.BAD_PLAYERID then
print("[SAMP] Rejected: Unable to allocate a player slot.")
elseif state == BotState.REJECTED_UNKNOWN then
print("[SAMP] Rejected: Unknown reason.")
elseif state == BotState.CONNECTION_CLOSED then
print("[SAMP] Connection was closed by the server.")
elseif state == BotState.ATTEMPT_FAILED then
print("[SAMP] Connection attempt failed.")
elseif state == BotState.CONNECTION_LOST then
print("[SAMP] The connection was lost.")
elseif state == BotState.SERVER_FULL then
print("[SAMP] The server is full.")
elseif state == BotState.BAD_PASSWORD then
print("[SAMP] Invalid password.")
elseif state == BotState.BANNED then
print("[SAMP] You are banned.")
end
end)