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

[TF2] Give team godmode on spawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 06-06-2017 , 08:37   [TF2] Give team godmode on spawn
Reply With Quote #1

Hey, so I host an idle server and I would like a plugin where blue's are automatically given godmode and red's don't get god mode. This is because blue get's damaged from floor while trying to kill reds. Thanks!
ThatKidWhoGames is offline
WatchDogs
Senior Member
Join Date: Oct 2015
Location: Iran
Old 06-06-2017 , 09:07   Re: [TF2] Give team godmode on spawn
Reply With Quote #2

Here you are. Test it & tell me the result (if maybe didn't work I'll fix).

PHP Code:
#pragma semicolon 1

#define PLUGIN_AUTHOR "[W]atch [D]ogs"
#define PLUGIN_VERSION "1.0.1"

#include <sourcemod>

#pragma newdecls required

Handle b_Enable;

public 
Plugin myinfo 
{
    
name "[TF2] Auto Blues GodMode",
    
author PLUGIN_AUTHOR,
    
description "Gives godmode on blue team",
    
version PLUGIN_VERSION
};

public 
void OnPluginStart()
{
    
b_Enable CreateConVar("sm_abg_enable""1""Enable/Disable Godmode on blue team."_true0.0true1.0);
    
HookEvent("player_spawn"TF2_PlayerSpawn);
}

public 
Action TF2_PlayerSpawn(Handle event, const char[] namebool dontBroadcast)
{
    if(
GetEventInt(event"team") == && GetConVarBool(b_Enable))
    {
        
any client GetClientOfUserId(GetEventInt(event"userid"));
        if(
client != 0
        {
            
SetEntProp(clientProp_Data"m_takedamage"01);
        }
    }

EDIT: Updated | Fixed a bug.
Attached Files
File Type: sp Get Plugin or Get Source (BlueGod.sp - 256 views - 852 Bytes)

Last edited by WatchDogs; 06-06-2017 at 09:19.
WatchDogs is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 06-06-2017 , 09:24   Re: [TF2] Give team godmode on spawn
Reply With Quote #3

Quote:
Originally Posted by WatchDogs View Post
Here you are. Test it & tell me the result (if maybe didn't work I'll fix).

PHP Code:
#pragma semicolon 1

#define PLUGIN_AUTHOR "[W]atch [D]ogs"
#define PLUGIN_VERSION "1.0.1"

#include <sourcemod>

#pragma newdecls required

Handle b_Enable;

public 
Plugin myinfo 
{
    
name "[TF2] Auto Blues GodMode",
    
author PLUGIN_AUTHOR,
    
description "Gives godmode on blue team",
    
version PLUGIN_VERSION
};

public 
void OnPluginStart()
{
    
b_Enable CreateConVar("sm_abg_enable""1""Enable/Disable Godmode on blue team."_true0.0true1.0);
    
HookEvent("player_spawn"TF2_PlayerSpawn);
}

public 
Action TF2_PlayerSpawn(Handle event, const char[] namebool dontBroadcast)
{
    if(
GetEventInt(event"team") == && GetConVarBool(b_Enable))
    {
        
any client GetClientOfUserId(GetEventInt(event"userid"));
        if(
client != 0
        {
            
SetEntProp(clientProp_Data"m_takedamage"01);
        }
    }

EDIT: Updated | Fixed a bug.
Will test when I am home, thank you very much!!
ThatKidWhoGames is offline
WatchDogs
Senior Member
Join Date: Oct 2015
Location: Iran
Old 06-06-2017 , 09:33   Re: [TF2] Give team godmode on spawn
Reply With Quote #4

It's OK. You're welcome
WatchDogs is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 06-07-2017 , 07:59   Re: [TF2] Give team godmode on spawn
Reply With Quote #5

Quote:
Originally Posted by WatchDogs View Post
It's OK. You're welcome
Works like a charm once again, thank you very much! Take some bacon
ThatKidWhoGames 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 22:08.


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