AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   SetTransmit (https://forums.alliedmods.net/showthread.php?t=224958)

Nano2e 08-30-2013 07:43

SetTransmit
 
I've been trying to find a way to render players with outlines or a colour overlay via SetTransmit for specific clients but I've found nothing.

I've had people tell me to do it via SetTransmit but I really don't know how too. Is there anyone out there who has a working method that they could share or someone who knows how to that could help me out?

Oshizu 08-30-2013 08:40

Re: SetTransmit
 
Here's a quick guide for CS:GO:
- When player spawns check what player model they have (prop_dynamic)
- Parent Playermodel prop_dynamic to player and make it follow exactly player animations
- Set all those prop_dynamic m_bGlowEnabled to 1
- SetEntityRenderColor to invisible prop_dynamic (Might avoid this step)
- Use SetTransmit to make SetTransmit not showup for clients from other team example:
For Counter Terrorist prop_dynamic:
PHP Code:

public Action:Hook_SetTransmit(entityclient

 if(
GetClientTeam(client) == 2)
 {
  return 
Plugin_Handled
 }


For Terrorist Team:
PHP Code:

public Action:Hook_SetTransmit(entityclient

 if(
GetClientTeam(client) == 3)
 {
  return 
Plugin_Handled
 }


To change color of team of prop_dynamic outline change
m_iTeamNum 2 - T 3 - CT 1 - Gray

Nano2e 08-30-2013 08:46

Re: SetTransmit
 
Quote:

Originally Posted by Oshizu (Post 2024678)
Here's a quick guide for CS:GO:
- When player spawns check what player model they have (prop_dynamic)
- Parent Playermodel prop_dynamic to player and make it follow exactly player animations
- Set all those prop_dynamic m_bGlowEnabled to 1
- SetEntityRenderColor to invisible prop_dynamic (Might avoid this step)
- Use SetTransmit to make SetTransmit not showup for clients from other team example:
For Counter Terrorist prop_dynamic:
PHP Code:

public Action:Hook_SetTransmit(entityclient

 if(
GetClientTeam(client) == 2)
 {
  return 
Plugin_Handled
 }


For Terrorist Team:
PHP Code:

public Action:Hook_SetTransmit(entityclient

 if(
GetClientTeam(client) == 3)
 {
  return 
Plugin_Handled
 }


To change color of team of prop_dynamic outline change
m_iTeamNum 2 - T 3 - CT 1 - Gray

Cheers for the response, I'm working with TF2 but I assume it would be similar. I can see what your explaining but I still don't how to do it lol.

I've got this so far but I know its wrong:

Code:

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

public OnClientPostAdminCheck(client)
{
        SDKHook(client, SDKHook_SetTransmit, OnTransmit);
}

public Action:OnTransmit(entity, client)
{
        decl String:steamid[32]       
        GetClientAuthString(client, steamid, sizeof(steamid))
       
        if (StrEqual(steamid[0], "STEAM_0:0:18416004"))
        {
                SetEntProp(entity, Prop_Send, "m_bGlowEnabled", 1);
                return Plugin_Continue;
        }
       
        return Plugin_Continue;
}

That makes all players so I need to have something that followers the player once they spawn and kill it when they die, if so this what I don't know how to do properly :[

Oshizu 08-30-2013 08:58

Re: SetTransmit
 
1 Attachment(s)
I've attached some stuff that MasterOfTheXP and me had done for outlines in TF2:

Nano2e 08-30-2013 09:08

Re: SetTransmit
 
Quote:

Originally Posted by Oshizu (Post 2024685)
I've attached some stuff that MasterOfTheXP and me had done for outlines in TF2:

Cheers I'll take a look at the code, I presume this enable the glow for all players to see yeah?

Oshizu 08-30-2013 09:13

Re: SetTransmit
 
Quote:

Originally Posted by Nano2e (Post 2024691)
Cheers I'll take a look at the code, I presume this enable the glow for all players to see yeah?

Yeah all players see their outlines
You can use SetTransmit thought to make it team only visible :bacon:

Nano2e 08-30-2013 09:16

Re: SetTransmit
 
Quote:

Originally Posted by Oshizu (Post 2024693)
Yeah all players see their outlines
You can use SetTransmit thought to make it team only visible :bacon:

Would I just return handled on the SetTransmit or would I have to kill the entity on the player?

Oshizu 08-30-2013 09:24

Re: SetTransmit
 
return Plugin_Handled; - makes glow dissappear for specific client
return Plugin_Continue; - visible glow

Nano2e 08-30-2013 09:36

Re: SetTransmit
 
I've got this but all clients that aren't me get problems, like motd not working, not being able to a join a team and crashes:

PHP Code:

#include <tf2_stocks>
#include <sdkhooks>

new PlayerTeamFlag[MAXPLAYERS 1];
new 
PlayerHasFlag[MAXPLAYERS+1] = false;
new 
TeamFlagOwner[2049];

public 
OnPluginStart()
{
    
RegConsoleCmd("sm_teamoutline"Command_TeamOutline);
    
    
HookEvent("player_death"Event_DeathEventHookMode_Pre);
    
HookEvent("player_spawn"Event_PlayerSpawn);
    
HookEvent("player_changeclass"Event_ChangeClass);
}

public 
OnClientPutInServer(client)
{
    
PlayerHasFlag[client] = false;
}

public 
OnMapStart()
{
    for (new 
TFClassType:TFClass_Scout<= TFClass_Engineeri++)
    {
        switch (
i)
        {
            case 
TFClass_ScoutPrecacheModel("models/player/scout.mdl"true);
            case 
TFClass_SoldierPrecacheModel("models/player/soldier.mdl"true);
            case 
TFClass_PyroPrecacheModel("models/player/pyro.mdl"true);
            case 
TFClass_DemoManPrecacheModel("models/player/demo.mdl"true);
            case 
TFClass_HeavyPrecacheModel("models/player/heavy.mdl"true);
            case 
TFClass_EngineerPrecacheModel("models/player/engineer.mdl"true);
            case 
TFClass_MedicPrecacheModel("models/player/medic.mdl"true);
            case 
TFClass_SniperPrecacheModel("models/player/sniper.mdl"true);
            case 
TFClass_SpyPrecacheModel("models/player/spy.mdl"true);
        }
    }
}

public 
OnPluginEnd()
{
    for (new 
1<= MaxClientsi++)
    {
        if (
PlayerTeamFlag[i]) 
        {
            
AcceptEntityInput(PlayerTeamFlag[i], "Kill");
        }
    }
}

public 
Action:Command_TeamOutline(clientargs)
{
    if (!
args)
    {
        new 
String:arg0[35];
        
GetCmdArg(0arg0sizeof(arg0));
        
ReplyToCommand(client"[SM] Usage: %s <target> [1/0] - Sets team-coloured outline on player(s)."arg0);
        return 
Plugin_Handled;
    }
    
    new 
String:arg1[MAX_TARGET_LENGTH], bool:alwaysOffbool:alwaysOn;
    
GetCmdArg(1arg1sizeof(arg1));
    
    if (
args 1)
    {
        new 
String:arg2[2];
        
GetCmdArg(2arg2sizeof(arg2));
        if (
StringToInt(arg2)) alwaysOn true;
        else 
alwaysOff true;
    }
    
    new 
String:target_name[MAX_TARGET_LENGTH], target_list[MAXPLAYERS], target_countbool:tn_is_ml;
    if ((
target_count ProcessTargetString(arg1clienttarget_listMAXPLAYERSCOMMAND_FILTER_ALIVEtarget_namesizeof(target_name), tn_is_ml)) <= 0)
    {
        
ReplyToTargetError(clienttarget_count);
        return 
Plugin_Handled;
    }
    for (new 
0target_counti++)
    {
        new 
target target_list[i], bool:giveOutline;
        if (
alwaysOngiveOutline true;
        else if (
alwaysOff
        {
            
giveOutline false;
            
PlayerHasFlag[target] = false;
        }
        else if (
PlayerTeamFlag[target]) giveOutline false;
        else 
giveOutline true;
        if (
PlayerTeamFlag[target]) AcceptEntityInput(PlayerTeamFlag[target], "Kill");
        if (
giveOutline)
        {
            
TeamOutlines(target);
        }
    }
    if (
alwaysOffShowActivity2(client"[SM] ""Disabled team-coloured outline on %s."target_name);
    else if (
alwaysOnShowActivity2(client"[SM] ""Enabled team-coloured outline on %s."target_name);
    else 
ShowActivity2(client"[SM] ""Toggled team-coloured outline on %s."target_name);
    return 
Plugin_Handled;
}

TeamOutlines(target)
{
    new 
Ent CreateEntityByName("item_teamflag");
    new 
Float:Pos[3];
    
    
GetEntPropVector(targetProp_Send"m_vecOrigin"Pos);
    
Pos[2] -= 2500.0;
    
    
TeleportEntity(EntPosNULL_VECTORNULL_VECTOR);
    
DispatchSpawn(Ent);
    
    switch (
TF2_GetPlayerClass(target))
    {
        case 
TFClass_ScoutSetEntityModel(Ent"models/player/scout.mdl");
        case 
TFClass_SoldierSetEntityModel(Ent"models/player/soldier.mdl");
        case 
TFClass_PyroSetEntityModel(Ent"models/player/pyro.mdl");
        case 
TFClass_DemoManSetEntityModel(Ent"models/player/demo.mdl");
        case 
TFClass_HeavySetEntityModel(Ent"models/player/heavy.mdl");
        case 
TFClass_EngineerSetEntityModel(Ent"models/player/engineer.mdl");
        case 
TFClass_MedicSetEntityModel(Ent"models/player/medic.mdl");
        case 
TFClass_SniperSetEntityModel(Ent"models/player/sniper.mdl");
        case 
TFClass_SpySetEntityModel(Ent"models/player/spy.mdl");
    }
    
    new 
Float:hands_away_from_my_intel[3] = {999999.0999999.0999999.0}; // removes possiblity to take intel away by touching payer
    
SetEntPropVector(EntProp_Send"m_vecMins"hands_away_from_my_intel); // removes possiblity to take intel away by touching payer
    
SetEntPropVector(EntProp_Send"m_vecMaxs"hands_away_from_my_intel); // removes possiblity to take intel away by touching payer
    
SetVariantInt(GetClientTeam(target));
    
AcceptEntityInput(Ent"SetTeam");
    
SetVariantString("!activator");
    
AcceptEntityInput(Ent"SetParent"target);
    
SetEntProp(EntProp_Send"m_fEffects"129);
    
SetVariantString("partyhat");
    
AcceptEntityInput(Ent"SetParentAttachment"target);
    
PlayerTeamFlag[target] = Ent;
    
TeamFlagOwner[Ent] = target;
    
PlayerHasFlag[target] = true;
}

public 
Action:Event_ChangeClass(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
victim GetClientOfUserId(GetEventInt(event"userid"));
    
    if (
PlayerTeamFlag[victim]) 
    {    
        
AcceptEntityInput(PlayerTeamFlag[victim], "Kill");
    }
}

public 
Action:Event_Death(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
victim GetClientOfUserId(GetEventInt(event"userid"));
    
    if (
GetEventInt(event"death_flags") & TF_DEATHFLAG_DEADRINGER)
    {    
        return;
    }
    
    if (
PlayerTeamFlag[victim]) 
    {    
        
AcceptEntityInput(PlayerTeamFlag[victim], "Kill");
    }
}

public 
Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
target GetClientOfUserId(GetEventInt(event"userid"));
    
    
SDKHook(targetSDKHook_SetTransmitOnTransmit);
    
    if(
PlayerHasFlag[target])
    {
        if (
PlayerTeamFlag[target])
        {
            
AcceptEntityInput(PlayerTeamFlag[target], "Kill");
        }
        
        
TeamOutlines(target);
    }
}

public 
OnClientDisconnect(client)
{
    if (
PlayerTeamFlag[client]) 
    {
        
AcceptEntityInput(PlayerTeamFlag[client], "Kill");
    }
    
    
PlayerHasFlag[client] = 0;
}

public 
OnEntityDestroyed(Ent)
{
    if (
TeamFlagOwner[Ent])
    {
        
PlayerTeamFlag[TeamFlagOwner[Ent]] = 0;
        
TeamFlagOwner[Ent] = 0;
    }
}

public 
Action:OnTransmit(entityclient)
{
    
decl String:steamid[32]    
    
GetClientAuthString(clientsteamidsizeof(steamid))
    
    if(!
StrEqual(steamid[0], "STEAM_0:0:18416004"))
    {
        return 
Plugin_Handled
    }
    
    return 
Plugin_Continue



Mitchell 08-30-2013 11:28

Re: SetTransmit
 
Quote:

Originally Posted by Oshizu (Post 2024678)
Here's a quick guide for CS:GO:
- When player spawns check what player model they have (prop_dynamic)
- Parent Playermodel prop_dynamic to player and make it follow exactly player animations
- Set all those prop_dynamic m_bGlowEnabled to 1
- SetEntityRenderColor to invisible prop_dynamic (Might avoid this step)
- Use SetTransmit to make SetTransmit not showup for clients from other team example:

lol, thats exactly what i did in cs:go, if you want to get fancy you can copy the m_nSequence to the prop from the player, and it'll copy the crouching.


All times are GMT -4. The time now is 04:05.

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