Raised This Month: $ Target: $400
 0% 

Dynamic prefix


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
seed
Junior Member
Join Date: Nov 2008
Location: Bulgaria !!!
Old 03-25-2011 , 16:39   Dynamic prefix
Reply With Quote #1

Hi, guys! I made a little test plugin, but it doesn't work. I tried to make dynamic prefixes for the message, but it didn't work. Can you tell me what have i done wrong? Here is the code:

Code:
#include <amxmodx>

new cvar_test, cvar_prefix

public plugin_init()
{
    register_plugin("Test", "1.0", "seed")
    
    cvar_test = register_cvar("test1", "1")
    cvar_prefix = register_cvar("test2", "dynamic")
    register_clcmd("say /test", "gotest")
}

public gotest(id)
{
    static testprefix[16]
    new testcheck, prefixc[16]
    get_pcvar_num(cvar_test)
    get_pcvar_string(cvar_prefix, prefixc, 15)
    if(testcheck == 1)
        formatex(testprefix, 15, "[1]")
    else if(testcheck == 2)    
        formatex(testprefix, 15, "[2]")
    else if(testcheck == 3)
        formatex(testprefix, 15, "%s", prefixc)
    client_print(id, print_chat, "%s asd", testprefix)
}
I want to make the prefix "[1]" when test1 cvar is 1, "[2]" when test1 cvar is 2 and if test1 cvar is 3 - the prefix gets test2's string.
seed 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 14:37.


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