Raised This Month: $51 Target: $400
 12% 

[TF2] thirdperson for tradeserver


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pilger
Senior Member
Join Date: Sep 2010
Old 12-18-2010 , 03:17   [TF2] thirdperson for tradeserver
Reply With Quote #1

Hello guys,

Recently browsing through some trade servers, i stumbled upon this "!thirdperson" command which worked quite nicely.

I did some searching and found some very buggy methods of turning the thirdperson on. Ways that hide the character model and are very bugged in general.

I realise the best way to do the thirdperson is to allow the client to set the thirdview through console, client-side, but i wonder how did the server do to make the command turn into "!thirdperson" on the chat.

Can someone help on this!?
pilger is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 12-18-2010 , 07:07   Re: [TF2] thirdperson for tradeserver
Reply With Quote #2

RegConsoleCmd("sm_test", CmdTest); // Will trigger if players type !test or /test in chat or sm_test in console. Any command you make with sm_ at the front will have this behaviour in Sourcemod.

Then on the callback set the cvars or w/e for thirdperson.
__________________
Silvers is offline
pilger
Senior Member
Join Date: Sep 2010
Old 12-18-2010 , 11:27   Re: [TF2] thirdperson for tradeserver
Reply With Quote #3

You didn't quite get the question, mate.

I'm totally capable of creating the console command. The catch here is to make it work CLIENT-SIDE! You can't actually force a player to set the classical thirdperson (which they write on the console), so people developped other ways to fake it.

What i'm looking for is one of these ways... one that works. :\
pilger is offline
Geit
Senior Member
Join Date: Oct 2009
Location: Home
Old 12-19-2010 , 15:00   Re: [TF2] thirdperson for tradeserver
Reply With Quote #4

Code:
#pragma semicolon 1
#include <sourcemod>

new g_oFOV;
new g_oDefFOV;

public OnPluginStart() 
{
    g_oFOV = FindSendPropOffs("CBasePlayer", "m_iFOV");
    g_oDefFOV = FindSendPropOffs("CBasePlayer", "m_iDefaultFOV");
    RegConsoleCmd("sm_firstperson", Command_SwitchView, "Sets Client to First Person");
    RegConsoleCmd("sm_thirdperson", Command_SwitchView, "Sets Client to Third Person");
}

public Action:Command_SwitchView(client, args)
{
    decl String:CmdName[16];
    GetCmdArg(0, CmdName, sizeof(CmdName));
    if (StrContains(CmdName, "third", false))
        SwitchView(client, true, false);
    else
        SwitchView(client, false, true);
}

stock SwitchView(target, bool:observer, bool:viewmodel)
{
    SetEntPropEnt(target, Prop_Send, "m_hObserverTarget", observer ? target:-1);
    SetEntProp(target, Prop_Send, "m_iObserverMode", observer ? 1:0);
    SetEntData(target, g_oFOV, observer ? 100:GetEntData(target, g_oDefFOV, 4), 4, true);
    SetEntProp(target, Prop_Send, "m_bDrawViewmodel", viewmodel ? 1:0);
}

Last edited by Geit; 12-19-2010 at 15:10.
Geit is offline
pilger
Senior Member
Join Date: Sep 2010
Old 12-19-2010 , 16:28   Re: [TF2] thirdperson for tradeserver
Reply With Quote #5

That is part of the prophunt plugin, right?

I've tried that already and it sort of lost the lag compensation and i couldn't see the character model, which was the whole point of the thirdperson. So i guess that didn't work out too well.

Many thanks for the try!


Any other ideas?

Last edited by pilger; 12-19-2010 at 16:37.
pilger is offline
Thrawn2
Veteran Member
Join Date: Apr 2009
Old 01-07-2011 , 19:40   Re: [TF2] thirdperson for tradeserver
Reply With Quote #6

tf2 update:
Added the "Server can execute" flag to the “firstperson” and “thirdperson” commands.

this should help i guess
__________________
einmal mit profis arbeiten. einmal.
Thrawn2 is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 01-07-2011 , 20:55   Re: [TF2] thirdperson for tradeserver
Reply With Quote #7

Quote:
Originally Posted by [AAA] Thrawn View Post
tf2 update:
Added the "Server can execute" flag to the “firstperson” and “thirdperson” commands.

this should help i guess
Still need sv_cheats anybody find a way around this?
__________________
pheadxdll is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 01-07-2011 , 20:57   Re: [TF2] thirdperson for tradeserver
Reply With Quote #8

PHP Code:
GotoThirdPerson(client)
{
    
SetEntPropEnt(clientProp_Send"m_hObserverTarget"0);
    
SetEntProp(clientProp_Send"m_iObserverMode"1);
    
SetEntProp(clientProp_Send"m_bDrawViewmodel"0);    
}



GotoFirstPerson(client)
{
    
SetEntPropEnt(clientProp_Send"m_hObserverTarget", -1);
    
SetEntProp(clientProp_Send"m_iObserverMode"0);
    
SetEntProp(clientProp_Send"m_bDrawViewmodel"1);

I think this works for TF2 (I haven't tested) but it works in L4D2 at least. It's pretty much the same code as above though.
__________________
Silvers is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 01-07-2011 , 21:13   Re: [TF2] thirdperson for tradeserver
Reply With Quote #9

Stripping cheatflags is easy, so with the ScE update it should work.
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 01-07-2011 , 21:20   Re: [TF2] thirdperson for tradeserver
Reply With Quote #10

Quote:
Originally Posted by Monkeys View Post
Stripping cheatflags is easy, so with the ScE update it should work.
Pretty sure that won't work since it's a client command, not a server command. I'd suggest testing it out and posting what you find.
bl4nk is offline
Reply



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 10:30.


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