• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ MF_RegisterSPForwardByName函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MF_RegisterSPForwardByName函数的典型用法代码示例。如果您正苦于以下问题:C++ MF_RegisterSPForwardByName函数的具体用法?C++ MF_RegisterSPForwardByName怎么用?C++ MF_RegisterSPForwardByName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了MF_RegisterSPForwardByName函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:ShootingKing-AM,项目名称:ThreadedSockets,代码行数:36,代码来源:sockets.cpp


示例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;
}
开发者ID:9iky6,项目名称:amxmodx,代码行数:29,代码来源:engine.cpp


示例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);
}
开发者ID:aleckalexandru,项目名称:Hamsandwich-Update,代码行数:8,代码来源:hook_native.cpp


示例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;
}
开发者ID:9iky6,项目名称:amxmodx,代码行数:16,代码来源:engine.cpp


示例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;
}
开发者ID:Arkshine,项目名称:CSDM,代码行数:17,代码来源:csdm_natives.cpp


示例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;
}
开发者ID:9iky6,项目名称:amxmodx,代码行数:17,代码来源:engine.cpp


示例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;
}
开发者ID:Chuvi-w,项目名称:amxmodx,代码行数:46,代码来源:threading.cpp


示例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;
}
开发者ID:Arkshine,项目名称:CSDM,代码行数:19,代码来源:csdm_natives.cpp


示例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;
}
开发者ID:ShootingKing-AM,项目名称:ThreadedSockets,代码行数:21,代码来源:sockets.cpp


示例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;
}
开发者ID:ShootingKing-AM,项目名称:ThreadedSockets,代码行数:37,代码来源:sockets.cpp


示例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);
}
开发者ID:joaquimandrade,项目名称:Hamsandwich-Update,代码行数:4,代码来源:hook_create.cpp


示例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);
}
开发者ID:joaquimandrade,项目名称:Hamsandwich-Update,代码行数:4,代码来源:hook_create.cpp


示例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);
}
开发者ID:joaquimandrade,项目名称:Hamsandwich-Update,代码行数:4,代码来源:hook_create.cpp


示例14: Create_Int_Entvar

int Create_Int_Entvar(AMX *amx, const char *func)
{
    return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
}
开发者ID:joaquimandrade,项目名称:Hamsandwich-Update,代码行数:4,代码来源:hook_create.cpp


示例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);
}
开发者ID:joaquimandrade,项目名称:Hamsandwich-Update,代码行数:4,代码来源:hook_create.cpp


示例16: Create_Int_Float_Int_Int

int Create_Int_Float_Int_Int(AMX *amx, const char *func)
{
    return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
}
开发者ID:joaquimandrade,项目名称:Hamsandwich-Update,代码行数:4,代码来源:hook_create.cpp


示例17: Create_Void_Cbase

int Create_Void_Cbase(AMX *amx, const char *func)
{
    return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
}
开发者ID:joaquimandrade,项目名称:Hamsandwich-Update,代码行数:4,代码来源:hook_create.cpp


示例18: Create_Vector_Vector_Vector_Vector

int Create_Vector_Vector_Vector_Vector(AMX *amx, const char *func)
{
    return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_ARRAY, FP_DONE);
}
开发者ID:joaquimandrade,项目名称:Hamsandwich-Update,代码行数:4,代码来源:hook_create.cpp



注:本文中的MF_RegisterSPForwardByName函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MG函数代码示例发布时间:2022-05-30
下一篇:
C++ MF_LogError函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap