AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Is The Compiler Racist? (https://forums.alliedmods.net/showthread.php?t=117874)

wrecked_ 02-05-2010 15:53

Is The Compiler Racist?
 
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.

DruGzOG 02-05-2010 16:23

Re: Is The Compiler Racist?
 
colorchat isnt included in the web compiler...

YamiKaitou 02-05-2010 16:30

Re: Is The Compiler Racist?
 
In addition to what DruGzOG said, you forgot to #include <colorchat>

r4ndomz 02-05-2010 16:34

Re: Is The Compiler Racist?
 
Ahh...Im in the credits! Looks good. But will one of us be ranted about having it being done before?

Hey you spelled my name wrong! It's r4nDoMz lol.

BTW:
Yours looks alot better than mine. Also your thing says your a senior member yet your join date is Jan. 2010?

Mind if i use your no-team-hitting idea?

wrecked_ 02-05-2010 16:41

Re: Is The Compiler Racist?
 
I am aware that the compiler doesn't ahve colorchat included, but I figured if I put the stock into the plugin, it wouldn't be an issue. If I'm not mistaken, I've seen many people do it without #include <colorchat>.

@r4ndomz It hasn't been made with the unit conversions + unit velocity settings. I'm sure we'll only get 1 or two of them. Yes, you're welcome to do so. Senior member & Veteran member and all that jazz is based on amount of posts (encourages assisting others and getting work done). 100 = Senior, 500 = Vet

Thanks for the help guys.

ConnorMcLeod 02-05-2010 16:58

Re: Is The Compiler Racist?
 
colorchat is include in this compiler : http://webcomp.ak-team.com/index.php

wrecked_ 02-05-2010 17:02

Re: Is The Compiler Racist?
 
grenadeslap.sma(26) : fatal error 100: cannot read from file: "colorchat"

r4ndomz 02-05-2010 17:13

Re: Is The Compiler Racist?
 
Quote:

Originally Posted by wrecked_ (Post 1079672)
I am aware that the compiler doesn't ahve colorchat included, but I figured if I put the stock into the plugin, it wouldn't be an issue. If I'm not mistaken, I've seen many people do it without #include <colorchat>.

@r4ndomz It hasn't been made with the unit conversions + unit velocity settings. I'm sure we'll only get 1 or two of them. Yes, you're welcome to do so. Senior member & Veteran member and all that jazz is based on amount of posts (encourages assisting others and getting work done). 100 = Senior, 500 = Vet

Thanks for the help guys.

Then you must be crazy active here =)

wrecked_ 02-05-2010 17:16

Re: Is The Compiler Racist?
 
Quote:

Originally Posted by r4ndomz (Post 1079706)
Then you must be crazy active here =)

Dedication.

r4ndomz 02-05-2010 17:17

Re: Is The Compiler Racist?
 
Quote:

Originally Posted by wrecked_ (Post 1079715)
Dedication.

Nice


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

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