AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [TF2] thirdperson for tradeserver (https://forums.alliedmods.net/showthread.php?t=145589)

pilger 12-18-2010 03:17

[TF2] thirdperson for tradeserver
 
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!?

Silvers 12-18-2010 07:07

Re: [TF2] thirdperson for tradeserver
 
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.

pilger 12-18-2010 11:27

Re: [TF2] thirdperson for tradeserver
 
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. :\

Geit 12-19-2010 15:00

Re: [TF2] thirdperson for tradeserver
 
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);
}


pilger 12-19-2010 16:28

Re: [TF2] thirdperson for tradeserver
 
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?

Thrawn2 01-07-2011 19:40

Re: [TF2] thirdperson for tradeserver
 
tf2 update:
Added the "Server can execute" flag to the “firstperson” and “thirdperson” commands.

this should help i guess

pheadxdll 01-07-2011 20:55

Re: [TF2] thirdperson for tradeserver
 
Quote:

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

this should help i guess

Still need sv_cheats :down: anybody find a way around this?

Silvers 01-07-2011 20:57

Re: [TF2] thirdperson for tradeserver
 
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.

Monkeys 01-07-2011 21:13

Re: [TF2] thirdperson for tradeserver
 
Stripping cheatflags is easy, so with the ScE update it should work.

bl4nk 01-07-2011 21:20

Re: [TF2] thirdperson for tradeserver
 
Quote:

Originally Posted by Monkeys (Post 1388502)
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.


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

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