Raised This Month: $ Target: $400
 0% 

cvar prefix


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
bazhenov93
Veteran Member
Join Date: Oct 2010
Old 04-16-2012 , 01:02   cvar prefix
Reply With Quote #1

I have this
PHP Code:
new g_cPrefix

public plugin_init() { 
g_cPrefix register_cvar("server_prefix""Server Name")

public 
func() { 
new 
szPrefix[10]
get_pcvar_string(g_cPrefixszPrefixcharsmax(szPrefix))
client_print(0print_chat"[ %s ] test"szPrefix)

And this:
PHP Code:
#define SERVER_PREFIX

#if defined SERVER_PREFIX
new const Prefix[] = "Server Name" // with prefix
#else
new const Prefix[] = "" // without prefix
#endif

new etc_Prefix

public plugin_init() {
register_clcmd("say /test""test")
etc_Prefix register_cvar("use_prefix""1")
}
public 
test(id) {
if(
get_pcvar_num(cvar_prefijo))
client_print(idprint_chat"[ %s ] Prefix is enabled"Prefix)
else
client_print(idprint_chat"Prefix not enabled")

I need a better way, for example:

PHP Code:
// bad coded I know, but i'm giving an example of what I want
new g_cPrefix

public plugin_init() { 
g_cPrefix register_cvar("server_prefix""Server Name" 1"" 0)

public 
enabled() { 
get_pcvar_string(g_cPrefixszPrefixcharsmax(szPrefix))
if 
1
client_print
(0print_chat"[ %s ] test"szPrefix)
}
public 
not_enabled() { 
get_pcvar_string(g_cPrefixszPrefixcharsmax(szPrefix))
if 
0
client_print
(0print_chat"test")

bazhenov93 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 07:41.


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