Raised This Month: $51 Target: $400
 12% 

HookUserMessage on new API Syntax


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
notMe2
Member
Join Date: Feb 2014
Old 10-29-2015 , 12:56   HookUserMessage on new API Syntax
Reply With Quote #1

I'm trying to adapt the "old" function prototype for the return action.

Code:
public void OnPluginStart()
{
      HookUserMessage(GetUserMessageId("TextMsg"), Event_TextMsg, true);
}

public Action Event_TextMsg(UserMsg msg_id, Handle pb, int players[32],int playersNum, bool reliable, bool init)
{
    if(reliable)
    {
        char text[32];
        PbReadString(pb, "params", text, sizeof(text),0);
        
        if (StrContains(text, "SFUI_Notice_Match_Will_", false) != -1)
            return Plugin_Handled;
    }
    
    return Plugin_Continue;
}
old one:
Code:
public Action:HookFade(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init)
its returning "error 100: function prototypes do not match" on HookUserMessage line.

Thanks in advance
notMe2 is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 10-29-2015 , 13:00   Re: HookUserMessage on new API Syntax
Reply With Quote #2

https://sm.alliedmods.net/new-api/usermessages/MsgHook
Miu is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-29-2015 , 13:20   Re: HookUserMessage on new API Syntax
Reply With Quote #3

Under the new syntax, const players[] would be const int[] players
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
notMe2
Member
Join Date: Feb 2014
Old 10-29-2015 , 13:44   Re: HookUserMessage on new API Syntax
Reply With Quote #4

@Miu @Powerlord

Thanks
notMe2 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:45.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode