Simple Command
-
I’m trying to make a simple PM command with the following coding in HkUserCmd.h (I’m new to C++ so bear with me):
void UserCmd_PM(wstring wscParam, wstring wscText, …)
{
PrintUserCmdText(HkGetClientIdFromCharname(wscParam), wscText);
}Then in UserCmds…
{ L"/pm", UserCmd_PM},
My error is…
–— FLHook ( DLL MAIN MSC71 DEBUG BLITZ WIN32 MSC )
HkUserCmd.cpp
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\FLHook\source\HkUserCmd.cpp(576) : error C
2440: ‘initializing’ : cannot convert from ‘void (__cdecl *)(uint,std::wstring,std::wstring,…)’ to ‘_Us
erCmdProc’
None of the functions with this name in scope match the target type
FLHook: 1 file(s) built in (0:19.04), 19047 msecs / file, duration = 20578 msecsThere were errors. (0:20.62)
-
For the method to be included in the UserCmds array it needs to be of type UserCmdProc, which means that the arguments need to be (uint, wstring) (look at the typedef on line 11).
void UserCmd_PM(uint iClientID, wstring wscParam) ```The iClientID is the client-id of the player who entered in the command and the wscParam is all the text they entered after the command. For examples on how to parse the text, take a look at UserCmd_Ignore; there's the GetParam method that comes in handy.