View Single Post
Author Message
ApoziX
Member
Join Date: Sep 2018
Old 09-22-2018 , 08:33   [REQ] Is it possible to set flags to this?
Reply With Quote #1

Is it possible to set it to work only on flag "T""

PHP Code:
#include <sourcemod>
#include <tf2>
#define PLUGIN_VERSION "1.4"

new bool:ToggleTags true;
public 
Plugin:myinfo 
{
    
name "Instant Respawn",
    
author "ChauffeR",
    
version PLUGIN_VERSION,
    
url "http://hop.tf"
}

public 
OnPluginStart()
{
    
CreateConVar("sm_tf2_instantrespawn"PLUGIN_VERSION"Plugin Version of [TF2] Instant Respawn"FCVAR_PLUGIN FCVAR_SPONLY FCVAR_NOTIFY FCVAR_REPLICATED FCVAR_DONTRECORD);
    
HookEvent("player_death"OnPlayerDeath);
    
    if(
TagsContain("norespawntime"))
    {
        
ToggleTags false;
    }
    
TagsCheck("norespawntime");
}

public 
OnPluginEnd()
{
    if(
ToggleTags == true)
    {
        
TagsCheck("norespawntime"true);
    }
}

public 
Action:OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
RequestFrame(RespawnGetClientSerial(client));
}

public 
Respawn(any:serial)
{
    new 
client GetClientFromSerial(serial);
    if(
client != 0)
    {
        new 
team GetClientTeam(client);
        if(!
IsPlayerAlive(client) && team != 1)
        {
            
TF2_RespawnPlayer(client);
        }
    }
}

public 
bool:TagsContain(const String:tag[])
{
    new 
Handle:hTags FindConVar("sv_tags");
    
decl String:tags[255];
    
GetConVarString(hTagstagssizeof(tags));
    if(
StrContains(tagstag) > -1)
    {
        return 
true;
    }
    else
    {
        return 
false;
    }
}

/*
Stock from WoZeR's code
*/

stock TagsCheck(const String:tag[], bool:remove false)
{
    new 
Handle:hTags FindConVar("sv_tags");
    
decl String:tags[255];
    
GetConVarString(hTagstagssizeof(tags));

    if (
StrContains(tagstagfalse) == -&& !remove)
    {
        
decl String:newTags[255];
        
Format(newTagssizeof(newTags), "%s,%s"tagstag);
        
ReplaceString(newTagssizeof(newTags), ",,"","false);
        
SetConVarString(hTagsnewTags);
        
GetConVarString(hTagstagssizeof(tags));
    }
    else if (
StrContains(tagstagfalse) > -&& remove)
    {
        
ReplaceString(tagssizeof(tags), tag""false);
        
ReplaceString(tagssizeof(tags), ",,"","false);
        
SetConVarString(hTagstags);
    }

Thanks For Helpers +rep!!
__________________
Looking To Start A TF2 Community
My Discord | My Steam
ApoziX is offline