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

Simple !command to print in chat


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shtspk
Junior Member
Join Date: Dec 2015
Old 05-27-2016 , 06:20   Simple !command to print in chat
Reply With Quote #1

Hi, i need a really simple plugin, something like write !steam and the server print on the chat the link of steam group.
shtspk is offline
sdz
Senior Member
Join Date: Feb 2012
Old 05-27-2016 , 08:22   Re: Simple !command to print in chat
Reply With Quote #2

Attached to this post for you, just edit some of the lines in PrintToChatAll (using the "Get Source" button) to what you want and run it on the Web Compiler
Attached Files
File Type: sp Get Plugin or Get Source (printgroup.sp - 615 views - 248 Bytes)

Last edited by sdz; 05-27-2016 at 08:24.
sdz is offline
shtspk
Junior Member
Join Date: Dec 2015
Old 06-04-2016 , 11:36   Re: Simple !command to print in chat
Reply With Quote #3

Quote:
Originally Posted by EasSidezz View Post
Attached to this post for you, just edit some of the lines in PrintToChatAll (using the "Get Source" button) to what you want and run it on the Web Compiler
Thank you so much!!!
shtspk is offline
BoosterGold
Member
Join Date: Nov 2016
Old 12-12-2016 , 02:18   Re: Simple !command to print in chat
Reply With Quote #4

Quote:
Originally Posted by EasSidezz View Post
Attached to this post for you, just edit some of the lines in PrintToChatAll (using the "Get Source" button) to what you want and run it on the Web Compiler
Hi EasSidezz, thanks for this.

I'm trying to take the next step and get it to print the line colored using colorvariables. I've tried this:

Code:
#include <sourcemod>
#include <colorvariables>
#include "advertisements/topcolors.sp"

public OnPluginStart()
{
	RegAdminCmd("booster_glhf", command_boosterglhf, ADMFLAG_GENERIC, "Print what you set");
}

public Action:command_boosterglhf(client, args)
{
	PrintToChatAll("{Yellow}Booster{blue}: GL HF!");
	return Plugin_Handled;
}
But the game always prints the {Yellow} and {blue} in plaintext rather than coloring the message. What did I forget?
BoosterGold is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 12-12-2016 , 04:06   Re: Simple !command to print in chat
Reply With Quote #5

use CPrintToChatAll
and I think it's {yellow} not {Yellow}
__________________
8guawong is offline
B3none
AlliedModders Donor
Join Date: Oct 2016
Location: United Kingdom
Old 12-13-2016 , 04:39   Re: Simple !command to print in chat
Reply With Quote #6

I could give you a link to a plugin someone helped me write which brings up a menu and can print things to chat depending on what a client chooses... I'm just about to get home so I can upload the text, if you add me we can go through and I'll edit it to say exactly what you want
__________________
B3none is offline
B3none
AlliedModders Donor
Join Date: Oct 2016
Location: United Kingdom
Old 12-13-2016 , 04:42   Re: Simple !command to print in chat
Reply With Quote #7

Quote:
Originally Posted by BoosterGold View Post
Hi EasSidezz, thanks for this.

I'm trying to take the next step and get it to print the line colored using colorvariables. I've tried this:

Code:
#include <sourcemod>
#include <colorvariables>
#include "advertisements/topcolors.sp"

public OnPluginStart()
{
    RegAdminCmd("booster_glhf", command_boosterglhf, ADMFLAG_GENERIC, "Print what you set");
}

public Action:command_boosterglhf(client, args)
{
    PrintToChatAll("{Yellow}Booster{blue}: GL HF!");
    return Plugin_Handled;
}
But the game always prints the {Yellow} and {blue} in plaintext rather than coloring the message. What did I forget?
Have you tried using Simple Chat Processor in the text rather than including

PHP Code:
#include "advertisements/topcolors.sp" 
I'm quite new to this but I thought you could only use #include to a .inc file :/ Can anyone explain this to me?
__________________
B3none is offline
Rainox
Junior Member
Join Date: Jun 2016
Old 12-13-2016 , 13:05   Re: Simple !command to print in chat
Reply With Quote #8

Quote:
Originally Posted by BoosterGold View Post
Code:
#include <sourcemod>
#include <colorvariables>
#include "advertisements/topcolors.sp"

public OnPluginStart()
{
    RegAdminCmd("booster_glhf", command_boosterglhf, ADMFLAG_GENERIC, "Print what you set");
}

public Action:command_boosterglhf(client, args)
{
    PrintToChatAll("{Yellow}Booster{blue}: GL HF!");
    return Plugin_Handled;
}
But the game always prints the {Yellow} and {blue} in plaintext rather than coloring the message. What did I forget?
Fixed version:
Code:
#include <sourcemod>
#include <multicolors>

public OnPluginStart()
{
    RegConsoleCmd("sm_steam", Command_Steam);
}

public Action Command_Steam(int client,int args)
{
    CPrintToChat(client, "{Yellow}URL{Blue}");
}
{Yellow} <- Just change on color, what you want.
Dont forget download multicolors.inc down
Attached Files
File Type: inc morecolors.inc (29.7 KB, 165 views)
__________________
Steam Profile - Steam Group

If you have some questions, join the group and write
Rainox is offline
BoosterGold
Member
Join Date: Nov 2016
Old 12-19-2016 , 13:12   Re: Simple !command to print in chat
Reply With Quote #9

Thanks everyone!

Next question! Whenever I want to change the message I have to recompile the whole plugin. How do I get the plugin to just read a text line from a .cfg file instead? Something like:

Code:
booster_glhf.smx

#include stuff

code
{
    some code
}

public Action:command_boosterglhf(client, args)
{
    CPrintToChatAll(<line1 from booster_glhf.cfg>);
    CPrintToChatAll(<line2 from booster_glhf.cfg>);
    return Plugin_Handled;
}
and

Code:
booster_glhf.cfg

line1 = "{Yellow}Booster{blue}: GL!"
line2 = "{Yellow}Booster{blue}: HF!"

Last edited by BoosterGold; 12-19-2016 at 13:13.
BoosterGold is offline
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 12-20-2016 , 16:16   Re: Simple !command to print in chat
Reply With Quote #10

PHP Code:
#include <sourcemod>

#pragma newdecls required

ConVar line1;
ConVar line2;

public 
void OnPluginStart()
{
    
line1 CreateConVar("sm_textofline1""some text");
    
line2 CreateConVar("sm_textofline2""some text");
    
    
RegAdminCmd("booster_glhf"commandADMFLAG_GENERIC);
    
    
AutoExecConfig(true);
}

public 
Action command(int clientint args)
{
    
char cv[128], cv2[128];
    
    
GetConVarString(line1cvsizeof(cv));
    
GetConVarString(line2cv2sizeof(cv2));
    
    
PrintToChatAll(cv);
    
PrintToChatAll(cv2);

Something like this, after first run this plugin you got a new filder in cfg/sourcemod with the plugin.nameofplugins.cfg and there you can change your lines.
__________________


Max-Play.pl - the best polish servers
CamerDisco 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 12:58.


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