View Single Post
I am inevitable
Member
Join Date: May 2019
Location: 0xA6DA34
Old 07-17-2019 , 13:32   Re: [KeyValues] All Messages sent in same moment
Reply With Quote #3

PHP Code:
#pragma semicolon 1

#define DEBUG

char file[512];

int g_iAd;

#define PLUGIN_AUTHOR "SpirT"
#define PLUGIN_VERSION "1.0"

#include <sourcemod>
#include <sdktools>
#include <colors>

#pragma newdecls required

public Plugin myinfo 
{
    
name "[Ads] SpirT",
    
author PLUGIN_AUTHOR,
    
description "",
    
version PLUGIN_VERSION,
    
url ""
};

public 
void GetKeyValuesFile()
{
    
BuildPath(Path_SMfilesizeof(file), "configs/SomeAds.cfg");
}

public 
void OnMapStart()
{
    
CreateTimer(10.0Timer_DisplayAds_TIMER_REPEAT);
}

public 
Action Timer_DisplayAds(Handle timerHandle hndl)
{
    
g_iAd++;
    
    
SendAds();
}

void SendAds()
{
    
KeyValues kv = new KeyValues("SomeAds");
    
    
kv.ImportFromFile(file);
    
    if (!
kv.JumpToKey(g_iAd))
        
g_iAd 0;
    
    else
    {
        
char Ad[256];
        
        
kv.GetString("message"Adsizeof(Ad));
        
        
CPrintToChatAll(Ad);
    }
    
    
delete kv;

__________________
I do make plugins upon requests, so hit me up on discord if you're interested: Stefan Milivojevic#5311

Last edited by I am inevitable; 07-17-2019 at 13:34.
I am inevitable is offline