Jump to content

[RACE]All Players Invisible + Vehicle


Admigo

Recommended Posts

Heey all,

I have this code from kenix and solid:

state = not state 
    for _, v in pairs( getElementsByType 'player' ) do 
        if v ~= localPlayer then 
            local theVehicle = getPedOccupiedVehicle ( v ) 
        if state then 
                setPlayerNametagShowing( v, false ) 
                setElementAlpha( v, 0 ) 
        setElementAlpha (theVehicle, 0) 
            else 
                setPlayerNametagShowing( v, true ) 
                setElementAlpha( v, 255 ) 
        setElementAlpha (theVehicle, 255) 
            end 
        end 
    end 

And added invisible vehicle but i still can see light and nitro of vehicle.

And when someone in server enters a race pickup they cars and players will be visible again.

How can i fix this problems?

Thanks Admigo

Link to comment

use setElementDimension instead because:

You wont be able to see their nitro(they will be completely hidden)

you wont get hurt if they blow up near you(they dont exist it the same space as you)

it works as if the player is not there, meaning that you will have the same fps when 50 vehicles are near you as if only 2 vehicles would be near you

Link to comment

But i placed this code in race_client.

There needs to be a way that i can hide the lights from car+nitro.

I need this code because when players have bad fps they will hide the players so the fps will increase.

I think when u hide the players mta dont load the player data.

Link to comment

for nitro try this shader by NeXTreme

  
// 
// nitro.fx 
// 
// Author: NeXTreme 
  
  
//--------------------------------------------------------------------- 
// Nitro settings 
//--------------------------------------------------------------------- 
float4 gNitroColor = float4(255,255,255,0); 
  
  
//--------------------------------------------------------------------- 
// These parameters are set by MTA whenever a shader is drawn 
//--------------------------------------------------------------------- 
float4x4 gWorld : WORLD; 
float4x4 gView : VIEW; 
float4x4 gProjection : PROJECTION; 
  
  
//------------------------------------------------------------------------------------------ 
// textureState - String value should be a texture number followed by 'Texture' 
//------------------------------------------------------------------------------------------ 
texture gTexture0           < string textureState="0,Texture"; >; 
  
  
//--------------------------------------------------------------------- 
// Sampler for the main texture 
//--------------------------------------------------------------------- 
sampler texsampler = sampler_state 
{ 
    Texture = (gTexture0); 
}; 
  
  
//--------------------------------------------------------------------- 
// Structure of data sent to the vertex and pixel shaders 
//--------------------------------------------------------------------- 
struct VertexShaderInput 
{ 
    float3 Position : POSITION0; 
    float4 Diffuse : COLOR0; 
    float2 TexCoords : TEXCOORD0; 
}; 
  
struct PixelShaderInput 
{ 
    float4 Position  : POSITION; 
    float4 Diffuse : COLOR0; 
    float2 TexCoords : TEXCOORD0; 
}; 
  
  
//------------------------------------------------------------------------------------------ 
// VertexShaderFunction 
//------------------------------------------------------------------------------------------ 
  
PixelShaderInput VertexShaderFunction(VertexShaderInput In) 
{ 
    PixelShaderInput Out = (PixelShaderInput)0; 
     
    float4 posWorld = mul(float4(In.Position,1), gWorld); 
    float4 posWorldView = mul(posWorld, gView); 
    Out.Position = mul(posWorldView, gProjection); 
    Out.TexCoords = In.TexCoords; 
     
    Out.Diffuse = saturate(gNitroColor); 
     
    return Out; 
} 
  
  
//------------------------------------------------------------------------------------------ 
// PixelShaderFunction 
//------------------------------------------------------------------------------------------ 
float4 PixelShaderFunction(PixelShaderInput In) : COLOR0 
{ 
    float4 texel = tex2D(texsampler, In.TexCoords); 
     
    float4 finalColor = texel * In.Diffuse; 
         
    finalColor *= 0.23; 
     
    return finalColor; 
} 
  
  
  
//----------------------------------------------------------------------------- 
// Techniques 
//----------------------------------------------------------------------------- 
technique nitro 
{ 
    pass P0 
    { 
        VertexShader = compile vs_2_0 VertexShaderFunction(); 
        PixelShader  = compile ps_2_0 PixelShaderFunction(); 
    } 
} 
  
  
technique fallback 
{ 
    pass P0 
    { 
    } 
} 
  

Edited by Guest
Link to comment
  • 4 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...