Raised This Month: $ Target: $400
 0% 

Problem to return string from nativ


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
kostov
Member
Join Date: Jan 2010
Location: Bulgaria, Sofia
Old 07-01-2012 , 06:52   Re: Problem to return string from nativ
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
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(iGlobalPrefixiPrefixsizeof iPrefix 1); 
    
set_string(1iPrefixget_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(idprint_chat"%s test message"get_server_prefix());

And result:
Code:
Kostov : /prefix
 test messages
kostov is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:18.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode