AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with my plugin (probably random func) (https://forums.alliedmods.net/showthread.php?t=129589)

obiwan 06-14-2010 12:19

Problem with my plugin (probably random func)
 
Hey, i have problem with plugin. I wrote a simply plugin which types a message every 30 seconds, but it doesnt work properly.

code:

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <colorchat>
#include <Vexd_Utilities>

new hostName;
new 
zapraszamy;

public 
plugin_init() {
    
     
    
register_cvar("amx_tag""[cs.obiwanek.pl]")
    
register_cvar("amx_link""cs.obiwanek.pl")
     
    
set_task(30.0,"spam",_,_,_,"b")

    
hostName get_cvar_num("amx_tag")
    
zapraszamy get_cvar_num("amx_link")

    return 
PLUGIN_CONTINUE
    
}


public 
spam()
{
    switch(
random(3))
    {
        case 
0ColorChat(0RED,"%s^x01 Please visit our site^x04 %s."hostNamezapraszamy);
        case 
1ColorChat(0RED"%s^x03 xxxxxxxxxxxxxxxxxxxxxx."hostName);
        case 
2ColorChat(0BLUE,"%s^x01 xxxxxxxxxxxxxxxxxxxxxxxx"hostName);
    }



I would like to make it say something like (thats only example)
Code:

[cs.obiwanek.pl] Please visit our site cs.obiwanek.pl.
But it says
Code:

Please visit our site .
What I did wrong ? Its not full plugin, but i think that's most important.

t3hNox 06-14-2010 12:28

Re: Problem with my plugin (probably random func)
 
As you want to return text from these cvars, you should use get_cvar_string instead of get_cvar_num.

obiwan 06-14-2010 13:03

Re: Problem with my plugin (probably random func)
 
Quote:

Originally Posted by t3hNox (Post 1208526)
As you want to return text from these cvars, you should use get_cvar_string instead of get_cvar_num.

thank you! :D

Alucard^ 06-14-2010 13:31

Re: Problem with my plugin (probably random func)
 
No, you should use get_pcvar_string( ), USE PCVARS!


All times are GMT -4. The time now is 14:42.

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