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

Solved SetEntityRenderMode none for all Ts


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AuricYoutube
Senior Member
Join Date: Aug 2016
Location: Here
Old 11-09-2019 , 06:52   SetEntityRenderMode none for all Ts
Reply With Quote #1

Can someone please make me a plugin that makes all Ts invisible on spawn with SetEntityRenderMode RENDER_NONE?

Simple request I know but I don't know how to code.

Last edited by AuricYoutube; 11-10-2019 at 06:51.
AuricYoutube is offline
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 11-09-2019 , 14:42   Re: SetEntityRenderMode none for all Ts
Reply With Quote #2

PHP Code:
#include <sourcemod>
#include <cstrike>

public void OnPluginStart()
{
    
HookEvent("player_spawn"Spawn);
}

public 
Action Spawn(Handle pEvent, const char[] sNamebool none)
{
    
int Client GetClientOfUserId(GetEventInt(pEvent"userid"));
    
    if(
GetClientTeam(Client) == CS_TEAM_T && IsValidClient(Client))
        
SetEntityRenderMode(ClientRENDER_NONE);
}

stock bool IsValidClient(int client)

    if (
client <= || client MaxClients || !IsClientConnected(client) || client 0)
    {
        return 
false
    }
    return 
IsClientInGame(client); 

Hf
hmu if you need anything else
__________________
kratoss1812 is offline
xerox8521
Senior Member
Join Date: Sep 2011
Old 11-09-2019 , 16:27   Re: SetEntityRenderMode none for all Ts
Reply With Quote #3

You should swap the IsValidClient and GetClientTeam checks otherwise you will get errors when there is an invalid client passed to GetClientTeam.
xerox8521 is offline
AuricYoutube
Senior Member
Join Date: Aug 2016
Location: Here
Old 11-10-2019 , 06:51   Re: SetEntityRenderMode none for all Ts
Reply With Quote #4

For anyone else who wants the code with the changes above.

Code:
#include <sourcemod>
#include <cstrike>

public void OnPluginStart()
{
    HookEvent("player_spawn", Spawn);
}

public Action Spawn(Handle pEvent, const char[] sName, bool none)
{
    int Client = GetClientOfUserId(GetEventInt(pEvent, "userid"));
    
    if(IsValidClient(Client) && GetClientTeam(Client) == CS_TEAM_T)
        SetEntityRenderMode(Client, RENDER_NONE);
}

stock bool IsValidClient(int client)
{ 
    if (client <= 0 || client > MaxClients || !IsClientConnected(client) || client < 0)
    {
        return false; 
    }
    return IsClientInGame(client); 
}
Thanks guys!
AuricYoutube 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 22:49.


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