AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] Remove hat on client disconnect (https://forums.alliedmods.net/showthread.php?t=255316)

Xablau 01-13-2015 08:11

[SOLVED] Remove hat on client disconnect
 
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 );
        }



RateX 01-13-2015 08:54

Re: Remove hat on client disconnect
 
Why do you need to do so?
Btw, it's better to do resetting stuff at client_connect

Xablau 01-13-2015 08:58

Re: Remove hat on client disconnect
 
Quote:

Originally Posted by RateX (Post 2248634)
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

bat 01-13-2015 11:24

Re: Remove hat on client disconnect
 
https://forums.alliedmods.net/showthread.php?t=240931 See in me code

RateX 01-13-2015 12:16

Re: Remove hat on client disconnect
 
Quote:

Originally Posted by Xablau (Post 2248636)
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.

Xablau 01-13-2015 13:50

Re: Remove hat on client disconnect
 
Quote:

Originally Posted by bat (Post 2248687)

Thank U! Solved my problem.


All times are GMT -4. The time now is 15:23.

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