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

Help / Support [HELP] Nemesis with Deimos ability - Camera view problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GraviAnt
Senior Member
Join Date: Oct 2010
Old 04-06-2014 , 10:32   [HELP] Nemesis with Deimos ability - Camera view problem
Reply With Quote #1

I have this plugin that gives Nemesis ability to make players drop their weapons by
hitting them with Deimos ability and that works great, I have this other problem
that moves Nemesis's camera higher and it's in this code and I don't know how
to remove it, I want regular camera view if you understand me.

Here's the code:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <zombieplague>

#define PLUGIN "NST Nemesis Deimos"
#define VERSION "1.0"
#define AUTHOR "NST"

new spr_skill[] = "g_tentacle"
new const light_classname[] = "nst_deimos_skill"

new sprites_exp_indexsprites_trail_index

new g_wait[33], g_check[33], g_useskill[33], g_msgStatusIcon

const WPN_NOT_DROP = ((1<<2)|(1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4))
enum (+= 100)
{
    
TASK_WAIT 2000,
    
TASK_ATTACK,
    
TASK_BOT_USE_SKILL,
    
TASK_USE_SKILL
}
// IDs inside tasks
#define ID_WAIT (taskid - TASK_WAIT)
#define ID_ATTACK (taskid - TASK_ATTACK)
#define ID_BOT_USE_SKILL (taskid - TASK_BOT_USE_SKILL)
#define ID_USE_SKILL (taskid - TASK_USE_SKILL)

const m_flTimeWeaponIdle 48
const m_flNextAttack 83

new const sprites_exp[] = "sprites/tx/cso_deimosvipexp.spr"
new const sprites_trail[] = "sprites/tx/trail.spr"
new const sound_skill_start[] = "deimos/deimos_skill_start.wav"
new const sound_skill_hit[] = "deimos/deimos_skill_hit.wav"
const skill_dmg 250
const skill_anim 10
const Float:skill_time_wait 15.0

new g_msgSayText

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
// msg
    
g_msgStatusIcon get_user_msgid("StatusIcon")
    
g_msgSayText get_user_msgid("SayText")
    
    
// Events
    
register_logevent("logevent_round_start",2"1=Round_Start")
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
register_event("DeathMsg""Death""a")
    
    
    
// FM Forwards
    
register_forward(FM_CmdStart"fw_CmdStart")
    
register_forward(FM_Touch"fw_Touch")
    
RegisterHam(Ham_Player_Duck"player""Player_Duck"1);

    
// Cmd
    
register_clcmd("drop""use_skill")
}

public 
plugin_precache()
{
    
sprites_exp_index precache_model(sprites_exp)
    
sprites_trail_index precache_model(sprites_trail)
    
precache_sound(sound_skill_start)
    
precache_sound(sound_skill_hit)
    
}


public 
event_round_start()
{
    for (new 
id=1id<33id++)
    {
        if (!
is_user_connected(id)) continue;
        
        
reset_value_player(id)
        
StatusIcon(idspr_skill0)
    }
}
public 
logevent_round_start()
{
    for (new 
id=1id<33id++)
    {
        if (!
is_user_connected(id)) continue;
        if (
is_user_bot(id))
        {
            if (
task_exists(id+TASK_BOT_USE_SKILL)) remove_task(id+TASK_BOT_USE_SKILL)
            
set_task(float(random_num(5,15)), "bot_use_skill"id+TASK_BOT_USE_SKILL)
        }
    }
}
public 
Death()
{
    new 
victim read_data(2
    
StatusIcon(victimspr_skill0)
    
reset_value_player(victim)
}
public 
client_connect(id)
{
    
reset_value_player(id)
}
public 
client_disconnect(id)
{
    
reset_value_player(id)
}
reset_value_player(id)
{
    if (
task_exists(id+TASK_WAIT)) remove_task(id+TASK_WAIT)
    if (
task_exists(id+TASK_BOT_USE_SKILL)) remove_task(id+TASK_BOT_USE_SKILL)

    
g_wait[id] = 0
    g_check
[id] = 0
    g_useskill
[id] = 0
}

// bot use skill
public bot_use_skill(taskid)
{
    new 
id ID_BOT_USE_SKILL
    
if (!is_user_bot(id)) return;

    
use_skill(id)
    if (
task_exists(taskid)) remove_task(taskid)
    
set_task(float(random_num(5,15)), "bot_use_skill"id+TASK_BOT_USE_SKILL)
}

public 
zp_user_infected_post(idinfector)
{
    if (
zp_get_user_nemesis(id))
    {
    }
}

public 
use_skill(id)
{
    if (!
is_user_alive(id)) return PLUGIN_CONTINUE
    
    
new health get_user_health(id) - skill_dmg
    
if (zp_get_user_nemesis(id) && (!g_wait[id]) && (health>0) && (get_user_weapon(id)==CSW_KNIFE))
    {
        
g_useskill[id] = 1
        
        
// set health
        
fm_set_user_health(idhealth)
        
        
// set time wait
        
new Float:timewait skill_time_wait
        
        g_wait
[id] = 1
        
if (task_exists(id+TASK_WAIT)) remove_task(id+TASK_WAIT)
        
set_task(timewait"RemoveWait"id+TASK_WAIT)
        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_CONTINUE
}
public 
task_use_skill(taskid)
{
    new 
id ID_USE_SKILL
    
    
// play anim & sound
    
play_weapon_anim(id8)
    
set_weapons_timeidle(idskill_time_wait)
    
set_player_nextattack(id0.5)
    
PlayEmitSound(idsound_skill_start)
    
entity_set_int(idEV_INT_sequenceskill_anim)
    
    
// attack
    
if (task_exists(id+TASK_ATTACK)) remove_task(id+TASK_ATTACK)
    
set_task(0.5"launch_light"id+TASK_ATTACK)
}
public 
launch_light(taskid)
{
    new 
id ID_ATTACK
    
if (task_exists(id+TASK_ATTACK)) remove_task(id+TASK_ATTACK)
    
    if (!
is_user_alive(id)) return;
    
    
// check
    
new FloatfOrigin[3], Float:fAngle[3],FloatfVelocity[3]
    
pev(idpev_originfOrigin)
    
pev(idpev_view_ofsfAngle)
    
fm_velocity_by_aim(id2.0fVelocityfAngle)
    
fAngle[0] *= -1.0
    
    
// create ent
    
new ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    
set_pev(entpev_classnamelight_classname)
    
engfunc(EngFunc_SetModelent"models/w_hegrenade.mdl")
    
set_pev(entpev_minsFloat:{-1.0, -1.0, -1.0})
    
set_pev(entpev_maxsFloat:{1.01.01.0})
    
set_pev(entpev_originfOrigin)
    
fOrigin[0] += fVelocity[0]
    
fOrigin[1] += fVelocity[1]
    
fOrigin[2] += fVelocity[2]
    
set_pev(entpev_movetypeMOVETYPE_BOUNCE)
    
set_pev(entpev_gravity0.01)
    
fVelocity[0] *= 1000
    fVelocity
[1] *= 1000
    fVelocity
[2] *= 1000
    set_pev
(entpev_velocityfVelocity)
    
set_pev(entpev_ownerid)
    
set_pev(entpev_anglesfAngle)
    
set_pev(entpev_solidSOLID_BBOX)                        //store the enitty id
    
    // invisible ent
    
fm_set_rendering(entkRenderFxGlowShell000kRenderTransAlpha0)
    
    
// show trail    
    
message_beginMSG_BROADCASTSVC_TEMPENTITY )
    
write_byte(TE_BEAMFOLLOW)
    
write_short(ent)                //entity
    
write_short(sprites_trail_index)        //model
    
write_byte(5)        //10)//life
    
write_byte(3)        //5)//width
    
write_byte(209)                    //r, hegrenade
    
write_byte(120)                    //g, gas-grenade
    
write_byte(9)                    //b
    
write_byte(200)        //brightness
    
message_end()                    //move PHS/PVS data sending into here (SEND_ALL, SEND_PVS, SEND_PHS)
    
    //client_print(0, print_chat, "phong")
    
return;
}
public 
fw_Touch(entvictim)
{
    if (!
pev_valid(ent)) return FMRES_IGNORED
    
    
new EntClassName[32]
    
entity_get_string(entEV_SZ_classnameEntClassNamecharsmax(EntClassName))
    
    if (
equal(EntClassNamelight_classname)) 
    {
        
light_exp(entvictim)
        
remove_entity(ent)
        return 
FMRES_IGNORED
    
}
    
    return 
FMRES_IGNORED
}
light_exp(entvictim)
{
    if (!
pev_valid(ent)) return;
    
    
// drop current wpn of victim
    
new attacker pev(entpev_owner)
    if (
is_user_alive(victim) && !zp_get_user_survivor(victim) && (zp_get_user_nemesis(attacker) != zp_get_user_nemesis(victim)))
    {
        new 
wpnwpnname[32]
        
wpn get_user_weapon(victim)
        if( !(
WPN_NOT_DROP & (1<<wpn)) && get_weaponname(wpnwpnnamecharsmax(wpnname)) )
        {
            
engclient_cmd(victim"drop"wpnname)
        }
    }
    
    
// create effect
    
static Float:origin[3];
    
pev(entpev_originorigin);
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY); 
    
write_byte(TE_EXPLOSION); // TE_EXPLOSION
    
write_coord(floatround(origin[0])); // origin x
    
write_coord(floatround(origin[1])); // origin y
    
write_coord(floatround(origin[2])); // origin z
    
write_short(sprites_exp_index); // sprites
    
write_byte(40); // scale in 0.1's
    
write_byte(30); // framerate
    
write_byte(14); // flags 
    
message_end(); // message end
    
    // play sound exp
    
PlayEmitSound(entsound_skill_hit)
}
public 
RemoveWait(taskid)
{
    new 
id ID_WAIT
    g_wait
[id] = 0
    
if (task_exists(taskid)) remove_task(taskid)
}

public 
Player_Duck(id)
{
    if (
zp_get_user_nemesis(id))
    {
           static 
buttonducking
           button 
pev(idpev_button)
        
ducking pev(idpev_flags) & (FL_DUCKING FL_ONGROUND) == (FL_DUCKING FL_ONGROUND)

           if (
button IN_DUCK || ducking)
        {
            
set_pev(idpev_view_ofs, {0.00.040.0})
           }

    }
}

public 
fw_CmdStart(iduc_handleseed)
{
    if (!
is_user_alive(id)) return FMRES_IGNORED
    
    
if (zp_get_user_nemesis(id))
    {
        
set_pev(idpev_view_ofs, {0.00.055.0})

        
// show status icon help
        
if (g_wait[id] && g_check[id] != 2)
        {
            
g_check[id] = 2
            StatusIcon
(idspr_skill2)
        }
        else if (!
g_wait[id] && g_check[id] != 1)
        {
            
g_check[id] = 1
            StatusIcon
(idspr_skill1)
        }
        
        
// use skill
        
if (g_useskill[id])
        {
            
set_uc(uc_handleUC_ButtonsIN_ATTACK2)
            
g_useskill[id] = 0
            entity_set_int
(idEV_INT_sequenceskill_anim)
            
            if (
task_exists(id+TASK_USE_SKILL)) remove_task(id+TASK_USE_SKILL)
            
set_task(0.0"task_use_skill"id+TASK_USE_SKILL)
        }
    }
    else if (
g_check[id])
    {
        
// hide status icon
        
g_check[id] = 0
        StatusIcon
(idspr_skill0)
    }
    
    
//client_print(id, print_chat, "[%i]", set_animation(id))
    
return FMRES_IGNORED
}
PlayEmitSound(id, const sound[])
{
    
emit_sound(idCHAN_WEAPONsound1.0ATTN_NORM0PITCH_NORM)
}
StatusIcon(idsprname[], run)
{    
    if (!
is_user_connected(id)) return;
    
    
message_begin(MSG_ONEg_msgStatusIcon, {0,0,0}, id);
    
write_byte(run); // status (0=hide, 1=show, 2=flash)
    
write_string(sprname); // sprite name
    
message_end();
}
play_weapon_anim(playeranim)
{
    
set_pev(playerpev_weaponanimanim)
    
message_begin(MSG_ONESVC_WEAPONANIM, {000}, player)
    
write_byte(anim)
    
write_byte(pev(playerpev_body))
    
message_end()
}
fm_velocity_by_aim(iIndexFloat:fDistanceFloat:fVelocity[3], Float:fViewAngle[3])
{
    
//new Float:fViewAngle[3]
    
pev(iIndexpev_v_anglefViewAngle)
    
fVelocity[0] = floatcos(fViewAngle[1], degrees) * fDistance
    fVelocity
[1] = floatsin(fViewAngle[1], degrees) * fDistance
    fVelocity
[2] = floatcos(fViewAngle[0]+90.0degrees) * fDistance
    
return 1
}
get_weapon_ent(idweaponid)
{
    static 
wname[32], weapon_ent
    get_weaponname
(weaponidwnamecharsmax(wname))
    
weapon_ent fm_find_ent_by_owner(-1wnameid)
    return 
weapon_ent
}
set_weapons_timeidle(idFloat:timeidle)
{
    new 
entwpn get_weapon_ent(idget_user_weapon(id))
    if (
pev_valid(entwpn)) set_pdata_float(entwpnm_flTimeWeaponIdletimeidle+3.04)
}
set_player_nextattack(idFloat:nexttime)
{
    
set_pdata_float(idm_flNextAttacknexttime4)
}
// Set player's health (from fakemeta_util)
stock fm_set_user_health(idhealth)
{
    (
health 0) ? set_pev(idpev_healthfloat(health)) : dllfunc(DLLFunc_ClientKillid);
}
// Set entity's rendering type (from fakemeta_util)
stock fm_set_rendering(entityfx kRenderFxNone255255255render kRenderNormalamount 16)
{
    static 
Float:color[3]
    
color[0] = float(r)
    
color[1] = float(g)
    
color[2] = float(b)
    
    
set_pev(entitypev_renderfxfx)
    
set_pev(entitypev_rendercolorcolor)
    
set_pev(entitypev_rendermoderender)
    
set_pev(entitypev_renderamtfloat(amount))
}
// Find entity by its owner (from fakemeta_util)
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
    while ((
entity engfunc(EngFunc_FindEntityByStringentity"classname"classname)) && pev(entitypev_owner) != owner) { /* keep looping */ }
    return 
entity;
}

stock client_printcolor(const id, const input[], any:...) 

    new 
iCount 1iPlayers[32
     
    static 
szMsg[191
    
vformat(szMsgcharsmax(szMsg), input3
     
    
replace_all(szMsg190"/g""^4"
    
replace_all(szMsg190"/y""^1"
    
replace_all(szMsg190"/ctr""^3"
    
replace_all(szMsg190"/w""^0"
     
    if(
idiPlayers[0] = id 
    
else get_players(iPlayersiCount"ch"
         
    for (new 
0iCounti++) 
    { 
        if (
is_user_connected(iPlayers[i])) 
        { 
            
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_iPlayers[i]) 
            
write_byte(iPlayers[i]) 
            
write_string(szMsg
            
message_end() 
        } 
    }


Last edited by GraviAnt; 04-06-2014 at 10:34. Reason: Edited title to be more precise.
GraviAnt is offline
Illguy
Junior Member
Join Date: Mar 2016
Old 11-03-2016 , 04:53   Re: [HELP] Nemesis with Deimos ability - Camera view problem
Reply With Quote #2

Hi there,

find line set_pev(id, pev_view_ofs, {0.0, 0.0, 55.0}) and delete this line
find

public Player_Duck(id)
{
if (zp_get_user_nemesis(id))
{
static button, ducking
button = pev(id, pev_button)
ducking = pev(id, pev_flags) & (FL_DUCKING | FL_ONGROUND) == (FL_DUCKING | FL_ONGROUND)

if (button & IN_DUCK || ducking)
{
set_pev(id, pev_view_ofs, {0.0, 0.0, 40.0})
}

}
}

and also find

RegisterHam(Ham_Player_Duck, "player", "Player_Duck", 1);

and delete them compile and it would solve your cam problem.
Illguy is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 11-04-2016 , 12:44   Re: [HELP] Nemesis with Deimos ability - Camera view problem
Reply With Quote #3

04-06-14
__________________
edon1337 is offline
Illguy
Junior Member
Join Date: Mar 2016
Old 11-21-2016 , 07:16   Re: [HELP] Nemesis with Deimos ability - Camera view problem
Reply With Quote #4

Quote:
Originally Posted by edon1337 View Post
04-06-14
i made myself zp helper any problem? mind ur bussiness
Illguy 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 22:01.


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