Raised This Month: $ Target: $400
 0% 

[amxx]write crosshair as a spr??


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
1pa1pb
Junior Member
Join Date: Jul 2014
Old 07-16-2014 , 04:54   [amxx]write crosshair as a spr??
Reply With Quote #1

hello there.

i modify a plugin that disable crosshair showing up, and add a few lines that can show a spr file (which has the crosshair) onto the screen,


but it can be only seen in one direction, there are afterimages when the player moves.



i want it to stay in the same location to replace the original crosshair,
what should i do? please help.

PHP Code:
#include <amxmodx> 
#include <amxmisc> 

#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>

#define PLUGIN "1" 
#define VERSION "2" 
#define AUTHOR "3" 

#define HUD_HIDE_CROSS (1<<6)
new g_msgHideWeapon
new bool:g_bHideCross
new g_cvarHideCross

new g_ch_SprId

public plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR
    
g_msgHideWeapon get_user_msgid("HideWeapon")
    
register_event("ResetHUD""onResetHUD""b")
    
register_message(g_msgHideWeapon"msgHideWeapon")
    
    
register_forward(FM_CmdStart"fw_CmdStart")
    
    
g_cvarHideCross register_cvar("ch_swai""1")

    
HudApplyCVars()


public 
plugin_precache()
{
    
g_ch_SprId engfunc(EngFunc_PrecacheModel"sprites/crosshairs_swai_1.spr")
}

public 
fw_CmdStart(iduc_handleseed)
{
    if(
is_user_alive(id)) {
    static 
Float:Origin[3], TE_FLAG
    get_position
(id80.00.0, -10.0Origin)
    
    
TE_FLAG |= TE_EXPLFLAG_NODLIGHTS
    TE_FLAG 
|= TE_EXPLFLAG_NOSOUND
    TE_FLAG 
|= TE_EXPLFLAG_NOPARTICLES
    
    engfunc
(EngFunc_MessageBeginMSG_ONE_UNRELIABLESVC_TEMPENTITYOriginid)
    
write_byte(TE_EXPLOSION)
    
engfunc(EngFunc_WriteCoordOrigin[0])
    
engfunc(EngFunc_WriteCoordOrigin[1])
    
engfunc(EngFunc_WriteCoordOrigin[2])
    
write_short(g_ch_SprId)
    
write_byte(3)        // if you can see here, i want to ask what
    
write_byte(20)        // are these two lines suppose to be? transparency?
    
write_byte(TE_FLAG)
    
message_end()
    }
}

public 
onResetHUD(id)
{
    
HudApplyCVars()
    new 
iHideFlags GetHudHideFlags()
    if(
iHideFlags)
    {
        
message_begin(MSG_ONEg_msgHideWeapon_id)
        
write_byte(iHideFlags)
        
message_end()
    }    
}

public 
msgHideWeapon()
{
    new 
iHideFlags GetHudHideFlags()
    if(
iHideFlags)
        
set_msg_arg_int(1ARG_BYTEget_msg_arg_int(1) | iHideFlags)
}

GetHudHideFlags()
{
    new 
iFlags

    
if( g_bHideCross )
        
iFlags |= HUD_HIDE_CROSS


    
return iFlags
}

HudApplyCVars()
{
    
g_bHideCross bool:get_pcvar_num(g_cvarHideCross)
}

stock get_position(id,Float:forwFloat:rightFloat:upFloat:vStart[])
{
    static 
Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
    
    
pev(idpev_originvOrigin)
    
pev(idpev_view_ofsvUp//for player
    
xs_vec_add(vOriginvUpvOrigin)
    
pev(idpev_v_anglevAngle// if normal entity ,use pev_angles
    
    
angle_vector(vAngle,ANGLEVECTOR_FORWARDvForward//or use EngFunc_AngleVectors
    
angle_vector(vAngle,ANGLEVECTOR_RIGHTvRight)
    
angle_vector(vAngle,ANGLEVECTOR_UPvUp)
    
    
vStart[0] = vOrigin[0] + vForward[0] * forw vRight[0] * right vUp[0] * up
    vStart
[1] = vOrigin[1] + vForward[1] * forw vRight[1] * right vUp[1] * up
    vStart
[2] = vOrigin[2] + vForward[2] * forw vRight[2] * right vUp[2] * up

Attached Files
File Type: zip crosshairs_swai_1.zip (629 Bytes, 132 views)

Last edited by 1pa1pb; 07-16-2014 at 04:54.
1pa1pb is offline
 



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 13:01.


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