Raised This Month: $32 Target: $400
 8% 

[TF2] Third Person (Non-sv_cheats Edition)


Post New Thread Reply   
 
Thread Tools Display Modes
Twin_Future
Junior Member
Join Date: Nov 2014
Old 11-26-2014 , 19:50   Re: [TF2] Third Person (Non-sv_cheats Edition)
Reply With Quote #141

I don't know if this is allowed as I am new to this game and decided to have a loot at editing some of the modifications here to suit my preferences. Thanks for this modification, I really like it and it ads a better aspect to the game. If this isn't allowed please remove...

I have edited the thirdperson plugins so that admins can force thirdperson view on other players. I thought this would be fun to mess with trolls or cheats .
There is quite a lot of modifications to the original source. I am very new to TF2 and only been playing for a couple of days now..

I have created a simple check to see if player has admin flag BAN "sm_ban" so they can force thirdperson view on others.

Usage
USERS
Usage: tp // Allows user to only set 3rd person on themselves.
Usage: fp // Allows user to only set 1st person on themselves.

ADMINS
Usage: tp // Allows user to only set 3rd person on themselves.
Usage: fp // Allows user to only set 1st person on themselves.
Usage: tp <#userid|name> // Allows admins to set 3rd person on other users.
Usage: fp <#userid|name> // Allows admins to set 1st person on other users.
Usage: sm_thirdperson <#userid|name> // Allows admins to set 3rd person on other users.
Usage: sm_firstperson <#userid|name> // Allows admins to set 1st person on other users.
Usage: sm_thirdperson // Allows user to only set 3rd person on themselves.
Usage: sm_firstperson // Allows user to only set 1st person on themselves.

I created a custom admin menu so I can select 1st person and 3rd person on other users or everyone.

Files attached below, source and compiled version for install into sourcemod/plugins directory.

Source.
PHP Code:
//Thirdperson by DarthNinja, Edited by Twin_Future

/*****************************************************************


            L I B R A R Y   I N C L U D E S


*****************************************************************/

#include <sourcemod>
#include <sdktools>
#define PLUGIN_VERSION "2.2.0"

/*****************************************************************


            G L O B A L   V A R S


*****************************************************************/

new bool:g_bThirdPersonEnabled[MAXPLAYERS+1] = false;

/*****************************************************************


            P L U G I N   I N F O


*****************************************************************/

public Plugin:myinfo =
{
    
name "[TF2] Thirdperson",
    
author "DarthNinja, Edited by Twin_Future",
    
description "Allows players to use thirdperson without having to enable client sv_cheats",
    
version PLUGIN_VERSION,
    
url "DarthNinja.com"
};


/*****************************************************************


            F O R W A R D   P U B L I C S


*****************************************************************/

public OnPluginStart()
{
    
//LoadTranslations("thirdperson.phrases");
    
CreateConVar("thirdperson_version"PLUGIN_VERSION"Plugin Version",  FCVAR_PLUGIN|FCVAR_NOTIFY);
    
RegAdminCmd("sm_thirdperson"EnableThirdpersonADMFLAG_BAN"Usage: sm_thirdperson <#userid|name>");
    
RegAdminCmd("tp"EnableThirdperson0"Usage: sm_thirdperson");
    
RegAdminCmd("sm_firstperson"DisableThirdpersonADMFLAG_BAN"Usage: sm_firstperson <#userid|name>");
    
RegAdminCmd("fp"DisableThirdperson0"Usage: sm_firstperson");
    
HookEvent("player_spawn"OnPlayerSpawned);
    
HookEvent("player_class"OnPlayerSpawned);
}

public 
OnClientDisconnect(client)
{
    
g_bThirdPersonEnabled[client] = false;
}

/****************************************************************


            C A L L B A C K   F U N C T I O N S


****************************************************************/

public Action:OnPlayerSpawned(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
userid GetEventInt(event"userid");
    if (
g_bThirdPersonEnabled[GetClientOfUserId(userid)])
        
CreateTimer(0.2SetViewOnSpawnuserid);
}

public 
Action:SetViewOnSpawn(Handle:timerany:userid)
{
    new 
client GetClientOfUserId(userid);
    if (
client != 0)    //Checked g_bThirdPersonEnabled in hook callback, dont need to do it here~
    
{
        
SetVariantInt(1);
        
AcceptEntityInput(client"SetForcedTauntCam");
    }
}

public 
Action:EnableThirdperson(clientargs)
{
    
decl String:target[32];
    
decl String:target_name[MAX_NAME_LENGTH];
    
decl target_list[MAXPLAYERS];
    
decl target_count;
    
decl bool:tn_is_ml;

    
//validate args
    
if (args 1)
    {
        new 
String:name[MAX_NAME_LENGTH];
        
GetClientName(clientnamesizeof(name));
        
PerformThirdPerson(client,client);
        
ShowActivity2(client"[SM] ""%s 3rd Person Enabled"name);
        return 
Plugin_Handled;
    }
    else
    {
        if (!
CheckCommandAccess(client"sm_ban"ADMFLAG_BAN))
        {    
            
ReplyToCommand(client"[SM] Usage: tp");
            return 
Plugin_Handled;
        }
        else
        {
            
//get argument
            
GetCmdArg(1targetsizeof(target));        
            
            
//get target(s)
            
if ((target_count ProcessTargetString(
                    
target,
                    
client,
                    
target_list,
                    
MAXPLAYERS,
                    
0,
                    
target_name,
                    
sizeof(target_name),
                    
tn_is_ml)) <= 0)
            {
                
ReplyToTargetError(clienttarget_count);
                return 
Plugin_Handled;
            }
            
            for (new 
0target_counti++)
            {
                
PerformThirdPerson(client,target_list[i]);
            }
            
            
ShowActivity2(client"[SM] ""%s 3rd Person Enabled"target_name);
            return 
Plugin_Handled;
        }
    }
}

public 
Action:DisableThirdperson(clientargs)
{
    
decl String:target[32];
    
decl String:target_name[MAX_NAME_LENGTH];
    
decl target_list[MAXPLAYERS];
    
decl target_count;
    
decl bool:tn_is_ml;
    
    
//validate args
    
if (args 1)
    {
        new 
String:name[MAX_NAME_LENGTH];
        
GetClientName(clientnamesizeof(name));
        
PerformFirstPerson(client,client);
        
ShowActivity2(client"[SM] ""%s 1st Person Enabled"name);
        return 
Plugin_Handled;
    }
    else
    {
        if (!
CheckCommandAccess(client"sm_ban"ADMFLAG_BAN))
        {        
            
ReplyToCommand(client"[SM] Usage: fp");
            return 
Plugin_Handled;
        }
        else
        {
            
//get argument
            
GetCmdArg(1targetsizeof(target));        
            
            
//get target(s)
            
if ((target_count ProcessTargetString(
                    
target,
                    
client,
                    
target_list,
                    
MAXPLAYERS,
                    
0,
                    
target_name,
                    
sizeof(target_name),
                    
tn_is_ml)) <= 0)
            {
                
ReplyToTargetError(clienttarget_count);
                return 
Plugin_Handled;
            }
            
            for (new 
0target_counti++)
            {
                
PerformFirstPerson(client,target_list[i]);
            }
            
            
// Translated version
            //ShowActivity2(client, "[SM] ", "%t", "3rd Person Enabled", target_name);
            
ShowActivity2(client"[SM] ""%s 1st Person Enabled"target_name);
            return 
Plugin_Handled;
        }
    }
}

/*****************************************************************


            P L U G I N   F U N C T I O N S


*****************************************************************/

PerformThirdPerson(clienttarget)
{
    
SetVariantInt(1);
    
AcceptEntityInput(target"SetForcedTauntCam");
    
g_bThirdPersonEnabled[target] = true;
    
LogAction(client,target"\"%L\" 3rd Person Enabled \"%L\"" clienttarget);
}

PerformFirstPerson(clienttarget)
{
    
SetVariantInt(0);
    
AcceptEntityInput(target"SetForcedTauntCam");
    
g_bThirdPersonEnabled[target] = false;
    
LogAction(client,target"\"%L\" 1st Person Enabled \"%L\"" clienttarget);

you can add this also to your adminmenu_custom.txt also example.
Code:
"Set Player 1st Person"
{
    "cmd"            "sm_firstperson #1"
    "admin"        "sm_ban"
    "execute"        "player"
    "1"
    {
        "type"     "groupplayer"
        "method"    "name"
        "title"    "Player/s to set 1st person"
    }
}
"Set Player 3rd Person"
{
    "cmd"            "sm_thirdperson #1"
    "admin"        "sm_ban"
    "execute"        "player"
    "1"
    {
        "type"     "groupplayer"
        "method"    "name"
        "title"    "Player/s to set 3rd person"
    }
}
Compiled version for download

Attached.
Attached Files
File Type: sp Get Plugin or Get Source (ThirdPerson.sp - 723 views - 5.6 KB)

Last edited by Twin_Future; 11-27-2014 at 04:10. Reason: removed attachment. see next message
Twin_Future is offline
psychonic

BAFFLED
Join Date: May 2008
Old 11-26-2014 , 20:25   Re: [TF2] Third Person (Non-sv_cheats Edition)
Reply With Quote #142

Quote:
Originally Posted by Twin_Future View Post
I don't know if this is allowed
It is, but please attach the sp source file rather than inlining in post. It will auto-generate an smx "Get Plugin" link.
psychonic is offline
XaxaXoxo
Senior Member
Join Date: Feb 2011
Old 03-25-2015 , 08:38   Re: [TF2] Third Person (Non-sv_cheats Edition)
Reply With Quote #143

Quote:
L 03/23/2015 - 19:19:42: Info (map "vsh_volcanic_b2") (file "errors_20150323.log")
L 03/23/2015 - 19:19:42: [SM] Native "AcceptEntityInput" reported: Entity 7 (7) is not a CBaseEntity
L 03/23/2015 - 19:19:42: [SM] Displaying call stack trace for plugin "thirdperson.smx":
L 03/23/2015 - 19:19:42: [SM] [0] Line 43, ThirdPerson.sp::SetViewOnSpawn()
L 03/23/2015 - 19:52:06: Error log file session closed.
L 03/23/2015 - 214:14: SourceMod error session started
L 03/23/2015 - 214:14: Info (map "vsh_sandbox_v7") (file "errors_20150323.log")
L 03/23/2015 - 214:14: [SM] Native "AcceptEntityInput" reported: Entity 4 (4) is not a CBaseEntity
L 03/23/2015 - 214:14: [SM] Displaying call stack trace for plugin "thirdperson.smx":
L 03/23/2015 - 214:14: [SM] [0] Line 43, ThirdPerson.sp::SetViewOnSpawn()
L 03/23/2015 - 21:48:51: Error log file session closed.
XaxaXoxo is offline
Argos
Member
Join Date: Apr 2015
Old 11-14-2015 , 06:47   Re: [TF2] Third Person (Non-sv_cheats Edition)
Reply With Quote #144

there is a possibility that this plugin can correct the distortion of the look in the sniper rifle where is in Third Person ?
Argos is offline
Transit Of Venus
Senior Member
Join Date: May 2014
Location: Australia
Old 12-08-2015 , 00:09   Re: [TF2] Third Person (Non-sv_cheats Edition)
Reply With Quote #145

Here is a version of the plugin without the 'helloserverplugintogglethirdpresononmeplease ' exploit.
Attached Files
File Type: smx ThirdPerson.smx (4.9 KB, 373 views)
File Type: sp Get Plugin or Get Source (ThirdPerson.sp - 643 views - 2.0 KB)
__________________

Click on the banner to explore my servers and more
Transit Of Venus is offline
Send a message via ICQ to Transit Of Venus Send a message via Skype™ to Transit Of Venus
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 12-08-2015 , 00:51   Re: [TF2] Third Person (Non-sv_cheats Edition)
Reply With Quote #146

Quote:
Originally Posted by Transit Of Venus View Post
Here is a version of the plugin without the 'helloserverplugintogglethirdpresononmeplease ' exploit.
If it is actually causing issues on your server, then you should post details here and the plugin author can fix them. Alternatively, you can just override helloserverplugintogglethirdpresononmeplease to require z flag access.
__________________
ddhoward is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 06-12-2017 , 10:39   Re: [TF2] Third Person (Non-sv_cheats Edition)
Reply With Quote #147

I'm sorry, but helloserverplugintogglethirdpresononmeplease needs to go.

It is a public command, people are abusing it on public servers, and it isn't documented so server admins do not know what is going on or how to disable it.
__________________
asherkin is offline
cigzag
AlliedModders Donor
Join Date: Nov 2014
Location: NZ
Old 07-10-2017 , 16:49   Re: [TF2] Third Person (Non-sv_cheats Edition)
Reply With Quote #148

I just added a new ConVar to the plugin to disable or enable the leonardo command

sm_tp_leonardo - Enables or disables the leonardo command, 0 by default.
Attached Files
File Type: sp Get Plugin or Get Source (ThirdPerson.sp - 1428 views - 2.5 KB)
cigzag is offline
TextBookrelic45
New Member
Join Date: May 2022
Old 05-13-2022 , 05:05   Re: [TF2] Third Person (Non-sv_cheats Edition)
Reply With Quote #149

Old thread and tagged TF2 but, I was wanting to use this on my Left 4 Dead 2 server and was wondering if that would be possible.
TextBookrelic45 is offline
Reply


Thread Tools
Display Modes

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 05:26.


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