Raised This Month: $ Target: $400
 0% 

Plugin bio_thermal_goggles Add to a certain class.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mattyas
Junior Member
Join Date: Aug 2011
Location: Calarasi/Romanian
Old 09-24-2011 , 15:20   Plugin bio_thermal_goggles Add to a certain class.
Reply With Quote #1

Hi!

Sorry to bother you, but I have and I need some help ...

I have a plugin and not stum bio_thermal_goggles.sma how do I put only one class not all zombies: |.

Let's say this is the menu of classes:

1.Dark - Blanced
2.Hunter - Speed
3.Virus - Strog
4.Garrax - Low Gravity
5.Criminal - Regeneration
6.Korean - Speed ​​+ Low Gravity
7.Mummy - Advanced nightvision
8.Climb - Climb on the walls

I want to put the night vision to class with numbers 7 and I don't know how to do: |.
I don't have experience in scripting: |
Thank you!

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
}
Attached Files
File Type: sma Get Plugin or Get Source (bio_thermal_goggles.sma - 496 views - 3.5 KB)

Last edited by Mattyas; 09-25-2011 at 08:03. Reason: Title added.
Mattyas is offline
Send a message via MSN to Mattyas Send a message via Yahoo to Mattyas Send a message via Skype™ to Mattyas
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-24-2011 , 16:35   Re: Help please !
Reply With Quote #2

Edit your title before you post again, titles must be descriptive.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Mattyas
Junior Member
Join Date: Aug 2011
Location: Calarasi/Romanian
Old 09-24-2011 , 16:51   Re: Plugin bio_thermal_goggles Add to a certain class.
Reply With Quote #3

Tittle added....
Mattyas is offline
Send a message via MSN to Mattyas Send a message via Yahoo to Mattyas Send a message via Skype™ to Mattyas
Old 09-25-2011, 08:05
Mattyas
This message has been deleted by ConnorMcLeod. Reason: dp
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:37.


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