AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Invisible and visible for player (https://forums.alliedmods.net/showthread.php?t=245010)

langgiong123 07-27-2014 01:52

Invisible and visible for player
 
Hello.
I 've code this plugin for Terrorist : When they stand still, they will be invisible. When they move, they will be visible.
Here is the code :
Code:

if(cs_get_user_team(player1) == CS_TEAM_T)
        {
                if(get_user_maxspeed(player1) == 0)
                {
                        set_user_rendering(player1,kRenderFxNone,0,0,0,kRenderTransAlpha,0)
                }
                if(get_user_maxspeed(player1) > 1)
                {
                        set_user_rendering(player1,kRenderFxNone,0,0,0,kRenderTransAlpha,50)
                }

But in game, player are always visible when they stand still
Can anyone help me :(

RateX 07-27-2014 02:31

Re: Invisible and visible for player
 
Try to put it in client_prethink or client_postthink. This method might produce message overflown, so post it here should that happen

langgiong123 07-27-2014 02:39

Re: Invisible and visible for player
 
Quote:

Originally Posted by RateX (Post 2174473)
Try to put it in client_prethink or client_postthink. This method might produce message overflown, so post it here should that happen

Can you help me make the code :)
I'm newbie

Eagle07 07-27-2014 02:41

Re: Invisible and visible for player
 
use this ^^
PHP Code:

#include <amxmodx> 
#include <engine> 
#include <fun> 

#define PLUGIN "Invisibility" 
#define VERSION "1.0" 
#define AUTHOR "ConnorMcLeod" 

new g_iInvisFactor 

public plugin_init() { 
    
register_plugin(PLUGINVERSIONAUTHOR
     
    new 
iEnt 
    iEnt 
create_entity("info_target"
    
entity_set_string(iEntEV_SZ_classname"check_speed"
    
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 0.1
    
register_think("check_speed""Set_Furiens_Visibility"


public 
Set_Furiens_Visibility(iEnt

    
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 0.1

    new 
iPlayers[32], iNumFloat:fVecVelocity[3], iSpeed 

    get_players
(iPlayersiNum"a"

    new 
iPlayer
    for(new 
iiNumi++) 
    { 
        
iPlayer iPlayers[i
        if(
get_user_weapon(iPlayer) == CSW_KNIFE
        { 
            
entity_get_vector(iPlayerEV_VEC_velocityfVecVelocity
            
iSpeed floatround(vector_length(fVecVelocity)) 
            if(
iSpeed g_iInvisFactor*255
            { 
                
set_user_rendering(iPlayerkRenderFxNone000kRenderTransAlphaiSpeed/g_iInvisFactor
            } 
            else 
            { 
                
set_user_rendering(iPlayerkRenderFxNone000kRenderNormal0
            } 
        } 
        else 
        { 
            
set_user_rendering(iPlayerkRenderFxNone000kRenderNormal0
        } 
    } 



langgiong123 07-27-2014 02:53

Re: Invisible and visible for player
 
Quote:

Originally Posted by Eagle07 (Post 2174477)
use this ^^
PHP Code:

#include <amxmodx> 
#include <engine> 
#include <fun> 

#define PLUGIN "Invisibility" 
#define VERSION "1.0" 
#define AUTHOR "ConnorMcLeod" 

new g_iInvisFactor 

public plugin_init() { 
    
register_plugin(PLUGINVERSIONAUTHOR
     
    new 
iEnt 
    iEnt 
create_entity("info_target"
    
entity_set_string(iEntEV_SZ_classname"check_speed"
    
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 0.1
    
register_think("check_speed""Set_Furiens_Visibility"


public 
Set_Furiens_Visibility(iEnt

    
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 0.1

    new 
iPlayers[32], iNumFloat:fVecVelocity[3], iSpeed 

    get_players
(iPlayersiNum"a"

    new 
iPlayer
    for(new 
iiNumi++) 
    { 
        
iPlayer iPlayers[i
        if(
get_user_weapon(iPlayer) == CSW_KNIFE
        { 
            
entity_get_vector(iPlayerEV_VEC_velocityfVecVelocity
            
iSpeed floatround(vector_length(fVecVelocity)) 
            if(
iSpeed g_iInvisFactor*255
            { 
                
set_user_rendering(iPlayerkRenderFxNone000kRenderTransAlphaiSpeed/g_iInvisFactor
            } 
            else 
            { 
                
set_user_rendering(iPlayerkRenderFxNone000kRenderNormal0
            } 
        } 
        else 
        { 
            
set_user_rendering(iPlayerkRenderFxNone000kRenderNormal0
        } 
    } 



Thank you so much, it work :):):)

langgiong123 07-27-2014 02:56

Re: Invisible and visible for player
 
But I want this code :
When they stand still, they will be invisible. When they move, their redering is 45.
And it's only for T Team
Sorry for bad English

langgiong123 07-27-2014 03:42

Re: Invisible and visible for player
 
Quote:

Originally Posted by Eagle07 (Post 2174490)
np :P , yr welcome

Can you help me this code has following requirements :
When they stand still, they will be invisible. When they move, their redering is 45.
And it's only for T Team

mottzi 07-27-2014 06:15

Re: Invisible and visible for player
 
You just got a code snippet, you could as well try yourself.


All times are GMT -4. The time now is 13:06.

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