Quote:
Originally Posted by fysiks
Show your test code.
|
Main Plugin:
PHP Code:
#include <amxmodx>
new iGlobalPrefix;
public plugin_init()
{
register_plugin("Test Code", "0.1", "kostov");
// Global prefix
iGlobalPrefix = register_cvar("amx_mode_prefix", "[Prefix]");
}
public plugin_natives()
{
register_library("prefix");
register_native("get_server_prefix", "native_get_server_prefix");
}
public native_get_server_prefix()
{
new iPrefix[64];
get_pcvar_string(iGlobalPrefix, iPrefix, sizeof iPrefix - 1);
set_string(1, iPrefix, get_param(2));
}
Main library
PHP Code:
#if defined _prefix_included
#endinput
#endif
#define _prefix_included
#if !defined charsmax
#define charsmax(%1) sizeof(%1)-1
#endif
native get_server_prefix();
Test Plugin:
PHP Code:
#include <amxmodx>
#include <prefix>
public plugin_init()
{
register_plugin("Test Plugin", "0.1", "kostov");
register_clcmd("say /prefix", "TestFunc");
}
public TestFunc(id)
{
client_print(id, print_chat, "%s test message", get_server_prefix());
}
And result:
Code:
Kostov : /prefix
test messages