Raised This Month: $ Target: $400
 0% 

Transparent player models when approaching them.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bad Cold Man
Senior Member
Join Date: Apr 2014
Old 11-14-2015 , 05:19   Re: Transparent player models when approaching them.
Reply With Quote #8

Quote:
Originally Posted by Franc1sco View Post
much of that code was written by me, especially since it has written parts in my language (spanish).


And SDKHook_SetTransmit ofcourse that works well.


Here I leave the original plugin.
PHP Code:
#include <sourcemod> 
#include <sdktools> 
#include <sdkhooks> 
#include <zombiereloaded>

#define PLUGIN_VERSION "1.0" 

new bool:g_bHide[MAXPLAYERS+1][MAXPLAYERS+1]; 
new 
bool:g_hide[MAXPLAYERS+1]; 

public 
Plugin:myinfo =  

    
name "SM Hide Teammates For Proximity"
    
author "Franc1sco franug"
    
description ""
    
version PLUGIN_VERSION
    
url "www.steamcommunity.com/id/franug/" 


public 
OnPluginStart() 

    
CreateTimer(0.5Pasar_TIMER_REPEAT);
    
    
HookEvent("player_death"Event_OnPlayerDeathEventHookMode_Pre);
    
    
RegConsoleCmd("sm_hide"Comando);
}

public 
Action:Comando(clientargs)
{
    
g_hide[client] = !g_hide[client];
    
PrintToChat(client"Hide feature %s" ,g_hide[client]?"Activated":"Desactivated");

    return 
Plugin_Handled;
}

public 
Action:Event_OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    for(new 
1<= MaxClientsi++)
        
g_bHide[client][i] = false
}

public 
ZR_OnClientInfected(clientattackerbool:motherInfectbool:respawnOverridebool:respawn)
{
    for(new 
1<= MaxClientsi++)
        
g_bHide[client][i] = false
}

public 
Action:Pasar(Handle:timer)
{
    for(new 
1<= MaxClientsi++)
        if(
IsClientInGame(i) && IsPlayerAlive(i) && ZR_IsClientHuman(i))
            
CheckClientOrg(i);

}

CheckClientOrg(Client
{
    
decl Float:MedicOrigin[3],Float:TargetOrigin[3], Float:Distance;
    
GetClientAbsOrigin(ClientMedicOrigin);
    for (new 
1<= MaxClientsX++)
    {
        if(
!= Client && IsClientInGame(X) && IsPlayerAlive(X) && ZR_IsClientHuman(X))
        {
            
GetClientAbsOrigin(XTargetOrigin);
            
Distance GetVectorDistance(TargetOrigin,MedicOrigin);
            if(
Distance <= 100.0)
                
g_bHide[Client][X] = true;
            else
                
g_bHide[Client][X] = false;
        }
    }
}

public 
OnClientPutInServer(client

    
g_hide[client] = true;
    for(new 
1<= MaxClientsi++)
        
g_bHide[client][i] = false
        
    
    
SDKHook(clientSDKHook_SetTransmitHook_SetTransmit); 


public 
Action:Hook_SetTransmit(client1client2

    if (
client1 != client2 && g_hide[client2] && g_bHide[client1][client2]) 
        return 
Plugin_Handled;
     
    return 
Plugin_Continue




I can make it easily (and for free) if someone can help me to test it with a server with people (add me in steam).
I've made a small change, because sm_hide already in use in another plugin.
PHP Code:

#include <sourcemod> 
#include <sdktools> 
#include <sdkhooks> 
#include <zombiereloaded>

#define PLUGIN_VERSION "1.0" 

new bool:g_bHider[MAXPLAYERS+1][MAXPLAYERS+1]; 
new 
bool:g_hider[MAXPLAYERS+1]; 

public 
Plugin:myinfo =  

    
name "SM Hider Teammates For Proximity"
    
author "Franc1sco franug"
    
description ""
    
version PLUGIN_VERSION
    
url "www.steamcommunity.com/id/franug/" 


public 
OnPluginStart() 

    
CreateTimer(0.5Pasar_TIMER_REPEAT);
    
    
HookEvent("player_death"Event_OnPlayerDeathEventHookMode_Pre);
    
    
RegConsoleCmd("sm_hider"Comando);
}

public 
Action:Comando(clientargs)
{
    
g_hider[client] = !g_hider[client];
    
PrintToChat(client"Hider feature %s" ,g_hider[client]?"Activated":"Desactivated");

    return 
Plugin_Handled;
}

public 
Action:Event_OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    for(new 
1<= MaxClientsi++)
        
g_bHider[client][i] = false
}

public 
ZR_OnClientInfected(clientattackerbool:motherInfectbool:respawnOverridebool:respawn)
{
    for(new 
1<= MaxClientsi++)
        
g_bHider[client][i] = false
}

public 
Action:Pasar(Handle:timer)
{
    for(new 
1<= MaxClientsi++)
        if(
IsClientInGame(i) && IsPlayerAlive(i) && ZR_IsClientHuman(i))
            
CheckClientOrg(i);

}

CheckClientOrg(Client
{
    
decl Float:MedicOrigin[3],Float:TargetOrigin[3], Float:Distance;
    
GetClientAbsOrigin(ClientMedicOrigin);
    for (new 
1<= MaxClientsX++)
    {
        if(
!= Client && IsClientInGame(X) && IsPlayerAlive(X) && ZR_IsClientHuman(X))
        {
            
GetClientAbsOrigin(XTargetOrigin);
            
Distance GetVectorDistance(TargetOrigin,MedicOrigin);
            if(
Distance <= 100.0)
                
g_bHider[Client][X] = true;
            else
                
g_bHider[Client][X] = false;
        }
    }
}

public 
OnClientPutInServer(client

    
g_hider[client] = true;
    for(new 
1<= MaxClientsi++)
        
g_bHider[client][i] = false
        
    
    
SDKHook(clientSDKHook_SetTransmitHook_SetTransmit); 


public 
Action:Hook_SetTransmit(client1client2

    if (
client1 != client2 && g_hider[client2] && g_bHider[client1][client2]) 
        return 
Plugin_Handled;
     
    return 
Plugin_Continue

__________________
Bad Cold Man is offline
 



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 12:42.


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