mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
#NET Fixes
This commit is contained in:
parent
9e23cda02a
commit
a4dcb643bd
@ -216,8 +216,8 @@ function NET:BlockPlayer(Client,PlayerName,Seconds,Message)
|
|||||||
self.BlockedPilots[name] = timer.getTime()+addon
|
self.BlockedPilots[name] = timer.getTime()+addon
|
||||||
self.BlockedUCIDs[ucid] = timer.getTime()+addon
|
self.BlockedUCIDs[ucid] = timer.getTime()+addon
|
||||||
local message = Message or self.BlockMessage
|
local message = Message or self.BlockMessage
|
||||||
if Client then
|
if name then
|
||||||
self:SendChatToPlayer(message,Client)
|
self:SendChatToPlayer(message,name)
|
||||||
else
|
else
|
||||||
self:SendChat(name..": "..message)
|
self:SendChat(name..": "..message)
|
||||||
end
|
end
|
||||||
@ -246,8 +246,8 @@ function NET:UnblockPlayer(Client,PlayerName,Message)
|
|||||||
self.BlockedPilots[name] = nil
|
self.BlockedPilots[name] = nil
|
||||||
self.BlockedUCIDs[ucid] = nil
|
self.BlockedUCIDs[ucid] = nil
|
||||||
local message = Message or self.UnblockMessage
|
local message = Message or self.UnblockMessage
|
||||||
if Client then
|
if name then
|
||||||
self:SendChatToPlayer(message,Client)
|
self:SendChatToPlayer(message,name)
|
||||||
else
|
else
|
||||||
self:SendChat(name..": "..message)
|
self:SendChat(name..": "..message)
|
||||||
end
|
end
|
||||||
@ -314,18 +314,22 @@ end
|
|||||||
-- @param Wrapper.Client#CLIENT Client The client
|
-- @param Wrapper.Client#CLIENT Client The client
|
||||||
-- @return #number PlayerID or nil
|
-- @return #number PlayerID or nil
|
||||||
function NET:GetPlayerIDFromClient(Client)
|
function NET:GetPlayerIDFromClient(Client)
|
||||||
|
if Client then
|
||||||
local name = Client:GetPlayerName()
|
local name = Client:GetPlayerName()
|
||||||
local id = self:GetPlayerIDByName(name)
|
local id = self:GetPlayerIDByName(name)
|
||||||
return id
|
return id
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Send chat message to a specific player.
|
--- Send chat message to a specific player using the CLIENT object.
|
||||||
-- @param #NET self
|
-- @param #NET self
|
||||||
-- @param #string Message The text message
|
-- @param #string Message The text message
|
||||||
-- @param Wrapper.Client#CLIENT ToClient Client receiving the message
|
-- @param Wrapper.Client#CLIENT ToClient Client receiving the message
|
||||||
-- @param Wrapper.Client#CLIENT FromClient (Optional) Client sending the message
|
-- @param Wrapper.Client#CLIENT FromClient (Optional) Client sending the message
|
||||||
-- @return #NET self
|
-- @return #NET self
|
||||||
function NET:SendChatToPlayer(Message, ToClient, FromClient)
|
function NET:SendChatToClient(Message, ToClient, FromClient)
|
||||||
local PlayerId = self:GetPlayerIDFromClient(ToClient)
|
local PlayerId = self:GetPlayerIDFromClient(ToClient)
|
||||||
local FromId = self:GetPlayerIDFromClient(FromClient)
|
local FromId = self:GetPlayerIDFromClient(FromClient)
|
||||||
if Message and PlayerId and FromId then
|
if Message and PlayerId and FromId then
|
||||||
@ -336,6 +340,23 @@ function NET:SendChatToPlayer(Message, ToClient, FromClient)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Send chat message to a specific player using the player name
|
||||||
|
-- @param #NET self
|
||||||
|
-- @param #string Message The text message
|
||||||
|
-- @param #string ToPlayer Player receiving the message
|
||||||
|
-- @param #string FromPlayer(Optional) Player sending the message
|
||||||
|
-- @return #NET self
|
||||||
|
function NET:SendChatToPlayer(Message, ToPlayer, FromPlayer)
|
||||||
|
local PlayerId = self:GetPlayerIDByName(ToPlayer)
|
||||||
|
local FromId = self:GetPlayerIDByName(FromPlayer)
|
||||||
|
if Message and PlayerId and FromId then
|
||||||
|
net.send_chat_to(Message, tonumber(PlayerId) , tonumber(FromId))
|
||||||
|
elseif Message and PlayerId then
|
||||||
|
net.send_chat_to(Message, tonumber(PlayerId))
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Load a specific mission.
|
--- Load a specific mission.
|
||||||
-- @param #NET self
|
-- @param #NET self
|
||||||
-- @param #string Path and Mission
|
-- @param #string Path and Mission
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user