AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Invisibility (https://forums.alliedmods.net/showthread.php?t=164353)

Pur3Biatch 08-10-2011 11:10

Invisibility
 
Hi, i want to make invisibility like in Furien Mod for all, but it's still not working.
PHP Code:

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

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

new g_iInvisFactor 1

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    new 
iEnt
    iEnt 
create_entity("info_target")
    
set_pev(iEntpev_classname"check_speed")
    
set_pev(iEntpev_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")

    for(new 
iiNumi++)
    {
        if(
get_user_weapon(i) == CSW_KNIFE)
        {
            
entity_get_vector(iEV_VEC_velocityfVecVelocity)
            
iSpeed floatround(vector_length(fVecVelocity))
            if(
iSpeed g_iInvisFactor*255)
            {
                
set_user_rendering(ikRenderFxNone000kRenderTransAlphaiSpeed/g_iInvisFactor)
            }
            else
            {
                
set_user_rendering(ikRenderFxNone000kRenderNormal0)
            }
        }
        else
        {
            
set_user_rendering(ikRenderFxNone000kRenderNormal0)
        }
    }


You can not do anything to help me, please?

Excuse my English -> Google Translator :d

Exolent[jNr] 08-10-2011 11:24

Re: Invisibility
 
i is the array index, not the player index.
To get the player index, you have to index the players array.
Code:
new players[32], pnum get_players(players, pnum) new player for(new i = 0; i < pnum; i++) {     player = players[i]         // do stuff with "player" }

Pur3Biatch 08-10-2011 11:37

Re: Invisibility
 
Well, I did as you advised ->
PHP Code:

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

#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"
    
set_pev(iEntpev_classname"check_speed"
    
set_pev(iEntpev_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 
players[32], pnumFloat:fVecVelocity[3], iSpeed 

    get_players
(playerspnum
    for(new 
0pnumi++)
    { 
        new 
player
        player 
players[i]
        if(
get_user_weapon(player) == CSW_KNIFE
        { 
            
entity_get_vector(playerEV_VEC_velocityfVecVelocity
            
iSpeed floatround(vector_length(fVecVelocity)) 
            if(
iSpeed g_iInvisFactor*255
            { 
                
set_user_rendering(playerkRenderFxNone000kRenderTransAlphaiSpeed/g_iInvisFactor
            } 
            else 
            { 
                
set_user_rendering(playerkRenderFxNone000kRenderNormal0
            } 
        } 
        else 
        { 
            
set_user_rendering(playerkRenderFxNone000kRenderNormal0
        } 
    } 


but this is still not working. :?

Exolent[jNr] 08-10-2011 11:42

Re: Invisibility
 
Why did you copy/paste? It was only an example.

Pur3Biatch 08-10-2011 11:43

Re: Invisibility
 
Eh, I don't know, maybe it would work :D

Exolent[jNr] 08-10-2011 11:46

Re: Invisibility
 
PHP Code:

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

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

new g_iInvisFactor 1

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)
        }
    }



Pur3Biatch 08-10-2011 11:57

Re: Invisibility
 
It works! Oh, thank very much!


All times are GMT -4. The time now is 03:25.

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