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

[TUT] Custom Weapon Hud Sprites + Slot Redirection


Post New Thread Reply   
 
Thread Tools Display Modes
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-30-2012 , 11:01   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #61

No. All others sprites are handled in hud.txt.
__________________
Arkshine is offline
usaexelent
Senior Member
Join Date: Nov 2009
Location: Lithuania
Old 05-19-2012 , 16:09   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #62

This is a very good tutorial, almost everything is clear, I never though that it's even posible

I have a theory, can I display a sprite on players screen if I change weapon crosshair sprite?

Last edited by usaexelent; 05-22-2012 at 15:02.
usaexelent is offline
Send a message via Skype™ to usaexelent
ToRRent
Junior Member
Join Date: Aug 2011
Location: Cracow (PL)
Old 08-11-2012 , 10:05   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #63

I change in weapon (M3 7/32) clip ammo with this
Code:
#define MAGAZYNEK 21
public show_hud_ammo(id,ammo)
{
	if (ammo<=MAGAZYNEK) fun_show_ammo(id, ammo)
	else
	{
		new ammo_a = ammo % MAGAZYNEK
		new num_for = (ammo-ammo_a)/MAGAZYNEK
		for (new i = 1; i <= num_for; i++)
		{
			fun_show_ammo(id, MAGAZYNEK)
		}
		if (ammo_a>0) fun_show_ammo(id, ammo_a)
	}

}
fun_show_ammo(id, ammo)
{
	message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoPickup"), _, id)
	write_byte(AMMOID[CURENT_WEAPON]) // ammo id
	write_byte(ammo) // ammo amount
	message_end()
}
My new "M3" has 7/21 ammo.

And when i send weapon list message, ammo back to normal (7/32)
Why ?
I try to change Primamymaxamount
Code:
message_begin( MSG_ONE, MsgIndexWeaponList, .player = player );  
write_string( "weapon_spas12" );  // WeaponName  
write_byte( 5 );                   // PrimaryAmmoID  
write_byte( 21 );                   // PrimaryAmmoMaxAmount  
write_byte( -1 );                   // SecondaryAmmoID  
write_byte( -1 );                   // SecondaryAmmoMaxAmount  
write_byte( 0 );                    // SlotID (0...N)  
write_byte( 5 );                    // NumberInSlot (1...N)  
write_byte( 21 );            // WeaponID  
write_byte( 0 );                    // Flags  
message_end();
But it doesn't work for me

Last edited by ToRRent; 08-11-2012 at 10:05.
ToRRent is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 08-18-2012 , 13:41   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #64

Hm, tried something like this, and it's not working.
It doesn't change sprite at all. Am i doing something wrong?
Spoiler



EDIT: Fixed i had a tipo...
Attached Files
File Type: txt weapon_minigun.txt (73 Bytes, 278 views)

Last edited by OvidiuS; 08-18-2012 at 14:01.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
csoldjb
Member
Join Date: Dec 2010
Old 08-18-2012 , 20:57   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #65

Quote:
Originally Posted by OvidiuS View Post
Hm, tried something like this, and it's not working.
It doesn't change sprite at all. Am i doing something wrong?
Spoiler



EDIT: Fixed i had a tipo...
change this RegisterHam( Ham_Item_AddToPlayer, "weapon_m249", "ham_AddToPlayer", .Post = true ) to
RegisterHam( Ham_Item_AddToPlayer, "player", "ham_AddToPlayer", .Post = true )
and also change ham_AddToPlayer( const item, const player ) tp
ham_AddToPlayer( const player, const item)
csoldjb is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 08-18-2012 , 21:53   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #66

Quote:
Originally Posted by csoldjb View Post
change this RegisterHam( Ham_Item_AddToPlayer, "weapon_m249", "ham_AddToPlayer", .Post = true ) to
RegisterHam( Ham_Item_AddToPlayer, "player", "ham_AddToPlayer", .Post = true )
and also change ham_AddToPlayer( const item, const player ) tp
ham_AddToPlayer( const player, const item)
I appreciate help, but please don't help me if you don't know what are you doing. Read the post again. I solved it, it was a small tipo.
Code:
command_SelectMachinegun( id )
-->
Code:
command_SelectMinigun( id )


Quote:
Originally Posted by Arkshine View Post
If you have read the tutorial, you should have seen the height of each weapon in this sprite is 45. So, all you have to do is to change shift x.

0 - Flare
45 - CS Grenade
90 - Melee
135 - Law Grenade
190 - Gaz mask
Noticed a mistake, 180 should be Gas Mask.

Last edited by OvidiuS; 08-18-2012 at 22:00.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
dFF
sıɹɹoɥɔ ʞɔnu
Join Date: Oct 2009
Old 09-07-2012 , 03:52   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #67

Sometime slot redirection is wrong, for example I have a primary weapon and I will received other primary weapon who will redirect to slot 5, but the weapon who I received is still stay at slot 1 or he's stay in slot 1 + slot 5 and I need to throw my primary weapon to update correctly my new weapon item slot.
dFF is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 09-07-2012 , 06:26   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #68

Quote:
Originally Posted by Arkshine
Slot redirection might not work always properly - Discovered while writing the tutorial, it doesn't work well
__________________
micapat is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-07-2012 , 06:37   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #69

Yes, this tutorial should be consider as a base to learn about this functionality. But the method is not complete and I've posted so people can test, then we could create a solid system. But I think the problems are more because things need to be updated, like sending CurWeapon when it should, and such. Will try again to test another time.
__________________

Last edited by Arkshine; 09-07-2012 at 06:38.
Arkshine is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 09-09-2012 , 13:38   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #70

I wanted to replace knife for CT's. It works all fine, but if a T spawns, he will get the new sprite and can't use knife. If you select it, it fake fires the glock. If I use "weapon_knife" in console, it works fine. I also added the team check here, but still it doesn't work. Could you try that also with your example plugin just for 1 team?

OnAddToPlayerKnife:

PHP Code:
if(pev_valid(item) && is_user_alive(player) && cs_get_user_team(player) == CS_TEAM_CT
ClientCommand_SelectBall:

PHP Code:
if(cs_get_user_team(id) == CS_TEAM_CT
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu 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 13:24.


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