Raised This Month: $ Target: $400
 0% 

Help weapon shoot sprites


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 05-29-2017 , 04:56   Re: Help weapon shoot sprites
Reply With Quote #2

Here you go. untested but should work fine.
This hooks all weapons to shot a laser sprite.

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Shot laser"
#define VERSION "1.0"
#define AUTHOR "ironskillz1"

new g_iLasersprite;

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	new szWeaponName[32] 
	new NOSHOT_BITSUM = (1<<CSW_KNIFE) | (1<<CSW_HEGRENADE) | (1<<CSW_FLASHBANG) | (1<<CSW_SMOKEGRENADE) 
	for(new iId = CSW_P228; iId <= CSW_P90; iId++) 
	{ 
		if( ~NOSHOT_BITSUM & 1<<iId && get_weaponname(iId, szWeaponName, charsmax(szWeaponName)) )
		{ 
			RegisterHam(Ham_Weapon_PrimaryAttack, szWeaponName, "Ham_ShootLaser") 
		} 
	} 
}

public plugin_precache()
	g_iLasersprite = precache_model("sprites/white.spr");

public Ham_ShootLaser(entity) 
{
	if(pev_valid(entity)) 
	{
		static iWeapon, id, iClip, iAmmo;

		iWeapon = get_pdata_int(entity, 43, 4); 
		id = get_pdata_cbase(entity, 41, 4);
		
		get_user_ammo(id, iWeapon, iClip, iAmmo);
				
		if(!is_user_alive(id) || iAmmo == 0 )
			return HAM_HANDLED;
			
		Player_ShootLaser(id);
	}
	return HAM_HANDLED;
}

stock Player_ShootLaser(id) 
{
	new szOrigin[3];
	get_user_origin(id, szOrigin, 3);
			
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
		
	write_byte(TE_BEAMENTPOINT);
	write_short(id | 0x1000); 
	write_coord(szOrigin[0]);
	write_coord(szOrigin[1]);
	write_coord(szOrigin[2]);
	
	write_short(g_iLasersprite);
	write_byte(0);      						
	write_byte(10);     						
	write_byte(1);
	write_byte(5);   						
	write_byte(0); 
		
	//colors
	write_byte(50);
	write_byte(50);
	write_byte(50);

	write_byte(255);     						
	write_byte(10);      						
	message_end();
}
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
 


Thread Tools
Display Modes

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 18:11.


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