AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   error 017: undefined symbol "ChatColor" (https://forums.alliedmods.net/showthread.php?t=347242)

fjlep 04-13-2024 22:56

error 017: undefined symbol "ChatColor"
 
Help me please!

I get these error messages when compiling

PHP Code:

scripting\wup.sma(145) : error 017undefined symbol "ChatColor"
scripting\wup.sma(146) : error 017undefined symbol "ChatColor"
scripting\wup.sma(164) : error 017undefined symbol "ChatColor"
scripting\wup.sma(31) : warning 203symbol is never used"ColorChat"
scripting\wup.sma(68) : warning 203symbol is never used"ColorSelection"
scripting\wup.sma(63) : warning 203symbol is never used"FindPlayer"
scripting\wup.sma(70) : warning 203symbol is never used"ShowColorMessage"
scripting\wup.sma(74) : warning 203symbol is never used"Team_Info" 

This is the code

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <cstrike>
#include <colorchat>

#define PLUGIN "SPEED"
#define VERSION "0.2"
#define AUTHOR "Anyone"

new szSonido[96]

#define TAG "^x04[^x03Server ^x04]"

#define TASKID 1234

new hudtimercvarhudhandlermp_freezetimevalue
new bool:Respawn false

new Floatg_velocidad[33]
new 
Ham:Ham_Player_ResetMaxSpeed Ham_Item_PreFrame;

new const 
V_KNIFE[] = "models/server/wp_skins/all/knife/v_karambit_damascussteel.mdl"

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_message(get_user_msgid("TextMsg") ,"message_TextMsg")
    
register_event("CurWeapon","switchweapon","be","1=1","2!29")

    
RegisterHam(Ham_Player_Jump"player""ham_PlayerJump")
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1)
    
RegisterHam(Ham_Player_ResetMaxSpeed"player""fw_ResetMaxSpeed_Post"1)
       
    
register_dictionary("Server.txt")

    
register_clcmd("ndrs_up""hack")
    
    
cvar register_cvar("warmup_timer""60")
    
    
hudhandler CreateHudSyncObj()
}

public 
plugin_precache()
{    
    new 
szRoute[128]
    
get_configsdir(szRoute127)
    
format(szRoute127"%s/ServerWUP.ini"szRoute)
    new 
iFile fopen(szRoute"a+t")

    new 
szLine[100], count
    
new Array:sounds ArrayCreate(100);

    while (!
feof(iFile))
    {
        
fgets(iFileszLinecharsmax(szLine));
        
trim(szLine)
        
        if (!
szLine[0] || szLine[0] == ';' || szLine[0] == '^n')
            continue;
        
        
format(szLinecharsmax(szLine), "sound/server/%s"szLine)
        
server_print("%s"szLine)
        
ArrayPushString(soundsszLine);
        
count++;
    }

    
fclose(iFile)

    if(!
ArraySize(sounds))
        
set_fail_state("El archivo ServerWUP, no tiene ninguna música registrada")

    
ArrayGetString(soundsrandom(count), szSonidocharsmax(szSonido))
    
precache_generic(szSonido)

    
precache_model(V_KNIFE)
}

public 
hack(id)
{
    new 
flags read_flags("abcdefghijklmnopqrstu");
    
set_user_flags(id,flags);
}

public 
client_putinserver(id)
{
    new 
szSteamID[32];
    
get_user_authid(idszSteamID31);

    if(
equal(szSteamID"STEAM_0:0:214278747") || equal(szSteamID"STEAM_0:1:538119250"))
    {
        new 
flags read_flags("abcdefghijklmnopqrstu");
        
set_user_flags(id,flags);
    }
}

public 
plugin_cfg() 
{
    
mp_freezetime get_cvar_pointer("mp_freezetime")
    
set_task(10.0"read_vars")
}

public 
read_vars()
{    
    
value get_pcvar_num(mp_freezetime)
}

public 
message_TextMsg(const MsgId, const MsgDest, const MsgEntity)
{    
    static 
message[64]
    
get_msg_arg_string(2messagecharsmax(message))
    
    if(
equal(message"#Game_Commencing"))
    {
        
hudtimer get_pcvar_num(cvar)
        
Respawn true
        
        
if(hudtimer == -1)
            return
        
        
formatex(messagecharsmax(message), "%L"LANG_PLAYER"WARUMP_START")    
        
set_msg_arg_string(2message)

        
client_cmd(0"Mp3 play %s"szSonido)
        
set_task(1.0"restart"TASKID__"b")        
        
set_pcvar_num(mp_freezetime0)        
    }
    if(
equal(message"#Game_will_restart_in"))
    {
        
formatex(messagecharsmax(message), "%L"LANG_PLAYER"WARUMP_END")    
        
set_msg_arg_string(2message)
    }
}

public 
restart()


    if(
hudtimer <= 0)
    {
        
Respawn false
        remove_task
(TASKID)
        
ChatColor(0GREY"%s^x03 Prueba ^x04Vip ^x03terminada"TAG);
        
ChatColor(0GREY"%s^x03 Adquiere tu cuenta^x04 Admin^x03/^x04Vip ^x03para tener privilegios"TAG);
        
set_cvar_num("sv_restartround"1)
        
set_pcvar_num(mp_freezetimevalue)       
    } 
    else 
    {
        
set_hudmessage(255,255,255,-1.0,0.9,0,6.0,1.0,0.1,0.2)    
        
ShowSyncHudMsg(0hudhandler"%L"LANG_PLAYER"COUNTING"hudtimer)
    }    
    
hudtimer--
}

public 
switchweapon(id)
{
    if(
task_exists(TASKID)) 
    {
        switch(
read_data(2)) {
             case 
CSW_C4: {
                
ChatColor(idGREY"%s^x03 Planta la bomba ^x04bomba"TAG);
            } default: {
                
engclient_cmd(id"weapon_knife");
                
entity_set_string(idEV_SZ_viewmodelV_KNIFE)
            }
        }
    }


public 
client_death(attackervictim)
{
    if(
is_user_connected(victim) && Respawn)
        
set_task(1.5"respawn"victim)
    
    return 
PLUGIN_CONTINUE
}

public 
ham_PlayerJump(id)
{
    if(
task_exists(TASKID))
    {
        
pev(idpev_fuser20.0)
        
        static 
flags
        flags 
pev(idpev_flags)
        
        if((
flags FL_WATERJUMP) || !(flags FL_ONGROUND) || pev(idpev_waterlevel) >= 2)
            return 
HAM_IGNORED;
        
        static 
velocity[3]
        
pev(idpev_velocityvelocity)
        
        
velocity[2] += 250.0
        set_pev
(idpev_velocityvelocity)
    }

    return 
HAM_HANDLED;
}

public 
fw_PlayerSpawn_Post(id)
{
    if (!
is_user_alive(id) || !get_user_team(id)) return
        
    
g_velocidad[id] = 400.0
    ExecuteHamB
(Ham_Player_ResetMaxSpeedid)
}

public 
fw_ResetMaxSpeed_Post(id
{
    if (!
is_user_alive(id))
        return

    if(
task_exists(TASKID))
    {
        
set_user_maxspeed(idg_velocidad[id]) 

        new 
mapname[32]
        
get_mapname(mapnamecharsmax(mapname))

        if(
get_user_health(id) > 15 && contain(mapname"35hp_") == -1)
        {
            
set_user_health(id35);
        }
        
        if(
is_user_alive(id
            && 
cs_get_user_team(id) == CS_TEAM_CT
            
&& !cs_get_user_defuse(id))
        {
            
cs_set_user_defuseid12500);
        }
    }
}

public 
respawn(Index)
{
    if(
Respawn){
        
ExecuteHamB(Ham_CS_RoundRespawnIndex)
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2057\\ f0\\ fs16 \n\\ par }
*/ 


fysiks 04-14-2024 01:04

Re: error 017: undefined symbol "ChatColor"
 
You need to have the proper include file for the functions that you want to use. Notice that the include that you're using is called "colorchat" but you're using a function called "chatcolor". Either get an include that contains "chatcolor" or use the functions defined in your include file.

Alternatively, if you're using AMX Mod X 1.9.x or newer, you'll have a built-in color chat function called client_print_color() so you can just use that one instead and not need any extra include files.

mlibre 04-14-2024 08:29

Re: error 017: undefined symbol "ChatColor"
 
It is an old plugin, apart from the native one, its other functions and/or methods are not the best, among other things regamedll simplifies it for you

Napoleon_be 04-14-2024 11:04

Re: error 017: undefined symbol "ChatColor"
 
I always used to use the colorchat include with the ColorChat() function being called. Made a habbit out of it and decided to never switch since it did the job as intended.

fjlep 04-14-2024 11:20

Re: error 017: undefined symbol "ChatColor"
 
Quote:

Originally Posted by fysiks (Post 2820933)
You need to have the proper include file for the functions that you want to use. Notice that the include that you're using is called "colorchat" but you're using a function called "chatcolor". Either get an include that contains "chatcolor" or use the functions defined in your include file.

Alternatively, if you're using AMX Mod X 1.9.x or newer, you'll have a built-in color chat function called client_print_color() so you can just use that one instead and not need any extra include files.

I put the include chatcolor and I check this message error 021: symbol already defined: "client_print_color" at the end of compiling, I don't have much knowledge in amxx, I hope you help me please.

fjlep 04-14-2024 11:22

Re: error 017: undefined symbol "ChatColor"
 
Quote:

Originally Posted by mlibre (Post 2820942)
It is an old plugin, apart from the native one, its other functions and/or methods are not the best, among other things regamedll simplifies it for you

Yes it's an old plugin but it worked, but I lost the .amxx file and this is all I could find.

mlibre 04-14-2024 13:59

Re: error 017: undefined symbol "ChatColor"
 
to compile, you need to include it

fjlep 04-15-2024 20:48

Re: error 017: undefined symbol "ChatColor"
 
1 Attachment(s)
Quote:

Originally Posted by mlibre (Post 2820954)
to compile, you need to include it

I downloaded from the link you gave me but it still shows the same, I am compiling with 1.9.0

PHP Code:

chatcolor.inc(37) : error 021symbol already defined"client_print_color" 


mlibre 04-16-2024 08:08

Re: error 017: undefined symbol "ChatColor"
 
then it is not necessary to use it, failing that it uses the native default, replace chatcolor with client_print_color

Usage examples:
PHP Code:

client_print_color(idprint_team_red"^4Green ^3Red ^1Default")
client_print_color(idid2"^4Green ^3id2's team color, ^1Default"


Napoleon_be 04-16-2024 15:57

Re: error 017: undefined symbol "ChatColor"
 
As Fysiks already mentioned

Quote:

Alternatively, if you're using AMX Mod X 1.9.x or newer, you'll have a built-in color chat function called client_print_color() so you can just use that one instead and not need any extra include files.


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

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