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

Solved [CSGO] Can't compile with colors include


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
katex
Junior Member
Join Date: Jun 2019
Old 07-01-2019 , 13:28   [CSGO] Can't compile with colors include
Reply With Quote #1

Quote:
#include <sourcemod>
#include <sdktools>
#include <timers>
#include <colors>

#pragma newdecls required
#pragma semicolon 1

public Plugin myinfo =
{
name = "Auto Messages",
author = "KaTeX",
description = "Sending ",
version = "1.0",
url = "https://discord.gg/NuDrwdW"
};

public void OnPluginStart()
{
PrintToServer("Auto Message plugin activated.");
RegConsoleCmd("sm_discord", discord_cmd, "Shows discord link of the server.");

CreateTimer(1.0, Discord);

}

public Action discord_cmd(int client, int args)
{
ReplyToCommand(client, "[DnC] Do not forget join to our discord!");
return Plugin_Handled;
}

public Action Discord(Handle Timer)
{
CPrintToChat(client, "{green}[DnC] {default}Do not forget join to our discord!");
return Plugin_Handled;
}
Hello everybody,
I started to learn programming and someone can tell me why it is not giving me to compile with colors include? and How to do a timer that works always?

Tried to compile normally without colors and colors include and worked fine but the timer not.

Thanks in advance

Last edited by katex; 07-04-2019 at 16:04.
katex is offline
Nexd
BANNED
Join Date: Dec 2013
Location: Hungary
Old 07-01-2019 , 14:14   Re: [CSGO] Can't compile with colors include
Reply With Quote #2

PHP Code:
public Action Discord(Handle Timer)
{
    
CPrintToChatAll("{green}[DnC] {default}Do not forget join to our discord!");
    return 
Plugin_Handled;

Nexd is offline
katex
Junior Member
Join Date: Jun 2019
Old 07-01-2019 , 14:51   Re: [CSGO] Can't compile with colors include
Reply With Quote #3

Quote:
Originally Posted by Nexd View Post
PHP Code:
public Action Discord(Handle Timer)
{
    
CPrintToChatAll("{green}[DnC] {default}Do not forget join to our discord!");
    return 
Plugin_Handled;

Ok.. Nice thank you gonna check soon but can u tell me why it is not giving me to compile with include colors?
katex is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 07-01-2019 , 14:52   Re: [CSGO] Can't compile with colors include
Reply With Quote #4

Quote:
Originally Posted by katex View Post
Ok.. Nice thank you gonna check soon but can u tell me why it is not giving me to compile with include colors?
Whats the error message? Do you have the colors.inc in your scripting/include folder?


Edit: you're creating the timer to fire 1.0 seconds after the plugin starts, no one is likely to be on the server to see. You should create this timer using a round_start event or something, or better use OnClientPutInServer or player_spawn event and sending the message to the individual.

Or what about using the advertisements plugin which does it all for you.
__________________

Last edited by Silvers; 07-01-2019 at 14:55.
Silvers is offline
Nexd
BANNED
Join Date: Dec 2013
Location: Hungary
Old 07-01-2019 , 15:08   Re: [CSGO] Can't compile with colors include
Reply With Quote #5

It should give the same error without the colors include because you've tried it with PrintToChat what is print the message for the specified client instead of everyone(+in general, you can't pass client from OnPluginStart)

if you want to do this with PrintToChat (or CPrintToChat)
PHP Code:
public void OnClientPostAdminCheck(int client)
{
    
CreateTimer(1.0Discordclient);
}

public 
Action Discord(Handle timerint client)
{
    
CPrintToChat(client"{green}[DnC] {default}Do not forget join to our discord!");
    return 
Plugin_Handled;

or you can try it with a for statement

Last edited by Nexd; 07-01-2019 at 15:11.
Nexd is offline
katex
Junior Member
Join Date: Jun 2019
Old 07-01-2019 , 15:25   Re: [CSGO] Can't compile with colors include
Reply With Quote #6

Quote:
Originally Posted by Silvers View Post
Whats the error message? Do you have the colors.inc in your scripting/include folder?


Edit: you're creating the timer to fire 1.0 seconds after the plugin starts, no one is likely to be on the server to see. You should create this timer using a round_start event or something, or better use OnClientPutInServer or player_spawn event and sending the message to the individual.

Or what about using the advertisements plugin which does it all for you.
Seriously thank you, I want to learn and make plugins by myself
katex is offline
katex
Junior Member
Join Date: Jun 2019
Old 07-01-2019 , 15:35   Re: [CSGO] Can't compile with colors include
Reply With Quote #7

Quote:
Originally Posted by Nexd View Post
It should give the same error without the colors include because you've tried it with PrintToChat what is print the message for the specified client instead of everyone(+in general, you can't pass client from OnPluginStart)

if you want to do this with PrintToChat (or CPrintToChat)
PHP Code:
public void OnClientPostAdminCheck(int client)
{
    
CreateTimer(1.0Discordclient);
}

public 
Action Discord(Handle timerint client)
{
    
CPrintToChat(client"{green}[DnC] {default}Do not forget join to our discord!");
    return 
Plugin_Handled;

or you can try it with a for statement
Ok I'll try this.. However I tried something easier with the colors include and it is not giving me to compile


Yes I tried to compile in folder with include colors

Last edited by katex; 07-01-2019 at 15:39.
katex is offline
Nexd
BANNED
Join Date: Dec 2013
Location: Hungary
Old 07-01-2019 , 16:12   Re: [CSGO] Can't compile with colors include
Reply With Quote #8

have you even got the colors.inc?
Nexd is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 07-01-2019 , 16:17   Re: [CSGO] Can't compile with colors include
Reply With Quote #9

That means the "colors.inc" file is not in your scripting/include folder when compiling the plugin.
__________________
Silvers is offline
katex
Junior Member
Join Date: Jun 2019
Old 07-02-2019 , 07:22   Re: [CSGO] Can't compile with colors include
Reply With Quote #10

Quote:
Originally Posted by Nexd View Post
have you even got the colors.inc?
Yeap
katex 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 15:54.


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