Raised This Month: $ Target: $400
 0% 

Help weapon shoot sprites


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
d5nd5n
New Member
Join Date: May 2017
Old 05-29-2017 , 04:07   Help weapon shoot sprites
Reply With Quote #1

Hello i need help to weapon shoot sprite

Example : https://www.youtube.com/watch?v=x9xMkrHBNbU

im testing and no get shoot sprite

Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

new m_spriteTexture

public plugin_init() 
{
    RegisterHam(Ham_TraceAttack, "worldspawn", "make_tracer", 1)
}

public plugin_precache()
{
    m_spriteTexture = engfunc(EngFunc_PrecacheModel, "sprites/mysprite.spr")
}

public make_tracer(victim, attacker, Float:damage, Float:direction[3], tracehandle, damage_type)
{
    new color_rojo = 255
    new color_verde = 0
    new color_azul = 255
    
    
    if(get_user_weapon(attacker) == CSW_AK47) 
    {
        new Float:vecEndPos[3] 
        get_tr2(tracehandle, TR_vecEndPos, vecEndPos) 
        
        engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecEndPos, 0) 
        write_byte(TE_BEAMENTPOINT) 
        write_short(attacker | 0x1000) 
        engfunc(EngFunc_WriteCoord, vecEndPos[0]) // x 
        engfunc(EngFunc_WriteCoord, vecEndPos[1]) // x 
        engfunc(EngFunc_WriteCoord, vecEndPos[2]) // x 
        write_short(m_spriteTexture) ( NO SHOOT SPRITE WHAT REASON HELP XDD
        write_byte(0) // framerate 
        write_byte(0) // framerate 
        write_byte(1) // framerate 
        write_byte(10) // framerate 
        write_byte(0) // framerate 
        write_byte(color_rojo)
        write_byte(color_verde)
        write_byte(color_azul)
        write_byte(128) // brightness 
        write_byte(0) // brightness 
        message_end() 
    }
    return HAM_HANDLED
}
d5nd5n is offline
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
d5nd5n
New Member
Join Date: May 2017
Old 05-29-2017 , 05:21   Re: Help weapon shoot sprites
Reply With Quote #3

Thanks for help problem its continue...

Shoot Laser no shot sprite to example

https://www.youtube.com/watch?v=x9xMkrHBNbU
d5nd5n is offline
d5nd5n
New Member
Join Date: May 2017
Old 05-30-2017 , 07:00   Re: Help weapon shoot sprites
Reply With Quote #4

up helps please
d5nd5n is offline
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 18:12.


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