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

[zp50] human laser help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GuTo
Senior Member
Join Date: Mar 2010
Location: Brazil - SP
Old 10-14-2016 , 16:23   [zp50] human laser help
Reply With Quote #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_forwardFM_PlayerPreThink"FW__PlayerPreThink"false )

    

    
// Register New Round.

    
register_event"HLTV""Event_HLTV_New_Round""a""1=0""2=0" )

    

    
RegisterHamHam_Killed"player""FW__PlayerKilled_Post")

}



public 
plugin_precache( ) {

    

    
g_LaserSprite precache_modelg_szLaserSprite )

    

    
g_HumanClassID zp_class_human_registerhumanclass1_namehumanclass1_infohumanclass1_healthhumanclass1_speedhumanclass1_gravity )

    

    for ( new 
index 0index sizeof humanclass1_modelsindex++ )

        
zp_class_human_register_modelg_HumanClassIDhumanclass1_models[index] )

}  



// Player PreThink Needs To Be Used For Sprite To Be Strong.

public FW__PlayerPreThinkid ) {

    

    
// If Has Laser Sight.

    
if( flag_get(_bitPlayerLaserSightid

    

    
// And Is Alive.

    
&& is_user_alive(id) ) {

        

        
// Statics.    

        
static iTarget

            
iBody

            
iRed

            
iGreen

            
iBlue

            
iWeapon

        

        
// Get User Aim.

        
get_user_aimingidiTargetiBody )

        

        
// Get Weapon.

        
iWeapon get_user_weaponid )

        

        
// If Weapon Is Primary Weapon (Useing Bits).

        
if( IsPrimaryWeaponiWeapon 

        

        
// Or Secondary Weapons.

        
|| IsSecondaryWeaponiWeapon ) ) {

            

            
// If Target Is Alive.

            
if( is_user_aliveiTarget 

            

            
// And Target Is Zombie.

            
&& zp_core_is_zombieiTarget )) {

                

                
// Set Color Red.

                
iRed 255

                iGreen 
0

                iBlue 
0

                

                set_hudmessage
(255000.410.2106.05.0)

                
show_hudmessage(id"DANGER!!!")

                

                

                

            } 

            

            
// Else If Its Normal Human.

            
else if( !zp_core_is_zombieiTarget 

            

            
// If Target Is Alive.

            
&& is_user_alive(iTarget)) {

                

                
// Set Color Red.

                
iRed 0

                iGreen 
0

                iBlue 
255

                

                set_hudmessage
(421702550.340.2706.05.0)

                
show_hudmessage(id"Friendly...")

                

            }

            

            
// Else If Not Zombie On Aim.

            
else {

                

                
// Color Will Be Green.

                
iRed 0

                iGreen 
255

                iBlue 
0

                

                set_hudmessage
(7177470.380.2706.012.0)

                
show_hudmessage(id"Search...")

                

            }

            

            
// Static Origin 3D

            
static iOrigin]

            

            
// Get Origin.

            
get_user_originidiOrigin);

            

            
// Show Sprite.

            
message_beginMSG_BROADCASTSVC_TEMPENTITY )

            

            
// Sprite As Beam.

            
write_byteTE_BEAMENTPOINT )

            
write_shortid 0x1000 )

            
write_coordiOrigin] )

            
write_coordiOrigin] )

            
write_coordiOrigin] )

            
write_shortg_LaserSprite )

            
write_byte)

            
write_byte10 )

            
write_byte)

            
write_byte)

            
write_byte)

            
write_byteiRed )

            
write_byteiGreen )

            
write_byteiBlue )

            
write_byte150 )

            
write_byte25 )

            
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(_bitPlayerLaserSightid)

        }

    }

}



public 
zp_fw_core_cure_post(id) { 

    if(
zp_class_human_get_current(id) == g_HumanClassID) { 

        
flag_set(_bitPlayerLaserSightid)

    } 

}  



public 
zp_fw_core_infect(id) {

    if(
zp_class_human_get_current(id) == g_HumanClassID) { 

        
flag_unset(_bitPlayerLaserSightid)

    } 

}



public 
FW__PlayerKilled_Post(id) {

    

    
// If Player Is Connected.

    
if( is_user_connected(id) ) {

        

        
flag_unset(_bitPlayerLaserSightid)

    }

}



// 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 }

*/ 
__________________
GuTo is offline
Send a message via Skype™ to GuTo
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 20:57.


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