amxmodx/plugins/testsuite/fwdtest1.sma

55 lines
1.0 KiB
Plaintext
Raw Permalink Normal View History

2006-06-11 08:57:39 +00:00
#include <amxmodx>
new g_forward
new g_id
public plugin_init()
{
g_id = register_plugin("Foward Test (Master)", "1.0", "Belsebub")
}
public plugin_natives()
{
register_native("test_createforward", "test_createforward_handler")
register_native("test_executeforward", "test_executeforward_handler")
}
//test_createforward(function[])
public test_createforward_handler(pluginid, numparams)
{
server_print("(test_createforward_handler: %d,%d)", pluginid, numparams)
new function[32]
get_string(1, function, 31)
2006-06-11 09:01:30 +00:00
if (g_forward > 0)
{
DestroyForward(g_forward)
}
2006-06-11 08:57:39 +00:00
g_forward = CreateOneForward(pluginid, function)
2006-06-11 09:01:30 +00:00
if (g_forward < 0)
{
server_print("Failed to create forward!")
}
2006-06-11 08:57:39 +00:00
}
//test_executeforward()
public test_executeforward_handler(pluginid, numparams)
{
new retval
server_print("(test_executeforward_handler: %d,%d)", pluginid, numparams)
if (!ExecuteForward(g_forward, retval))
{
server_print("failed to execute forward (I'm %d)", g_id)
}
2006-06-11 09:01:30 +00:00
if (g_forward > 0)
{
DestroyForward(g_forward)
g_forward = -1
}
2006-06-11 08:57:39 +00:00
}