Senior Member
Join Date: Mar 2010
Location: Brazil - SP
|
09-30-2017
, 12:43
Laser green in class human
|
#1
|
hello, the part code green laser code, it does not work, I can not fix somebody can help me?
PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#include < zp50_core >
#include < zp50_class_human >
#define _PLUGIN "[ZP50] Human Class: Tatico"
#define _VERSION "1.0"
#define _AUTHOR "H.RED.ZONE"
#define flag_get(%1,%2) (%1 & (1 << (%2 & 31)))
#define flag_get_boolean(%1,%2) (flag_get(%1,%2) ? true : false)
#define flag_set(%1,%2) %1 |= (1 << (%2 & 31))
#define flag_unset(%1,%2) %1 &= ~(1 << (%2 & 31))
#define PISTOL_WEAPONS_BIT (1<<CSW_GLOCK18|1<<CSW_USP|1<<CSW_DEAGLE|1<<CSW_P228|1<<CSW_FIVESEVEN|1<<CSW_ELITE)
#define PISTOL_WEAPONS_BIT (1<<CSW_GLOCK18|1<<CSW_USP|1<<CSW_DEAGLE|1<<CSW_P228|1<<CSW_FIVESEVEN|1<<CSW_ELITE)
#define SHOTGUN_WEAPONS_BIT (1<<CSW_M3|1<<CSW_XM1014)
#define SUBMACHINE_WEAPONS_BIT (1<<CSW_TMP|1<<CSW_MAC10|1<<CSW_MP5NAVY|1<<CSW_UMP45|1<<CSW_P90)
#define RIFLE_WEAPONS_BIT (1<<CSW_FAMAS|1<<CSW_GALIL|1<<CSW_AK47|1<<CSW_SCOUT|1<<CSW_M4A1|1<<CSW_SG550|1<<CSW_SG552|1<<CSW_AUG|1<<CSW_AWP|1<<CSW_G3SG1)
#define MACHINE_WEAPONS_BIT (1<<CSW_M249)
#define PRIMARY_WEAPONS_BIT (SHOTGUN_WEAPONS_BIT|SUBMACHINE_WEAPONS_BIT|RIFLE_WEAPONS_BIT|MACHINE_WEAPONS_BIT)
#define SECONDARY_WEAPONS_BIT (PISTOL_WEAPONS_BIT)
#define IsPrimaryWeapon(%1) ((1<<%1) & PRIMARY_WEAPONS_BIT)
#define IsSecondaryWeapon(%1) ((1<<%1) & PISTOL_WEAPONS_BIT)
new g_HumanClassID
new g_LaserSprite
new _bitPlayerLaserSight
new const g_szLaserSprite[ ] = "sprites/zbeam4.spr"
new const humanclass1_name[] = "Humano Tatico"
new const humanclass1_info[] = "\y[\dCOM MIRA LASER\y]"
new const humanclass1_models[][] = { "arctic" , "guerilla" , "leet" , "terror" , "gign" , "gsg9" , "sas" , "urban" }
const humanclass1_health = 100
const Float:humanclass1_speed = 0.90
const Float:humanclass1_gravity = 1.0
public plugin_init( ) {
register_plugin( _PLUGIN, _VERSION, _AUTHOR)
// Prethink Needs To Be Used For Laser.
register_forward( FM_PlayerPreThink, "FW__PlayerPreThink", false )
// Register New Round.
register_event( "HLTV", "Event_HLTV_New_Round", "a", "1=0", "2=0" )
RegisterHam( Ham_Killed, "player", "FW__PlayerKilled_Post", 1 )
}
public plugin_precache( ) {
g_LaserSprite = precache_model( g_szLaserSprite )
g_HumanClassID = zp_class_human_register( humanclass1_name, humanclass1_info, humanclass1_health, humanclass1_speed, humanclass1_gravity )
for ( new index = 0; index < sizeof humanclass1_models; index++ )
zp_class_human_register_model( g_HumanClassID, humanclass1_models[index] )
}
// Player PreThink Needs To Be Used For Sprite To Be Strong.
public FW__PlayerPreThink( id ) {
// If Has Laser Sight.
if( flag_get(_bitPlayerLaserSight, id)
// And Is Alive.
&& is_user_alive(id) ) {
// Statics.
static iTarget
, iBody
, iRed
, iGreen
, iBlue
, iWeapon
// Get User Aim.
get_user_aiming( id, iTarget, iBody )
// Get Weapon.
iWeapon = get_user_weapon( id )
// If Weapon Is Primary Weapon (Useing Bits).
if( IsPrimaryWeapon( iWeapon )
// Or Secondary Weapons.
|| IsSecondaryWeapon( iWeapon ) ) {
// Jogador vivo
if( is_user_alive(id) )
// If Target Is Alive.
if( is_user_alive( iTarget )
// And Target Is Zombie.
&& zp_core_is_zombie( iTarget )) {
// Set Color Red.
iRed = 10
iGreen = 0
iBlue = 0
set_hudmessage(255, 0, 0, 0.41, 0.21, 0, 6.0, 5.0)
show_hudmessage(id, "CUIDADO!!!")
}
// Else If Its Normal Human.
else if( !zp_core_is_zombie( iTarget )
// If Target Is Alive.
&& is_user_alive(id)) {
// Color Will Be Green.
iRed = 0
iGreen = 10
iBlue = 0
set_hudmessage(7, 177, 47, 0.38, 0.27, 0, 6.0, 12.0)
show_hudmessage(id, "PROCURANDO...")
}
// If Target Is Alive.
&& is_user_alive(iTarget)) {
// Set Color Red.
iRed = 0
iGreen = 0
iBlue = 10
set_hudmessage(42, 170, 255, 0.34, 0.27, 0, 6.0, 5.0)
show_hudmessage(id, "AMIGO LOCALIZADO...")
}
// Else If Not Zombie On Aim.
else {
// Color Will Be Green.
iRed = 0
iGreen = 10
iBlue = 0
set_hudmessage(7, 177, 47, 0.38, 0.27, 0, 6.0, 12.0)
show_hudmessage(id, "PROCURANDO...")
}
// Static Origin 3D
static iOrigin[ 3 ]
// Get Origin.
get_user_origin( id, iOrigin, 3 );
// Show Sprite.
message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
// Sprite As Beam.
write_byte( TE_BEAMENTPOINT )
write_short( id | 0x1000 )
write_coord( iOrigin[ 0 ] )
write_coord( iOrigin[ 1 ] )
write_coord( iOrigin[ 2 ] )
write_short( g_LaserSprite )
write_byte( 1 )
write_byte( 10 )
write_byte( 1 )
write_byte( 5 )
write_byte( 0 )
write_byte( iRed )
write_byte( iGreen )
write_byte( iBlue )
write_byte( 150 )
write_byte( 25 )
message_end( )
}
}
}
public zp_fw_core_spawn_post(id) {
if(zp_class_human_get_current(id) == g_HumanClassID ) {
if(!zp_core_is_zombie(id)) {
flag_set(_bitPlayerLaserSight, id)
}
}
}
public zp_fw_core_cure_post(id) {
if(zp_class_human_get_current(id) == g_HumanClassID) {
flag_set(_bitPlayerLaserSight, id)
}
}
public zp_fw_core_infect(id) {
if(zp_class_human_get_current(id) == g_HumanClassID) {
flag_unset(_bitPlayerLaserSight, id)
}
}
public FW__PlayerKilled_Post(id) {
// If Player Is Connected.
if( is_user_connected(id) ) {
flag_unset(_bitPlayerLaserSight, id)
}
}
// New Round Started.
public Event_HLTV_New_Round() {
// Set Bits To Zero.
_bitPlayerLaserSight = 0
}
NOT FUNCTIONAL
PHP Code:
// Else If Not Zombie On Aim.
else {
// Color Will Be Green.
iRed = 0
iGreen = 10
iBlue = 0
set_hudmessage(7, 177, 47, 0.38, 0.27, 0, 6.0, 12.0)
show_hudmessage(id, "PROCURANDO...")
}
__________________
Last edited by GuTo; 09-30-2017 at 12:44.
|
|