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

If Client is BOT


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ApoziX
Member
Join Date: Sep 2018
Old 11-30-2019 , 12:49   If Client is BOT
Reply With Quote #1

Hello I want this code to apply also on bots

+ rep for helpers

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 "" 


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 != && CheckCommandAccess(client"sm_tag"ADMFLAG_CUSTOM6))
        { 
            
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); 
    } 

__________________
Looking To Start A TF2 Community
My Discord | My Steam

Last edited by ApoziX; 11-30-2019 at 13:10.
ApoziX is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 11-30-2019 , 14:06   Re: If Client is BOT
Reply With Quote #2

This should work...

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

new bool:ToggleTags true
public 
Plugin:myinfo =  

    
name "Instant Respawn"
    
author "ChauffeR"
    
version PLUGIN_VERSION
    
url "" 


public 
OnPluginStart() 

    
CreateConVar("sm_tf2_instantrespawn"PLUGIN_VERSION"Plugin Version of [TF2] Instant Respawn"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 != && CheckCommandAccess(client"sm_tag"ADMFLAG_CUSTOM6))
        { 
            
TF2_RespawnPlayer(client); 
        }
        if(!
IsPlayerAlive(client) && team != && IsFakeClient(client))
        { 
            
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); 
    } 

Attached Files
File Type: sp Get Plugin or Get Source (fastrespawn.sp - 132 views - 2.3 KB)
PC Gamer 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 23:39.


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