Author
Message
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
07-15-2012
, 11:33
NC-Laser code snippet
#1
Spoiler
I'm trying to cut out the lasers code from the nightcrawler plugin and modify it a bit to my needs, I can't find anything wrong, neither my server console and still players don't have lasers on their weapons.
who can help?
Code
PHP Code:
/* Plugin generated by AMXX-Studio */ #include < amxmodx > #include < cstrike > #include < hamsandwich > #define PLUGIN "NC-Lasers" #define VERSION "1.0" #define AUTHOR "Sky-High" #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_pCvarEnablelasers ; new g_iLaserSprite ; new g_bHasLaser [ 33 ]; new const g_szLaserSprite [ ] = "sprites/zbeam4.spr" ; public plugin_init () { register_plugin ( PLUGIN , VERSION , AUTHOR ) g_iLaserSprite = precache_model ( g_szLaserSprite ); g_pCvarEnablelasers = register_cvar ( "amx_lasers" , "1" ); //register_forward( FM_PlayerPreThink, "Forward_PlayerPreThink", 0 ); } public client_PreThink ( id ) { if( ! is_user_alive ( id ) ) return; static CsTeams : iTeam ; iTeam = cs_get_user_team ( id ); // new LasersEnabled = get_pcvar_num(g_pCvarEnablelasers); if( iTeam == CS_TEAM_CT ) { static iTarget , iBody , iRed , iGreen , iBlue , iWeapon ; get_user_aiming ( id , iTarget , iBody ); iWeapon = get_user_weapon ( id ); if( IsPrimaryWeapon ( iWeapon ) || IsSecondaryWeapon ( iWeapon ) ) { if( is_user_alive ( iTarget ) && cs_get_user_team ( iTarget ) == CS_TEAM_T ) { iRed = 255 ; iGreen = 0 ; iBlue = 0 ; } else { iRed = 0 ; iGreen = 255 ; iBlue = 0 ; } static iOrigin [ 3 ]; get_user_origin ( id , iOrigin , 3 ); message_begin ( MSG_BROADCAST , SVC_TEMPENTITY ); write_byte ( TE_BEAMENTPOINT ); write_short ( id | 0x1000 ); write_coord ( iOrigin [ 0 ] ); write_coord ( iOrigin [ 1 ] ); write_coord ( iOrigin [ 2 ] ); write_short ( g_iLaserSprite ); 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 ( ); } } return; }
I attached the working code (all ct's have lasersight, easy changable)
__________________
Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [
♣♣♣♣♣ ♣♣ |♣♣♣]
Last edited by striker07; 10-27-2012 at 16:45 .