Quote:
Originally Posted by I am inevitable
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_SM, file, sizeof(file), "configs/SomeAds.cfg");
}
public void OnMapStart()
{
CreateTimer(10.0, Timer_DisplayAds, _, TIMER_REPEAT);
}
public Action Timer_DisplayAds(Handle timer, Handle 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", Ad, sizeof(Ad));
CPrintToChatAll(Ad);
}
delete kv;
}
|
Hey again! Seems that our work is not done yet!
When I try to compile it says (I tried even by copying and pasting the full code you sent):
Code:
if (!kv.JumpToKey(g_iAd)) -> Error 035: argument type mismatch (argument 2)
I already tried to if (!kv.JumpToKey(g_iAd, false)) but it does not work. By Sourcemod API, false means that it would not create a key with that name.
What's the fix?
Regards,
SpirT.
__________________