Raised This Month: $404 Target: $400
 101% 

[TUT] Custom Weapon Hud Sprites + Slot Redirection


Post New Thread Reply   
 
Thread Tools Display Modes
axfalcon
Junior Member
Join Date: Apr 2016
Old 04-24-2016 , 20:51   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #91

Quote:
Originally Posted by meTaLiCroSS View Post
WeaponList is sent only one time per player, this means, if you overwrited the default (client) values of WeaponList and then you want them again, you should send the default values to the client for skipping this issue, not hard.

EDIT: For forcing a client to clean his WeaponList values, you can use the m_fKnownItem offset (which offset value is unknown), or use GetItemInfo with Orpheu and send to the player the default values of a single weapon.

For more info, search in the HLSDK.
Can you point me in the right direction please sir? I am looking to change the sprites and am thinking in 2 possible ways.

1. The client downloads my custom sprites to cstrike_downloads/sprites2 folder, and somehow have the server tell the client to execute those instead of normal client sprites.

2. Have the client download a sprites2 folder and extract it to their cstrike folder, and give them an executable that switches the names of the sprites/*.txt files over to reference the new sprites. The executable can toggle the sprites and sprites2 on and off so the user can select with one-click which sprites they want.

Thoughts?

Last edited by axfalcon; 04-24-2016 at 20:52.
axfalcon is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: Brazil 🇧🇷
Old 07-03-2017 , 12:27   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #92

Arkshine, It seems that if you enable the Ham_item_itemslot in the weapon entity, you can pick up other weapons that are on the floor using the same slot. I ran the tests with Scout, if you touch another gun, you can get it, so you get two primary weapons. The same problem occurs if Scout is on the floor and you're using another primary weapon.
__________________
Working with $$$ paid plugins. Contact below (ONLY FOR NEGOTIATIONS)
  • Skype: crazy.770
  • Steam: crazy770
  • Discord: CrazY.#5317
Feel free to check my work at https://conceptstrike.blogspot.com

Check my Aliens vs. Predator: currently offline
CrazY. is offline
vitorrossi
Senior Member
Join Date: Apr 2012
Location: NY, USA
Old 08-09-2017 , 15:03   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #93

Instead of using
Code:
RegisterHam( Ham_Item_AddToPlayer, "weapon_knife", "OnAddToPlayerKnife", .Post = true );
I just tested
Code:
public plugin_precache( ) {     register_message( get_user_msgid( "WeaponList" ), "msgWeaponList" ); } public msgWeaponList( msgID, msgDest, id ) {     if( get_msg_arg_int( 8 ) == CSW_C4 )     {         set_msg_arg_string( 1, "weapon_tripmine" );         set_msg_arg_int( 3, ARG_BYTE, get_pcvar_num( g_pTripMax ) );     } }

And it works the same way. Is there a reason why you chose to hook Ham_AddToPlayer and send message as opposed to changing the args in WeaponList itself?
Also, WeaponList seems to only be called once when map loads. Message can be unregistered in plugin_init

Last edited by vitorrossi; 08-09-2017 at 15:21.
vitorrossi is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-10-2017 , 03:30   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #94

The answer is in your message. There is the static method if you plan to replace a weapon all the time and the dynamic method if you need conditions to replace a weapon.
__________________
Arkshine is offline
vitorrossi
Senior Member
Join Date: Apr 2012
Location: NY, USA
Old 08-10-2017 , 07:26   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #95

Ah yes I see it now. Thank you
vitorrossi is offline
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 04-06-2018 , 13:02   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #96

thanks for the tutorial
__________________
man_s_our is offline
ElijahDD
Junior Member
Join Date: Aug 2018
Old 08-27-2018 , 07:22   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #97

I replaced m249 by "grenade", and when i choose this replaced weapon and press attack - it shoot ofc. It possible to change weapon "type" to granade (i need possible to throw it..)?
ElijahDD is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-27-2018 , 07:47   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #98

Quote:
Originally Posted by ElijahDD View Post
I replaced m249 by "grenade", and when i choose this replaced weapon and press attack - it shoot ofc. It possible to change weapon "type" to granade (i need possible to throw it..)?
Well you didn't expect the weapon to shoot grenades just because you changed a sprite, did you? Look at how custom weapons are created: disable client prediction and recode the shooting logic.
__________________
HamletEagle is offline
ElijahDD
Junior Member
Join Date: Aug 2018
Old 08-27-2018 , 11:46   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #99

Quote:
Originally Posted by HamletEagle View Post
Well you didn't expect the weapon to shoot grenades just because you changed a sprite, did you? Look at how custom weapons are created: disable client prediction and recode the shooting logic.
Do you know any plugin where I can see granade throw logic?
ElijahDD is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-27-2018 , 12:33   Re: [TUT] Custom Weapon Hud Sprites + Slot Redirection
Reply With Quote #100

Quote:
Originally Posted by ElijahDD View Post
Do you know any plugin where I can see granade throw logic?
Look at this thread: https://forums.alliedmods.net/showthread.php?t=270408, especially https://forums.alliedmods.net/showpo...7&postcount=55
You don't have to use okapi if you don't want to. Instead of calling CGrenade_ShootTimed2/CGrenade_ShootTimed/CGrenade_ShootSmokeGrenade you can create a fake grenade entity, set it's origin(vecSrc) and velocity(vecThrow) and then recode the explosion effects/damage, but this is not very smart/efficient.
Another way would be to simply recode CGrenade_ShootTimed2 in pawn(I assume you want to throw hegrenades), it's not hard, I did that before.

https://github.com/s1lentq/ReGameDLL...enade.cpp#L876
The only tricky part is this:
PHP Code:
pGrenade->SetTouch(&CGrenade::BounceTouch);
pGrenade->SetThink(&CGrenade::TumbleThink); 
But this can be done either with orpheu or doing what connor does here: https://forums.alliedmods.net/showthread.php?p=1920279 to retrieve BounceTouch and TumbleThink address. Then you simply set it to m_pfnThink and m_pfnTouch offsets(set_pdata_int).
__________________

Last edited by HamletEagle; 08-27-2018 at 12:34.
HamletEagle is offline
Reply


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 12:51.


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