Raised This Month: $12 Target: $400
 3% 

[Help] Very simple


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
The Professional
Member
Join Date: Nov 2015
Location: İstanbul
Old 03-03-2016 , 15:02   [Help] Very simple
Reply With Quote #1

I just want to get active For T team

I do not know how to use this command;
PHP Code:
if(cs_get_user_team(id) == CS_TEAM_T

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>

#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Alka"

#define STEP_DELAY 4.5

new Float:g_fNextStep[33];

#define MAX_SOUNDS 4 //Max num of sound for list below

new const g_szStepSound[MAX_SOUNDS][] = {
    
    
"zombie_plague/zombie_madness1.wav",
    
"zombie_plague/zombie_burn5.wav",
    
"zombie_plague/zombie_madness1.wav",
    
"zombie_plague/zombie_burn5.wav"
};

public 
plugin_init() {
    
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_forward(FM_PlayerPreThink"fwd_PlayerPreThink"0);
}

public 
plugin_precache()
{
    new 
i;
    for(
0MAX_SOUNDS i++)
        
precache_sound(g_szStepSound[i]);
}

public 
fwd_PlayerPreThink(id)
{
    if(!
is_user_alive(id))
        return 
FMRES_IGNORED;
    
    
set_pev(idpev_flTimeStepSound999);
    
    if(
g_fNextStep[id] < get_gametime())
    {
        if(
fm_get_ent_speed(id) && (pev(idpev_flags) & FL_ONGROUND))
            
emit_sound(idCHAN_BODYg_szStepSound[random(MAX_SOUNDS)], VOL_NORMATTN_STATIC0PITCH_NORM);
        
        
g_fNextStep[id] = get_gametime() + STEP_DELAY;
    }
    return 
FMRES_IGNORED;
}

stock Float:fm_get_ent_speed(id)
{
    if(!
pev_valid(id))
        return 
0.0;
    
    static 
Float:vVelocity[3];
    
pev(idpev_velocityvVelocity);
    
    
vVelocity[2] = 0.0;
    
    return 
vector_length(vVelocity);

__________________

Last edited by The Professional; 03-03-2016 at 15:04.
The Professional is offline
Artifact
Veteran Member
Join Date: Jul 2010
Old 03-03-2016 , 15:11   Re: [Help] Very simple
Reply With Quote #2

In public fwd_PlayerPreThink(id) command add
PHP Code:
if(get_user_team(id) == 2)
    return 
FMRES_IGNORED
get_user_team(id)
Code:
1 = Terrorist
2 = Counter-Terrorist
__________________

Last edited by Artifact; 03-03-2016 at 15:12.
Artifact is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 03-03-2016 , 16:12   Re: [Help] Very simple
Reply With Quote #4

I would advise to try avoid use magic numbers. https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/CONTRIBUTING.md#avoid-magic-numbers

Use the https://www.amxmodx.org/api/cstrike#counter-strike-team-id-constants.

As CS_TEAM_CT is from an enum, use _: to untag.
Code:
if(get_user_team(id) == _:CS_TEAM_CT)     return FMRES_IGNORED;
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective
addons_zz is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-04-2016 , 13:16   Re: [Help] Very simple
Reply With Quote #5

Quote:
Originally Posted by addons_zz View Post
I would advise to try avoid use magic numbers. https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/CONTRIBUTING.md#avoid-magic-numbers

Use the https://www.amxmodx.org/api/cstrike#counter-strike-team-id-constants.

As CS_TEAM_CT is from an enum, use _: to untag.
Code:
if(get_user_team(id) == _:CS_TEAM_CT)     return FMRES_IGNORED;
Lol, there is no magic number. Everyone should know that 1 is T team and 2 CT team. In this case, it's okay to write them directly.
__________________

Last edited by HamletEagle; 03-04-2016 at 13:16.
HamletEagle is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-04-2016 , 19:10   Re: [Help] Very simple
Reply With Quote #6

If the enum is available I'd rather see 'CS_TEAM_T' than '1'. Not saying I'd add the cstrike include just for that, but if it's there use it. I try to eliminate numbers that stand for things whenever I can, and do usually make enums.
__________________

Last edited by Bugsy; 03-04-2016 at 19:11.
Bugsy is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 03-05-2016 , 03:53   Re: [Help] Very simple
Reply With Quote #7

Look for fm_get_user_team if you don't want to include the cstrike module. It's actually the same, you will have to define function,team offsets and enum, I've seen it while scripting into biohazard source code, you can copy it from that plugin.
siriusmd99 is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 03-05-2016 , 17:33   Re: [Help] Very simple
Reply With Quote #9

OK champions calm, do not fight for me
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective
addons_zz is offline
Reply


Thread Tools
Display Modes

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 10:09.


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