Raised This Month: $ Target: $400
 0% 

How to detach and attach shield entity to player?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
souvikdas95
Senior Member
Join Date: Mar 2012
Old 05-10-2014 , 06:21   How to detach and attach shield entity to player?
Reply With Quote #1

I tried the following code but it crashed HLDS

PHP Code:
new shield_entity;
if ( 
cs_get_user_shield id ) )
{
    
engclient_cmd id"drop""weapon_shield" );
    
shield_entity find_ent_by_owner ( -1"weapon_shield"id );
}
client_print idprint_chat"SHIELD DETACHED" );
/*engclient_cmd ( id, "drop", "weapon_<pistol>" )*/
if ( is_valid_ent shield_entity ) && ExecuteHamB Ham_AddPlayerItemidshield_entity ) )
    
ExecuteHamB Ham_Item_AttachToPlayershield_entityid );
client_print idprint_chat"SHIELD ATTACHED" ); 
Also tried using fake_touch ( id, hasShield ), ExecuteHam ( Ham_Touch, id, hasShield ) - No Result.

Basically my main aim is to drop the pistol attached to the player rather than the shield on engclient_cmd ( id, "drop", "weapon_<pistol>" ). so i am using engclient_cmd ( id, "drop", "weapon_shield" ) and then engclient_cmd ( id, "drop", "weapon_<pistol>" ) to detach the pistol and then I wish to reattach the shield. I am able to get the entity index of the shield but I don't know how to attach it back.

Last edited by souvikdas95; 05-10-2014 at 06:40.
souvikdas95 is offline
 


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 09:48.


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