Code:
/* Plugin generated by AMXX-Studio */
//Special thanks to Connor McLeod
//Crosshair by DavidJr
/*
a p228
b hegrenade
c xm1014
d c4
e mac10
f aug
g smokegrenade
h elite
i fiveseven
j ump45
k galil
l famas
m usp
n glock18
o mp5navy
p m249
q m3
r m4a1
s tmp
t flashbang
u deagle
v sg552
w ak47
x knife
y p90
*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#define PLUGIN "Dot Crosshair"
#define VERSION "1.0"
#define AUTHOR "DavidJr"
#define MAX_PLAYERS 32
#define HIDEHUD_CROSSHAIR (1<<6)
#define m_iHideHUD 361
#define HideWeaponCrosshair(%1) ( g_iFlags & (1<<%1) )
new g_iOldWeapon[MAX_PLAYERS+1]
new g_iFlags
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
//Register Concmd
register_concmd("dot_crosshair","ShowCH")
register_concmd("weapon_no_crosshair", "AdminCommand_Crosshair", ADMIN_CFG, " - <flags>")
//Register Event
register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
register_event("ResetHUD", "Event_ResetHUD", "be")
}
public ShowCH(id)
{
set_hudmessage(0, 255, 0, -1.0, -1.0, 0, 6.0, 999.0)
show_hudmessage(id, ".")
}
public Event_ResetHUD(id)
{
g_iOldWeapon[id] = 0
}
public Event_CurWeapon(id)
{
new iCurWeapon = read_data(2)
new iOldWeapon = g_iOldWeapon[id]
if( iCurWeapon != iOldWeapon )
{
g_iOldWeapon[id] = iCurWeapon
if( HideWeaponCrosshair(iCurWeapon) )
{
set_pdata_int(id, m_iHideHUD, get_pdata_int(id, m_iHideHUD) | HIDEHUD_CROSSHAIR)
}
else if( HideWeaponCrosshair( iOldWeapon ) )
{
set_pdata_int(id, m_iHideHUD, get_pdata_int(id, m_iHideHUD) & ~HIDEHUD_CROSSHAIR)
}
}
}
public AdminCommand_Crosshair(id, level, cid)
{
if( cmd_access(id, level, cid, 2) )
{
new szFlags[26]
read_argv(1, szFlags, charsmax(szFlags))
static const iWeaponsIds[] = {CSW_P228, CSW_HEGRENADE, CSW_XM1014, CSW_C4, CSW_MAC10, CSW_AUG, CSW_SMOKEGRENADE,
CSW_ELITE, CSW_FIVESEVEN, CSW_UMP45, CSW_GALIL, CSW_FAMAS, CSW_USP, CSW_GLOCK18,
CSW_MP5NAVY, CSW_M249, CSW_M3, CSW_M4A1, CSW_TMP, CSW_FLASHBANG, CSW_DEAGLE, CSW_SG552,
CSW_AK47, CSW_KNIFE, CSW_P90}
new i, cLetter, iVal
g_iFlags = 0
while( (cLetter = szFlags[i++]) )
{
iVal = cLetter - 'a'
if( 0 <= iVal < sizeof(iWeaponsIds) )
{
g_iFlags |= (1<<iWeaponsIds[iVal])
}
}
}
return PLUGIN_HANDLED
}
I'm trying to make new crosshair using HUD, here is the screenshot:
[IMG]http://img29.**************/img29/6169/39420139.jpg[/IMG]
Also how to remove the hud when player using Sniper? And I want use this symbol "•" But in game it doesn't appeared