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

[CS:GO][REQ] If T use command CT will recieve a message CprintToChat.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Raw123
Junior Member
Join Date: Jul 2016
Old 08-25-2016 , 10:50   [CS:GO][REQ] If T use command CT will recieve a message CprintToChat.
Reply With Quote #1

Hello i am looking for command when Terrorist type command !shop then CT recieve a message with his name. CPrintToChat(client, "The (Terrorist) used !shop".

I will be very grateful !
Raw123 is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 08-25-2016 , 11:35   Re: [CS:GO][REQ] If T use command CT will recieve a message CprintToChat.
Reply With Quote #2

not tested
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <colors>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    
HookEvent("player_say"PlayerSay);
}

public 
void PlayerSay(Handle eventchar [] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));  //Get the dead clients id
    
    
char text[256];
    
GetEventString(event"text"textsizeof(text));
    if (
StrEqual(text"!shop") && (GetClientTeam(client) == CS_TEAM_T))
    {
        for(
int i 1<= MaxClientsi++) if (GetClientTeam(i) == CS_TEAM_CT)
            
CPrintToChat(i"The Terrorist %N used !shop"client);
    }

__________________
coding & free software
shanapu is offline
good_live
AlliedModders Donor
Join Date: Oct 2013
Old 08-25-2016 , 11:41   Re: [CS:GO][REQ] If T use command CT will recieve a message CprintToChat.
Reply With Quote #3

Quote:
Originally Posted by shanapu View Post
not tested
You could also use https://sm.alliedmods.net/new-api/co...ommandListener.

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

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    
AddCommandListener(Command_Shop"sm_shop")
}

public 
Action Command_Shop(int client, const char[] commandint argc)
{
    for(
int i 1<= MaxClientsi++) 
        if (
GetClientTeam(i) == CS_TEAM_CT)
            
CPrintToChat(i"The Terrorist %N used !shop"client);
    
    return 
Plugin_Continue;


Last edited by good_live; 08-25-2016 at 11:47.
good_live is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 08-25-2016 , 15:51   Re: [CS:GO][REQ] If T use command CT will recieve a message CprintToChat.
Reply With Quote #4

yeah I know it's not the best way. I just used a snippet from here. this was a just fast copy/paste against the boredom at work.
__________________
coding & free software
shanapu 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 15:49.


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