Raised This Month: $ Target: $400
 0% 

[SOLVED] Remove hat on client disconnect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Xablau
Member
Join Date: Dec 2014
Old 01-13-2015 , 08:11   [SOLVED] Remove hat on client disconnect
Reply With Quote #1

How to remove hat on client disconnect?

My code:


PHP Code:
public forcehat(idChar:sethat[])
{
        new 
hat_text[65]
        
format(hat_text,63,"models/hats/%s.mdl",sethat)

        new 
iEntityiInfoTarget engfuncEngFunc_AllocString"info_target" );
        
        
iEntity engfuncEngFunc_CreateNamedEntityiInfoTarget );
        if( 
pev_validiEntity ) )
        {
            
engfuncEngFunc_SetModeliEntityhat_text );
            
set_peviEntitypev_movetypeMOVETYPE_FOLLOW );
            
set_peviEntitypev_aimentid );
            
set_peviEntitypev_ownerid );
        }


Last edited by Xablau; 01-13-2015 at 13:55. Reason: solved
Xablau is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 01-13-2015 , 08:54   Re: Remove hat on client disconnect
Reply With Quote #2

Why do you need to do so?
Btw, it's better to do resetting stuff at client_connect
RateX is offline
Xablau
Member
Join Date: Dec 2014
Old 01-13-2015 , 08:58   Re: Remove hat on client disconnect
Reply With Quote #3

Quote:
Originally Posted by RateX View Post
Why do you need to do so?
Btw, it's better to do resetting stuff at client_connect
Why is enabling more than one hat at the same time
I have to remove the assets to the client_putinserver activate only 1
Xablau is offline
bat
Veteran Member
Join Date: Jul 2012
Old 01-13-2015 , 11:24   Re: Remove hat on client disconnect
Reply With Quote #4

https://forums.alliedmods.net/showthread.php?t=240931 See in me code
__________________
bat is offline
Send a message via Skype™ to bat
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 01-13-2015 , 12:16   Re: Remove hat on client disconnect
Reply With Quote #5

Quote:
Originally Posted by Xablau View Post
Why is enabling more than one hat at the same time
I have to remove the assets to the client_putinserver activate only 1
Instead of removing it, you can set its model to "" to hide it at client_connect(or client_putinserver). Make sure you add a check so you don't spawn more than 1 entity per player.
This method will save you from finding, removing entity at client_disconnect, and creating again at client_connect.
RateX is offline
Xablau
Member
Join Date: Dec 2014
Old 01-13-2015 , 13:50   Re: Remove hat on client disconnect
Reply With Quote #6

Quote:
Originally Posted by bat View Post
Thank U! Solved my problem.
Xablau 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 23:41.


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