Raised This Month: $ Target: $400
 0% 

Help NightVision Advanced BIOHAZARD


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mattyas
Junior Member
Join Date: Aug 2011
Location: Calarasi/Romanian
Old 10-02-2011 , 14:32   Help NightVision Advanced BIOHAZARD
Reply With Quote #1

Hello!

I would like to help me with bio_thermal_goggles not know how to do it so as to have only one class this nightvision (zombie can see human through walls with smoke).
I want to make this plugin class to the number 7. I do not know how to do ...
SMA:

Code:
#include <amxmodx>
#include <fakemeta_util>
#include <hamsandwich>
#include <biohazard>
#include <xs>

new Float:g_fDelay[33]
new g_ThermalOn[33]
new sprite_playerheat

new cvar_enable
new cvar_maxdistance
new cvar_updatedelay
new cvar_mode

static const PLUGIN_NAME[]     = "Thermal Imaging Goggle"
static const PLUGIN_AUTHOR[]     = "Cheap_Suit"
static const PLUGIN_VERSION[]    = "1.0"

new bool:players[33]

public plugin_init()
{
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
    is_biomod_active() ? plugin_init2() : pause("ad")
}
public plugin_init2()
{

    register_cvar(PLUGIN_NAME, PLUGIN_VERSION, FCVAR_SPONLY|FCVAR_SERVER)
    cvar_enable     = register_cvar("amx_tig_enable",     "1")
    cvar_maxdistance = register_cvar("amx_tig_distance",     "1000")
    cvar_updatedelay = register_cvar("amx_tig_updatedelay", "0.2")
    cvar_mode = register_cvar("amx_tig_mode", "1")
    
    RegisterHam(Ham_Player_PreThink, "player", "cheese_player_postthink", 1)
    register_event("NVGToggle", "Event_NVGToggle", "be")
}

public plugin_precache()
    sprite_playerheat = precache_model("sprites/poison.spr")

public Event_NVGToggle(id) {
    if (is_user_zombie(id))
        g_ThermalOn[id] = read_data(1)
}
public event_infect(victim, attacker) {

    if (get_pcvar_num(cvar_mode)) {
        players[victim] = attacker == 0 ? true : false
    }
    else
        players[victim] = true
}
public cheese_player_postthink(id)
{
    if(!is_user_alive(id) || !g_ThermalOn[id] || !get_pcvar_num(cvar_enable) || !players[id])
        return HAM_IGNORED
        
    if((g_fDelay[id] + get_pcvar_float(cvar_updatedelay)) > get_gametime())
        return HAM_IGNORED
    
    g_fDelay[id] = get_gametime()
    
    static Float:fMyOrigin[3]
    pev(id, pev_origin, fMyOrigin)
    
    static i; 
    static Players[32], iNum
    
    get_players(Players, iNum, "a")
    for(i = 0; i < iNum; ++i) if(id != Players[i])
    {
        static target ; target = Players[i]
        
        if (!is_user_zombie(target)) {
            static Float:fTargetOrigin[3]
            pev(target, pev_origin, fTargetOrigin)
            
            if((get_distance_f(fMyOrigin, fTargetOrigin) > get_pcvar_num(cvar_maxdistance)) 
            || !fm_is_in_viewcone(id, fTargetOrigin))
                continue

            static Float:fMiddle[3], Float:fHitPoint[3]
            xs_vec_sub(fTargetOrigin, fMyOrigin, fMiddle)
            fm_trace_line(-1, fMyOrigin, fTargetOrigin, fHitPoint)
                                    
            static Float:fWallOffset[3], Float:fDistanceToWall
            fDistanceToWall = vector_distance(fMyOrigin, fHitPoint) - 10.0
            normalize(fMiddle, fWallOffset, fDistanceToWall)
            
            static Float:fSpriteOffset[3]
            xs_vec_add(fWallOffset, fMyOrigin, fSpriteOffset)
            static Float:fScale, Float:fDistanceToTarget; fDistanceToTarget = vector_distance(fMyOrigin, fTargetOrigin)
            if(fDistanceToWall > 100.0)
                fScale = 8.0 * (fDistanceToWall / fDistanceToTarget)
            else
                fScale = 2.0
        
            te_sprite(id, fSpriteOffset, sprite_playerheat, floatround(fScale), 125)
        }
    }
    return HAM_IGNORED
}

stock te_sprite(id, Float:origin[3], sprite, scale, brightness)
{
    message_begin(MSG_ONE, SVC_TEMPENTITY, _, id)
    write_byte(TE_SPRITE)
    write_coord(floatround(origin[0]))
    write_coord(floatround(origin[1]))
    write_coord(floatround(origin[2]))
    write_short(sprite)
    write_byte(scale) 
    write_byte(brightness)
    message_end()
}

stock normalize(Float:fIn[3], Float:fOut[3], Float:fMul)
{
    static Float:fLen ; fLen = xs_vec_len(fIn)
    xs_vec_copy(fIn, fOut)
    
    fOut[0] /= fLen, fOut[1] /= fLen, fOut[2] /= fLen
    fOut[0] *= fMul, fOut[1] *= fMul, fOut[2] *= fMul
}
Please soul.
Attached Files
File Type: sma Get Plugin or Get Source (bio_thermal_goggles.sma - 564 views - 3.5 KB)

Last edited by Mattyas; 10-02-2011 at 14:35.
Mattyas is offline
Send a message via MSN to Mattyas Send a message via Yahoo to Mattyas Send a message via Skype™ to Mattyas
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 19:44.


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