Raised This Month: $ Target: $400
 0% 

other semiclip options


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 08-08-2009 , 10:40   other semiclip options
Reply With Quote #1

Here is deathrun semiclip code(separated):
Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>

#define PLUGIN "semiclip"
#define VERSION "1.0"
#define AUTHOR "danielkza"

new g_iSemiClip[33]

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_forward( FM_StartFrame,    "fwStartFrame",    0);
    register_forward( FM_AddToFullPack,    "fwFullPack",    1 );

}
    public fwFullPack( es, e, ent, host, flags, player, pSet ) {
    if( player && g_iSemiClip[ent] && g_iSemiClip[host] ) {
        static Float:flDistance;
        flDistance = entity_range( host, ent );
        
        set_es( es, ES_Solid, SOLID_NOT );
        set_es( es, ES_RenderMode, kRenderTransAlpha );
        set_es( es, ES_RenderAmt, floatround( flDistance * 1.5 ) );
    }
    return FMRES_IGNORED;
}
public fwStartFrame(id) {
    static iPlayers[32], iNum, iPlayer, iPlayer2;
    get_players(iPlayers, iNum);
    
    arrayset(g_iSemiClip, 0, sizeof(g_iSemiClip));
    
    new iTeams[33] = {-1, ...};
    for( new i = 0; i < iNum; i++ ) {
        iPlayer = iPlayers[i];
        
        if( !is_user_alive(iPlayer) )
            continue;
        
        for( new j = 0; j < iNum; j++ ) {
            iPlayer2 = iPlayers[j];
            
            if(iPlayer == iPlayer2 || !is_user_alive(iPlayer2))
                continue;
            
            static Float:vOrigin1[3], Float:vOrigin2[3];
            pev(iPlayer, pev_origin, vOrigin1);
            pev(iPlayer2, pev_origin, vOrigin2);
            
            if( vector_distance( vOrigin1, vOrigin2 ) < 96 ) {
                if( iTeams[iPlayer] == -1 )
                    iTeams[iPlayer]        = get_user_team(iPlayer);
                if( iTeams[iPlayer2] == -1 )
                    iTeams[iPlayer2]    = get_user_team(iPlayer2);
                
                if( iTeams[iPlayer] == 2 && iTeams[iPlayer2] == 2 ) {
                    g_iSemiClip[iPlayer]    = true;
                    g_iSemiClip[iPlayer2]    = true;
                }
            }
        }
    }
    
    for( new i = 0; i < iNum; i++ ) {
        iPlayer = iPlayers[i];
        
        if( is_user_alive( iPlayer ) )
            set_pev(iPlayer, pev_solid, g_iSemiClip[iPlayer] ? SOLID_NOT : SOLID_SLIDEBOX);
    }
    
    return FMRES_IGNORED;
}
Can anyone make me a cvar, that allows me to choose these things:
-semiclip off
-semiclip works only on players form your team
-semiclip works only for CT's(not really necessary)
-semiclip works for everyone(using this code it works only for CT's)
__________________
naven.com.pl
"At the end of the day, there are always going to be mental disorders and people who cause violence for no other reason than the fact that they're fucked up and lost. And all we can do is try to learn from it." Corey Taylor.
naven is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-08-2009 , 10:45   Re: other semiclip options
Reply With Quote #2

Since you are in the scripting section, it means you are willing to learn.

To register a cvar, use register_cvar().

Fast exemple :
Code:
new gCvarSemiClip; // [...] // In plugin_init() gCvarSemiClip = register_cvar( "semiclip_enabled", "1" ); // [...] // In your function. if ( get_pcvar_num( gCvarSemiClip ) ) { }
__________________

Last edited by Arkshine; 08-08-2009 at 10:47.
Arkshine is offline
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 08-08-2009 , 13:04   Re: other semiclip options
Reply With Quote #3

Well, I know how to do cvars, but I don't know how to change in this code thing that does team matter...
__________________
naven.com.pl
"At the end of the day, there are always going to be mental disorders and people who cause violence for no other reason than the fact that they're fucked up and lost. And all we can do is try to learn from it." Corey Taylor.
naven is offline
Reply



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 18:26.


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