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

[Solved!] [Tf2] Commands on player join


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MrTimcakes
Senior Member
Join Date: Jan 2012
Location: Uk
Old 06-04-2012 , 11:00   [Solved!] [Tf2] Commands on player join
Reply With Quote #1

I am a server owner and i have many plugins i type into the console every time i join i would like to know if there is a way for the server to exec the commands when i join. So i usually type Sm_fov @me 120 For 120 Fov andsm_noselfdamage so i can rocket jump with no damage. Is this possible?

If you need more info just ask me

Thanks, Ducky

Last edited by MrTimcakes; 06-05-2012 at 09:36.
MrTimcakes is offline
MasterOfTheXP
Veteran Member
Join Date: Aug 2011
Location: Cloudbank
Old 06-04-2012 , 14:07   Re: [Tf2] Commands on player join
Reply With Quote #2

Change it, compile it, n' go.

PHP Code:
#include <sourcemod>

public OnClientPostAdminCheck(client)
{
    new 
String:SteamID[50];
    
GetClientAuthString(clientSteamID50);
    if (
StrEqual(SteamID"STEAM_Y:O:URSTEAMID"false))
    {
        
FakeClientCommand(client"sm_fov @me 120");
        
FakeClientCommand(client"sm_noselfdamage");
    }

Although, if that doesn't work (even though it should, since you're in-game when PostAdminCheck happens), it may need a teamchange hook instead.
__________________
Plugins / My Steam / TF2 Sandbox (plugin beta testing!)
MasterOfTheXP is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 06-04-2012 , 14:58   Re: [Tf2] Commands on player join
Reply With Quote #3

You could just put all the commands into a .cfg file like C:\Program Files\Steam\steamapps\<username>\team fortress 2\tf\cfg\myserver.cfg, then type "exec myserver" in console when you join.
__________________
Dr. McKay is offline
MrTimcakes
Senior Member
Join Date: Jan 2012
Location: Uk
Old 06-04-2012 , 16:48   Re: [Tf2] Commands on player join
Reply With Quote #4

Thanks it worked. Im just trying to find out if i can use a Cfg with the commands in for the commands and seeing if i can do the same to the steam id for multiple users.

Thanks, Ducky
__________________
MrTimcakes is offline
Snaggle
AlliedModders Donor
Join Date: Jul 2010
Location: England
Old 06-04-2012 , 16:51   Re: [Tf2] Commands on player join
Reply With Quote #5

There is also the bind method. You can bind a key to those commands.

bind "YOUR KEY" "sm_fov @me 120; sm_noselfdamage"
PHP Code:
bind "K" "sm_fov @me 120; sm_noselfdamage" 

Last edited by Snaggle; 06-04-2012 at 16:52.
Snaggle is offline
xomp
BANNED
Join Date: Jul 2008
Old 06-04-2012 , 17:17   Re: [Tf2] Commands on player join
Reply With Quote #6

Quote:
Originally Posted by MrTimcakes View Post
Thanks it worked. Im just trying to find out if i can use a Cfg with the commands in for the commands and seeing if i can do the same to the steam id for multiple users.

Thanks, Ducky
Do you really need to read from a config file for a few commands? I think what MasterOfTheXP posted would be perfectly fine for the small amount of commands you wanted to run. Hell you can easily keep adding commands to it:

Code:
    {
        FakeClientCommand(client, "sm_fov @me 120");
        FakeClientCommand(client, "sm_noselfdamage");
        FakeClientCommand(client, "sm_getwreckedkid");
        FakeClientCommand(client, "sm_imaterribleadminthatneedssecretadvantages");
    }

Last edited by xomp; 06-04-2012 at 17:19.
xomp is offline
Send a message via Skype™ to xomp
MrTimcakes
Senior Member
Join Date: Jan 2012
Location: Uk
Old 06-04-2012 , 17:40   Re: [Tf2] Commands on player join
Reply With Quote #7

Quote:
Originally Posted by xomp View Post
Do you really need to read from a config file for a few commands? I think what MasterOfTheXP posted would be perfectly fine for the small amount of commands you wanted to run. Hell you can easily keep adding commands to it:

Code:
    {
        FakeClientCommand(client, "sm_fov @me 120");
        FakeClientCommand(client, "sm_noselfdamage");
        FakeClientCommand(client, "sm_getwreckedkid");
        FakeClientCommand(client, "sm_imaterribleadminthatneedssecretadvantages");
    }
xomp i just wanted a config so i didnt have to compile the plugin and restart everytime to add new commands and users.
and as for the
Code:

        FakeClientCommand(client, "sm_imaterribleadminthatneedssecretadvantages");
the Fov is to change the Field of view and every player can do it and the no self damage is for rocket jumping and everyone can also do that it was just for convenience so i dint have to type them all the time

Edit: oh yeah the code is perfect i didnt say it was bad.
__________________

Last edited by MrTimcakes; 06-04-2012 at 17:42.
MrTimcakes is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 06-04-2012 , 20:07   Re: [Tf2] Commands on player join
Reply With Quote #8

If its for every one why not just make it execute on everyone via plugin itself?
Mitchell is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 06-04-2012 , 20:14   Re: [Tf2] Commands on player join
Reply With Quote #9

Quote:
Originally Posted by Mitchell View Post
If its for every one why not just make it execute on everyone via plugin itself?
He means that the commands are available to everyone, but he wants his personal preferences to be executed when he joins.
__________________
Dr. McKay is offline
xomp
BANNED
Join Date: Jul 2008
Old 06-05-2012 , 07:04   Re: [Tf2] Commands on player join
Reply With Quote #10

Quote:
Originally Posted by MrTimcakes View Post
the Fov is to change the Field of view and every player can do it and the no self damage is for rocket jumping and everyone can also do that it was just for convenience so i dint have to type them all the time
Sorry to draw that conclusion of you since you had never implied the commands were public to everyone until now.
xomp is offline
Send a message via Skype™ to xomp
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 07:13.


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