本文整理汇总了C++中MF_RegisterSPForwardByName函数的典型用法代码示例。如果您正苦于以下问题:C++ MF_RegisterSPForwardByName函数的具体用法?C++ MF_RegisterSPForwardByName怎么用?C++ MF_RegisterSPForwardByName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MF_RegisterSPForwardByName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: socket_listen_t
// native socket_listen_t( rc, hostname, port, protocol, recvhandler ) // Give access to iMaxConnections also ?
static cell AMX_NATIVE_CALL socket_listen_t(AMX *amx, cell *params) /* 5 param */
{
if( !params[1] )
return -1;
// Get SocketThread form param[1]
CThreadedSocketItem* SocketThread = (CThreadedSocketItem *)params[1];
int len;
char* szTempHostnam = MF_GetAmxString(amx,params[2],0,&len);
if( SocketThread->Hostname != NULL )
{
delete [] SocketThread->Hostname;
SocketThread->Hostname = NULL;
}
SocketThread->Hostname = new char [len+1];
// Copy Hostname
strcpy( SocketThread->Hostname, szTempHostnam );
SocketThread->Hostname[len] = '\0';
SocketThread->port = params[3];
SocketThread->protocol = params[4];
// Register Forward and save fwdID in fid array
SocketThread->fIDs[FID_LISTEN] = MF_RegisterSPForwardByName(amx, MF_GetAmxString(amx, params[5], 0, &len), FP_CELL, FP_CELL, FP_DONE);
if( SocketThread->fIDs[FID_LISTEN] < 0 )
{
return -2; // Could not find Public CallBack function to register it
}
// Since all the required data is set, Run the thread in required state
SocketThread->ThreadState(STATE_LISTEN);
return 0;
}
示例2: register_touch
static cell AMX_NATIVE_CALL register_touch(AMX *amx, cell *params)
{
int len;
char *Toucher = MF_GetAmxString(amx, params[1], 0, &len);
char *Touched = MF_GetAmxString(amx, params[2], 1, &len);
Touch *p = new Touch;
if (!strlen(Toucher) || strcmp(Toucher, "*")==0) {
p->Toucher.assign("");
} else {
p->Toucher.assign(Toucher);
}
if (!strlen(Touched) || strcmp(Touched, "*")==0) {
p->Touched.assign("");
} else {
p->Touched.assign(Touched);
}
p->Forward = MF_RegisterSPForwardByName(amx, MF_GetAmxString(amx, params[3], 2, &len), FP_CELL, FP_CELL, FP_DONE);
Touches.push_back(p);
if (!g_pFunctionTable->pfnTouch)
g_pFunctionTable->pfnTouch=pfnTouch;
return p->Forward;
}
示例3: FailPlugin
void FailPlugin(AMX *amx, int id, int err, const char *reason)
{
int fwd=MF_RegisterSPForwardByName(amx, "__fatal_ham_error", FP_CELL, FP_CELL, FP_STRING, FP_DONE);
MF_ExecuteForward(fwd, id, err, reason);
MF_UnregisterSPForward(fwd);
}
示例4: register_impulse
static cell AMX_NATIVE_CALL register_impulse(AMX *amx, cell *params)
{
int len;
Impulse *p = new Impulse;
p->Check = params[1];
p->Forward = MF_RegisterSPForwardByName(amx, MF_GetAmxString(amx, params[2], 0, &len), FP_CELL, FP_CELL, FP_DONE);
Impulses.push_back(p);
if (!g_pFunctionTable->pfnCmdStart)
g_pFunctionTable->pfnCmdStart=CmdStart;
return p->Forward;
}
示例5: csdm_reg_cfg
static cell AMX_NATIVE_CALL csdm_reg_cfg(AMX *amx, cell *params)
{
int length;
char *setting = MF_GetAmxString(amx, params[1], 0, &length);
char *func = MF_GetAmxString(amx, params[2], 1, &length);
int forward = MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_STRING, FP_DONE);
if (forward < 1)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Public function \"%s\" not found", func);
return 0;
}
g_Config.AddHook(setting, forward);
return 1;
}
示例6: register_think
static cell AMX_NATIVE_CALL register_think(AMX *amx, cell *params)
{
int len;
EntClass *p = new EntClass;
const char *clsname = MF_GetAmxString(amx, params[1], 0, &len);
p->Class.assign(clsname);
p->Forward = MF_RegisterSPForwardByName(amx, MF_GetAmxString(amx, params[2], 0, &len), FP_CELL, FP_DONE);
Thinks.push_back(p);
if (!g_pFunctionTable->pfnThink)
g_pFunctionTable->pfnThink=Think;
return p->Forward;
}
示例7: SQL_ThreadQuery
//public QueryHandler(state, Handle:query, error[], errnum, data[], size)
//native SQL_ThreadQuery(Handle:cn_tuple, const handler[], const query[], const data[]="", dataSize=0);
static cell AMX_NATIVE_CALL SQL_ThreadQuery(AMX *amx, cell *params)
{
if (!g_pWorker)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Thread worker was unable to start.");
return 0;
}
SQL_Connection *cn = (SQL_Connection *)GetHandle(params[1], Handle_Connection);
if (!cn)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid info tuple handle: %d", params[1]);
return 0;
}
int len;
const char *handler = MF_GetAmxString(amx, params[2], 0, &len);
int fwd = MF_RegisterSPForwardByName(amx, handler, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_ARRAY, FP_CELL, FP_DONE);
if (fwd < 1)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Function not found: %s", handler);
return 0;
}
MysqlThread *kmThread;
g_QueueLock->Lock();
if (g_FreeThreads.empty())
{
kmThread = new MysqlThread();
} else {
kmThread = g_FreeThreads.front();
g_FreeThreads.pop();
}
g_QueueLock->Unlock();
kmThread->SetInfo(cn->db);
kmThread->SetForward(fwd);
kmThread->SetQuery(MF_GetAmxString(amx, params[3], 1, &len));
kmThread->SetCellData(MF_GetAmxAddr(amx, params[4]), (ucell)params[5]);
g_pWorker->MakeThread(kmThread);
return 1;
}
示例8: csdm_addstyle
static cell AMX_NATIVE_CALL csdm_addstyle(AMX *amx, cell *params)
{
int len;
char *name, *func;
name = MF_GetAmxString(amx, params[1], 0, &len);
func = MF_GetAmxString(amx, params[2], 1, &len);
int callback = MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
if (callback < 0)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Callback function not found (\"%s\")", func);
return -1;
}
g_SpawnMngr.AddMethod(name, callback);
return callback;
}
示例9: socket_accept_t
// native socket_accept_t(rc, CallBack)
static cell AMX_NATIVE_CALL socket_accept_t(AMX *amx, cell *params) /* 2 param */
{
if( !params[1] )
return -1;
// Get SocketThread form param[1]
CThreadedSocketItem* SocketThread = (CThreadedSocketItem *)params[1];
int len;
// Register Forward and save fwdID in fid array
SocketThread->fIDs[FID_ACCEPT] = MF_RegisterSPForwardByName(amx, MF_GetAmxString(amx, params[2], 0, &len), FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_CELL, FP_DONE);
if( SocketThread->fIDs[FID_ACCEPT] < 0 )
{
return -2; // Could not find Public CallBack function to register it
}
// Since all the required data is set, Run the thread in required state
SocketThread->ThreadState(STATE_ACCEPT);
return 0;
}
示例10: socket_send_t
// native socket_send_t(rc, data, len, callback)
static cell AMX_NATIVE_CALL socket_send_t(AMX *amx, cell *params) /* 4 param */
{
if( !params[1] )
return -1;
// Get SocketThread form param[1]
CThreadedSocketItem* SocketThread = (CThreadedSocketItem *)params[1];
int len = params[3];
// Get the data which may have null chars into SocketThreads' szData
char **g_buffer = &SocketThread->szData;
if ((size_t)len != (SocketThread->iDatalen))
{
if( *g_buffer != NULL ) delete [] *g_buffer;
*g_buffer = new char[len+1];
SocketThread->iDatalen = len;
}
cell *pData = MF_GetAmxAddr(amx, params[2]);
char *pBuffer = *g_buffer;
while (len--)
*pBuffer++ = (char)*pData++;
// Register Forward and save fwdID in fid array
SocketThread->fIDs[FID_SEND] = MF_RegisterSPForwardByName(amx, MF_GetAmxString(amx, params[4], 0, &len), FP_CELL, FP_CELL, FP_DONE);
if( SocketThread->fIDs[FID_SEND] < 0 )
{
return -2; // Could not find Public CallBack function to register it
}
// Since all the required data is set, Run the thread in required state
SocketThread->ThreadState(STATE_SEND);
return 0;
}
示例11: Create_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool
int Create_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_CELL, FP_CELL, FP_ARRAY, FP_ARRAY, FP_CELL, FP_DONE);
}
示例12: Create_Void_Vector_Entvar_Entvar_Float_Int_Int
int Create_Void_Vector_Entvar_Entvar_Float_Int_Int(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_CELL, FP_CELL, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
}
示例13: Create_Void_Str_Float_Float_Float_Int_Cbase
int Create_Void_Str_Float_Float_Float_Int_Cbase(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_FLOAT, FP_FLOAT, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
}
示例14: Create_Int_Entvar
int Create_Int_Entvar(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
}
示例15: Create_Int_Int_Str_Int_Int
int Create_Int_Int_Str_Int_Int(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_CELL, FP_DONE);
}