Update compiler and includes to version 1.7.0.
This commit is contained in:
Vendored
+59
-15
@@ -70,6 +70,29 @@ enum UserMessageType
|
||||
*/
|
||||
native UserMessageType:GetUserMessageType();
|
||||
|
||||
stock Protobuf UserMessageToProtobuf(Handle msg)
|
||||
{
|
||||
if (GetUserMessageType() != UM_Protobuf)
|
||||
return null;
|
||||
return Protobuf:msg;
|
||||
}
|
||||
|
||||
// Make sure to only call this on writable buffers (eg from StartMessage).
|
||||
stock BfWrite UserMessageToBfWrite(Handle msg)
|
||||
{
|
||||
if (GetUserMessageType() == UM_Protobuf)
|
||||
return null;
|
||||
return BfWrite:msg;
|
||||
}
|
||||
|
||||
// Make sure to only call this on readable buffers (eg from a message hook).
|
||||
stock BfWrite UserMessageToBfRead(Handle msg)
|
||||
{
|
||||
if (GetUserMessageType() == UM_Protobuf)
|
||||
return null;
|
||||
return BfRead:msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID of a given message, or -1 on failure.
|
||||
*
|
||||
@@ -128,27 +151,48 @@ native Handle:StartMessageEx(UserMsg:msg, clients[], numClients, flags=0);
|
||||
native EndMessage();
|
||||
|
||||
/**
|
||||
* Called when a message is hooked
|
||||
*
|
||||
* @param msg_id Message index.
|
||||
* @param msg Handle to the input bit buffer or protobuf.
|
||||
* @param players Array containing player indexes.
|
||||
* @param playersNum Number of players in the array.
|
||||
* @param reliable True if message is reliable, false otherwise.
|
||||
* @param init True if message is an initmsg, false otherwise.
|
||||
* @return Ignored for normal hooks. For intercept hooks, Plugin_Handled
|
||||
* blocks the message from being sent, and Plugin_Continue
|
||||
* resumes normal functionality.
|
||||
*/
|
||||
functag public Action:MsgHook(UserMsg:msg_id, Handle:msg, const players[], playersNum, bool:reliable, bool:init);
|
||||
* Hook function types for user messages.
|
||||
*/
|
||||
typeset MsgHook
|
||||
{
|
||||
/**
|
||||
* Called when a bit buffer based usermessage is hooked
|
||||
*
|
||||
* @param msg_id Message index.
|
||||
* @param msg Handle to the input bit buffer.
|
||||
* @param players Array containing player indexes.
|
||||
* @param playersNum Number of players in the array.
|
||||
* @param reliable True if message is reliable, false otherwise.
|
||||
* @param init True if message is an initmsg, false otherwise.
|
||||
* @return Ignored for normal hooks. For intercept hooks, Plugin_Handled
|
||||
* blocks the message from being sent, and Plugin_Continue
|
||||
* resumes normal functionality.
|
||||
*/
|
||||
function Action (UserMsg msg_id, BfRead msg, const int[] players, int playersNum, bool reliable, bool init);
|
||||
/**
|
||||
* Called when a protobuf based usermessage is hooked
|
||||
*
|
||||
* @param msg_id Message index.
|
||||
* @param msg Handle to the input protobuf.
|
||||
* @param players Array containing player indexes.
|
||||
* @param playersNum Number of players in the array.
|
||||
* @param reliable True if message is reliable, false otherwise.
|
||||
* @param init True if message is an initmsg, false otherwise.
|
||||
* @return Ignored for normal hooks. For intercept hooks, Plugin_Handled
|
||||
* blocks the message from being sent, and Plugin_Continue
|
||||
* resumes normal functionality.
|
||||
*/
|
||||
function Action (UserMsg msg_id, Protobuf msg, const int[] players, int playersNum, bool reliable, bool init);
|
||||
};
|
||||
|
||||
/**
|
||||
* Called when a message hook has completed.
|
||||
*
|
||||
* @param msg_id Message index.
|
||||
* @param sent True if message was sent, false if blocked.
|
||||
* @noreturn
|
||||
*/
|
||||
functag public MsgPostHook(UserMsg:msg_id, bool:sent);
|
||||
typedef MsgPostHook = function void (UserMsg msg_id, bool sent);
|
||||
|
||||
/**
|
||||
* Hooks a user message.
|
||||
@@ -162,7 +206,7 @@ functag public MsgPostHook(UserMsg:msg_id, bool:sent);
|
||||
* @noreturn
|
||||
* @error Invalid message index.
|
||||
*/
|
||||
native HookUserMessage(UserMsg:msg_id, MsgHook:hook, bool:intercept=false, MsgPostHook:post=MsgPostHook:-1);
|
||||
native HookUserMessage(UserMsg:msg_id, MsgHook:hook, bool:intercept=false, MsgPostHook:post=INVALID_FUNCTION);
|
||||
|
||||
/**
|
||||
* Removes one usermessage hook.
|
||||
|
||||
Reference in New Issue
Block a user