Raised This Month: $ Target: $400
 0% 

Solved [CS:GO] Help my plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Heypio
Junior Member
Join Date: Nov 2017
Old 12-25-2020 , 18:30   [CS:GO] Help my plugin
Reply With Quote #1

I coded a plugin showing that players are using hooks. I want this message to be written to the ct team and server administrators console. How can I do that?

Note: I'm sorry for my bad english.

Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <sdkhooks>
#include <hgr>

bool godRound = false;

public OnPluginStart()
{
    HookEvent("round_end", Round_END);
}

public Action:OnClientSayCommand(client, const char[] command, const char[] sArgs) 
{
    if (StrEqual(sArgs, "!godct",true)) {
        godRound = true;
    }  
    else
    {
        godRound = false;
    }
}

public Action:HGR_OnClientHook(int client)
{
    for(int i = 1; i <= MaxClients; i++) 
	{
    	if(!godRound) {
            PrintToConsole(i, "%N player pressed the hook.", client);		
        }
    }
    return Plugin_Continue;	
}
public Action:Round_END(Event event, const char[] name, bool dontBroadcast)
{
    godRound = false;
}

Last edited by Heypio; 12-29-2020 at 13:35.
Heypio is offline
P4UL
AlliedModders Donor
Join Date: Apr 2017
Location: Netherlands
Old 12-26-2020 , 14:03   Re: [CS:GO] Help my plugin
Reply With Quote #2

For printing to server console you can use PrintToServer. If you mean print to the client console of administrators you will probably have to loop over all clients and check if they are administrator, and if they are use PrintToConsole.
For printing to team I would use an include file (I personally use ColorVariables for my prints.
Also, you are kind of mixing old and new syntax, your function definitions are old syntax but your variable definition are new syntax (this should not matter for the compiler but it is cleaner to keep it consistent).
P4UL is offline
StrikeR14
AlliedModders Donor
Join Date: Apr 2016
Location: Behind my PC
Old 12-26-2020 , 17:30   Re: [CS:GO] Help my plugin
Reply With Quote #3

Quote:
Originally Posted by Heypio View Post
message to be written to the ct team and server administrators
PHP Code:
for (int i 1<= MaxClientsi++)
{
    if (
IsClientInGame(i) && (GetClientTeam(i) == CS_TEAM_CT) || CheckCommandAccess(i""ADMFLAG_CHATtrue))
    {
        
PrintToConsole(i"%N player pressed the hook."client);    
    }

Change ADMFLAG_CHAT to whatever you want.
__________________
Currently taking TF2/CSGO paid private requests!

My Plugins | My Discord Account

Last edited by StrikeR14; 12-26-2020 at 17:34.
StrikeR14 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 04:45.


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