AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   plugin to say a message in chat from a list every 10 minutes (CSGO) (https://forums.alliedmods.net/showthread.php?t=326411)

Chr_s_ 07-29-2020 20:21

plugin to say a message in chat from a list every 10 minutes (CSGO)
 
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...

OciXCrom 07-30-2020 07:11

Re: plugin to say a message in chat from a list every 10 minutes (CSGO)
 
This is the AMX Mod X section.
CS:GO uses SourceMod.

stephen473 08-21-2020 13:40

Re: plugin to say a message in chat from a list every 10 minutes (CSGO)
 
1 Attachment(s)
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);
    }
        




All times are GMT -4. The time now is 11:45.

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