Raised This Month: $ Target: $400
 0% 

Is The Compiler Racist?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-05-2010 , 15:53   Is The Compiler Racist?
Reply With Quote #1

Well, I've been modifying this plugin on and off for the past day or two, and I implemented ColorChat but it seems for some reason, when I do this, the compiler doesn't pick up my Ham Registries.

Here's the code, line 1 to the end.
PHP Code:
/*       Grenade Slaps @ wrecked

    Personal Hungarian Notation:
    pl_    = Player Index
    pCvar_    = PCvar...
    reg_    = Engine registry
    hfw_    = Ham Forward
    e_    = Entity
    
    Credits:
    Exolent[jNr]     - Help with the unit conversion and the idea
    r4nd0mz        - Original and simple idea
    
    Changelog:
    v0.1.0        - Plugin start + Dumb user_slap command
    v0.1.1        - Distance calculator + ColorChat
*/

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

enum Color
{
    
NORMAL 1,
    
GREEN,
    
TEAM_COLOR,
    
GREY,
    
RED,
    
BLUE,
}

new const 
VERSION[] = "0.0.1"

// Pcvars
new pCvar_SlapDmg
new pCvar_Prefix

// Origins
new Float:f_ThrowOrigin]
new 
Float:f_HitOrigin]
new 
Float:f_SlapVelocity]

// Player names
new sz_ThrowerName64 ]

new 
pl_Owner

new ownerTeam

public plugin_init()
{
    
register_plugin("Grenade Slap"VERSION"wrecked"// <--- This guy's cool
    
    
pCvar_SlapDmg register_cvar"gs_damage""25" )
    
pCvar_Prefix register_cvar"gs_prefix""[NADE]" )
    
    
register_touch"grenade""player""reg_NadeTouch" // When it hits the reciever
    
    
RegisterHamHam_Weapon_PrimaryAttack"weapon_hegrenade""hfw_NadeThrow"// If the user throws a nade, we get the origin of it in the function
    
RegisterHamHam_Weapon_PrimaryAttack"weapon_flashbang""hfw_NadeThrow")
    
RegisterHamHam_Weapon_PrimaryAttack"weapon_smokegrenade""hfw_NadeThrow")
}

public 
reg_NadeTouche_NadeHitpl_Receiver )
{
    new 
hitTeam cs_get_user_teampl_Receiver )
    
    if( 
ownerTeam == hitTeam )
    {
        return;
    }
    else
    {
    
peve_NadeHitpev_originf_HitOrigin // Get the origin of the nade as it hits the reciever, pl_Player
    
    
new iHealth get_user_healthpl_Receiver )
    
    new 
sz_ReceiverName64 ]
    
get_user_namepl_Receiversz_ReceiverNamecharsmaxsz_ReceiverName ) )
    
    new 
Float:f_NadeDistance get_distance_ff_ThrowOriginf_HitOrigin // Get the distance
    
    
f_SlapVelocity[0] = f_NadeDistance * ( random_num(0,1) ? 1.0 : -1.0 // Set velocity of the slap based on the distance
    
f_SlapVelocity[1] = f_NadeDistance * ( random_num(0,1) ? 1.0 : -1.0 )
    
f_SlapVelocity[2] = f_NadeDistance * ( random_num(0,1) ? 1.0 : -1.0 )
    
    
set_user_healthpl_ReceiveriHealth get_pcvar_numpCvar_SlapDmg ) ) // Slap damage
    
    
set_pevpl_Receiverpev_velocityf_SlapVelocity // Blast off!
    
    
if( f_NadeDistance 499.9 )
    {
        
ColorChat0RED"%s Wow! %s just hit %s with a nade from %f units away!"pCvar_Prefixsz_ThrowerNamesz_ReceiverNamef_NadeDistance )
    }
}

public 
hfw_NadeThrowe_NadeThrown )
{
    
peve_NadeThrownpev_originf_ThrowOrigin // Get the origin of the nade right as it is thrown
    
    
peve_NadeThrownpev_ownerpl_Owner // Get ID of player who throws the nade
    
    
ownerTeam cs_get_user_teampl_Owner // His team
    
    
get_user_namepl_Ownersz_ThrowerNamecharsmaxsz_ThrowerName ) ) // His name
}

stock ColorChat(idColor:type, const msg[], {Float,Sql,Result,_}:...)
{
    new 
message[256];

    switch(
type)
    {
        case 
NORMAL// clients scr_concolor cvar color
        
{
            
message[0] = 0x01;
        }
        case 
GREEN// Green
        
{
            
message[0] = 0x04;
        }
        default: 
// White, Red, Blue
        
{
            
message[0] = 0x03;
        }
    }

    
vformat(message[1], 251msg4);

    
// Make sure message is not longer than 192 character. Will crash the server.
    
message[192] = '^0';

    new 
teamColorChangeindexMSG_Type;
    
    if(
id)
    {
        
MSG_Type MSG_ONE;
        
index id;
    } else {
        
index FindPlayer();
        
MSG_Type MSG_ALL;
    }
    
    
team get_user_team(index);
    
ColorChange ColorSelection(indexMSG_Typetype);

    
ShowColorMessage(indexMSG_Typemessage);
        
    if(
ColorChange)
    {
        
Team_Info(indexMSG_TypeTeamName[team]);
    }

and here are the errors that I get when trying to compile:
Code:
/home/groups/amxmodx/tmp3/phpe35uKY.sma(73) : warning 213: tag mismatch
/home/groups/amxmodx/tmp3/phpe35uKY.sma(98) : error 017: undefined symbol "ColorChat"
/home/groups/amxmodx/tmp3/phpe35uKY.sma(102) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/phpe35uKY.sma(102) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/phpe35uKY.sma(102) : error 017: undefined symbol "hfw_NadeThrow"
/home/groups/amxmodx/tmp3/phpe35uKY.sma(104) : error 017: undefined symbol "e_NadeThrown"
/home/groups/amxmodx/tmp3/phpe35uKY.sma(104) : warning 215: expression has no effect
/home/groups/amxmodx/tmp3/phpe35uKY.sma(104) : warning 215: expression has no effect
/home/groups/amxmodx/tmp3/phpe35uKY.sma(104) : error 001: expected token: ";", but found ")"
/home/groups/amxmodx/tmp3/phpe35uKY.sma(104) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/phpe35uKY.sma(104) : fatal error 107: too many error messages on one line

Compilation aborted.
I seem to recall my friend saying that the compiler doesn't have colorchat included, but I figured it wouldn't have any effect on the stock. Could it be that? If it is, why would the compiler completely disregard my HamRegistries just because it doesn't like the stock?

PS : It compiled perfectly fine before I added the colorchat.
7 Errors.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ 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:18.


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