Senior Member
Join Date: Mar 2010
Location: Brazil - SP
|
10-14-2016
, 16:23
[zp50] human laser help
|
#1
|
This plugin is working perfectly, but the "Else If Not Zombie On Aim." It does not work, this part was to show the laser in green if the player is not aiming for a player
can anybody help me?
Thank you
PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#include < zp50_core >
#include < zp50_class_human >
#define _PLUGIN "[ZP50] Human Class: Laser"
#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[] = "Human Laser"
new const humanclass1_info[] = "\y[\dLaser Weapowns\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 ) ) {
// If Target Is Alive.
if( is_user_alive( iTarget )
// And Target Is Zombie.
&& zp_core_is_zombie( iTarget )) {
// Set Color Red.
iRed = 255
iGreen = 0
iBlue = 0
set_hudmessage(255, 0, 0, 0.41, 0.21, 0, 6.0, 5.0)
show_hudmessage(id, "DANGER!!!")
}
// Else If Its Normal Human.
else if( !zp_core_is_zombie( iTarget )
// If Target Is Alive.
&& is_user_alive(iTarget)) {
// Set Color Red.
iRed = 0
iGreen = 0
iBlue = 255
set_hudmessage(42, 170, 255, 0.34, 0.27, 0, 6.0, 5.0)
show_hudmessage(id, "Friendly...")
}
// Else If Not Zombie On Aim.
else {
// Color Will Be Green.
iRed = 0
iGreen = 255
iBlue = 0
set_hudmessage(7, 177, 47, 0.38, 0.27, 0, 6.0, 12.0)
show_hudmessage(id, "Search...")
}
// 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
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang10266\\ f0\\ fs16 \n\\ par }
*/
__________________
|
|