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

plugin to say a message in chat from a list every 10 minutes (CSGO)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Chr_s_
New Member
Join Date: Jul 2020
Old 07-29-2020 , 20:21   plugin to say a message in chat from a list every 10 minutes (CSGO)
Reply With Quote #1

I want it so that every 10 minutes, a message is output in chat that is picked from a list. So if the list were "1, 2, 3" then the plugin would pick the first item in the list and say it, then 10 minutes later pick the next thing in the list and say it, and so on. Basically chat would look like this if nobody else talked,

-----------------------
server: 1
server: 2
server: 3
server: 1
server: 2
server: 3
-----------------------
and so on...
Chr_s_ is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-30-2020 , 07:11   Re: plugin to say a message in chat from a list every 10 minutes (CSGO)
Reply With Quote #2

This is the AMX Mod X section.
CS:GO uses SourceMod.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
stephen473
Senior Member
Join Date: Jan 2017
Location: somewhere on earth
Old 08-21-2020 , 13:40   Re: plugin to say a message in chat from a list every 10 minutes (CSGO)
Reply With Quote #3

give a try:

PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "stephen473"
#define PLUGIN_VERSION "1.00"

#include <sourcemod>
#include <sdktools>

#pragma newdecls required

#define MESSAGETIME 10

char g_sMessageList[][] =  { 
    
"Message: 1",
    
"Message: 2",
    
"Message: 3"
};

ArrayList g_aMessages;

public 
Plugin myinfo 
{
    
name "Print Message",
    
author PLUGIN_AUTHOR,
    
description "Prints messages from list one by one every x minute",
    
version PLUGIN_VERSION,
    
url "https://steamcommunity.com/id/kHardy"
};

public 
void OnPluginStart()
{
    
g_aMessages = new ArrayList();
    
    
PushMessagesToArray();
}

public 
void OnMapStart()
{
    
CreateTimer(60.0 MESSAGETIMETimer_Message_TIMER_REPEAT TIMER_FLAG_NO_MAPCHANGE);
}

public 
void PushMessagesToArray()
{
    
g_aMessages.Clear();
    
    for (
int i 0<= sizeof(g_sMessageList); i++) { 
        
g_aMessages.PushString(g_sMessageList[i]);
    }
}

public 
Action Timer_Message(Handle timer)
{
    if (
g_aMessages.Length == 0) { 
        
PushMessagesToArray();
    }

    else { 
        
char buffer[128];
        
g_aMessages.GetString(0buffersizeof(buffer));    
        
g_aMessages.Erase(0);
        
        
PrintToChatAll(buffer);
    }
        

Attached Files
File Type: sp Get Plugin or Get Source (printmessage.sp - 207 views - 1.2 KB)
__________________
Also known as Hardy`.

Feel free to contact me if you have a private plugin request!

My Steam Profile | Discord: Hardy`#3792
stephen473 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 14:51.


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