AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [Any] Round Messages (https://forums.alliedmods.net/showthread.php?t=235023)

joac1144 02-07-2014 15:29

[Any] Round Messages
 
2 Attachment(s)
Description:
This is just a simple plugin that prints a message to all players every time a round starts or ends.


CVAR list:
eventmsg_startmessage "{lightgreen}The round is about to {green}start" //message to send when a round is about to start.
eventmsg_endmessage "{lightgreen}The round has {green}ended" //message to send when a round ends.
eventmsg_version //Plugin version.

In order to compile the plugin yourself, you need morecolors.inc
You can find all the available colors here.
If you don't want to use any colors, remove the color tags in the CFG file.

Command list:
No commands.


Changelog:
Quote:

2-7-2014 (v1.0)

*Plugin released

2-8-2014 (v1.1)

*Morecolors isn't required
Installation:
Click 'Get Plugin', download the .smx file and put it into sourcemod/plugins/ folder.


-This is my third plugin ever-

ClassicGuzzi 02-08-2014 02:04

Re: [Any] Round Messages
 
i don't see the plugin :/

joac1144 02-08-2014 05:27

Re: [Any] Round Messages
 
Quote:

Originally Posted by ClassicGuzzi (Post 2097111)
i don't see the plugin :/

I forgot to attach the file..
Thanks for reminding me :)

joac1144 02-08-2014 08:34

Re: [Any] Round Messages
 
Plugin updated.
Morecolors is now optional and not required.

ClassicGuzzi 02-08-2014 11:15

Re: [Any] Round Messages
 
Quote:

Originally Posted by joac1144 (Post 2097245)
Plugin updated.
Morecolors is now optional and not required.

This isn't important, CPrintToChatAll and PrintToChatAll are the same if i don't use color tags like {yellow}. So, if don't want colors, i wont use color tags.

Things you could add:
  • A version variable (if you are going to add more stuff)
  • Hint message and Center message
  • File with multiple phases that are piked randomly

Just some ideas :P

joac1144 02-08-2014 13:33

Re: [Any] Round Messages
 
Quote:

Originally Posted by ClassicGuzzi (Post 2097318)

Things you could add:
  • A version variable (if you are going to add more stuff)

Added.


Quote:

Originally Posted by ClassicGuzzi
Hint message and Center message

Do you mean that it should print the message as a Center/Hint message or that you can choose how it should print the message from the CFG file?


Quote:

Originally Posted by ClassicGuzzi
File with multiple phases that are piked randomly

I have no idea how to do this.


Thanks for feedback

Mr.Freeman 02-08-2014 13:41

Re: [Any] Round Messages
 
You can use PrintHintText for hint text and use a random interval for what ClassicGuzzi requested

Js41637 02-08-2014 20:02

Re: [Any] Round Messages
 
You can't compile the plugin because it requires morecolors.

I think you can use #tryinclude or something instead of #include so that it isn't required but optional.

Also, is there even any color tags in the code? You have;
PHP Code:

if (GetConVarInt(eventmsg_morecolors_enabled) == 1)
    {
        new 
String:msg[128];
        
GetConVarString(eventmsg_endmessagemsgsizeof(msg));
    
        
CPrintToChatAll("%s"msg);
    }
    else
    {
        new 
String:msg[128];
        
GetConVarString(eventmsg_endmessagemsgsizeof(msg));
        
        
PrintToChatAll("%s"msg);
    } 

Which is just switching between PrintToChatAll and CPrintToChatAll however you have included no color tags. Something like this is maybe what you want?
PHP Code:

CPrintToChatAll("{green}%s"msg); 


joac1144 02-09-2014 04:25

Re: [Any] Round Messages
 
Quote:

Originally Posted by Js41637 (Post 2097635)
You can't compile the plugin because it requires morecolors.

I think you can use #tryinclude or something instead of #include so that it isn't required but optional.

Also, is there even any color tags in the code? You have;
PHP Code:

if (GetConVarInt(eventmsg_morecolors_enabled) == 1)
    {
        new 
String:msg[128];
        
GetConVarString(eventmsg_endmessagemsgsizeof(msg));
    
        
CPrintToChatAll("%s"msg);
    }
    else
    {
        new 
String:msg[128];
        
GetConVarString(eventmsg_endmessagemsgsizeof(msg));
        
        
PrintToChatAll("%s"msg);
    } 

Which is just switching between PrintToChatAll and CPrintToChatAll however you have included no color tags. Something like this is maybe what you want?
PHP Code:

CPrintToChatAll("{green}%s"msg); 


If you want to use colors in the messages, you can do it in the CFG file (cfg/sourcemod/) that is autogenerated after first time the plugin is loaded.
Eg: eventmsg_startmessage "{lightgreen}The round is about to {green}start"

ddhoward 02-09-2014 04:35

Re: [Any] Round Messages
 
You cannot make morecolors optional like that. Even with the cvar to use/not use it, there are still morecolors functions in your code. The compiler will refuse to compile the plugin if morecolors.inc is not present in the includes folder.

Further, an option to use PrintToChatAll vs CPrintToChatAll is made even more pointless when you realize that the server does not need morecolors.inc to run the plugin. Include files like that are only needed by THE COMPILER. Once it's compiled, the include is done. Any server with a reasonably up-to-date version of Sourcemod can run that smx without needing anything extra.

I recommend that you remove the cvar, and always use CPrintToChatAll.


All times are GMT -4. The time now is 14:58.

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