Code:
.sma(379) : warning 217: loose indentation
.sma(382) : warning 217: loose indentation
.sma(521) : warning 203: symbol is never used: "g_cvarForcedDuration"
.sma(521) : warning 203: symbol is never used: "g_cvarImmunityMode"
.sma(521) : warning 203: symbol is never used: "g_cvarMaximumDuration"
.sma(521) : warning 203: symbol is never used: "g_cvarTimeout"
Code:
#define LoopIngameClients(%1) for(new %1=1;%1<=get_maxplayers();++%1)\
if(is_user_connected(%1))
#define LoopIngamePlayers(%1) for(new %1=1;%1<=get_maxplayers();++%1)\
if(is_user_connected(%1) && !is_user_bot(%1))
We've had this discussion so many times. get_players() is common sense.
Code:
new g_cvarUserID = -1;
new g_cvarImmunityFlag = -1;
new g_cvarImmunityMode = -1;
new g_cvarTimeout = -1;
new g_cvarForcedDuration = -1;
new g_cvarMaximumDuration = -1;
new g_cvarCooldown = -1;
new g_cvarConnectionAds = -1;
new g_cvarDeathAds = -1;
new g_cvarRoundAds = -1;
new g_cvarShowOriginal = -1;
The most idiotic thing about this is that the values are never checked. So why bother?
Code:
format(STRING(m_szFile), "%s/amx_motdgd.cfg", m_szFile);
I might seem picky but I can't ever justify the usage of the function format(). In my view, that function is deprecated.
Code:
server_print("CFG location: %s", m_szFile);
It's obviously for debugging since it doesn't have a tag or prefix.
Code:
if(!cvar_exists("ip") || !cvar_exists("port"))
set_fail_state("Failed to determine server ip and port.");
get_cvar_string("ip", STRING(g_szServerIP));
"ip" is "localhost" in my case.
You have several ways of communicating with a WAN-server in your code. Why not look up the IP instead?
Code:
//EasyUpdate(ADPLUGIN_UPDATE_URL);
URL down, that's a shame. I don't think that's the reason for disabling it though.
It will be downloaded in it's current state meaning people downloading now won't have the autoupdate function until downloaded manually again. Shouldn't that be prioritized?
Code:
public plugin_cfg_post(id)
{
new m_szMotdURL[256];
get_pcvar_string(g_cvarUserID, STRING(m_szMotdURL));
if(m_szMotdURL[0] == 0)
set_fail_state("Your user ID is not set. Please visit <a href="http://www.motd.gd/" target="_blank" rel="nofollow noopener">http://www.motd.gd/</a> for more info.");
}
I see you're trying to reuse an already created string. This is not how it works unfortunately. You just created 256 cells for a string that will contain around 7-10 characters at most.
Code:
amx_motdgd_ads_on_round_end - If set to 1 then show ads on round end
Code:
g_cvarRoundAds = register_cvar("amx_motdgd_ads_on_round_end", "1");
public Event_RoundStart()
{
if(get_pcvar_num(g_cvarRoundAds) != 1)
return;
public Event_RoundEnd()
{
if(get_pcvar_num(g_cvarRoundAds) != 2)
return;
Nowhere is round start mentioned. You also cannot enable both, if that would be requested.
Code:
new parameters[1];
parameters[0] = get_user_userid(client);
set_task(1.0, "Timer_PlayerDeath", 0, parameters, 1);
// ...
new client = get_user_of_userid(params[0]);
I guess this is fine but I would defenitely send the id of the player as well as the userid. Then you only have to check if the userid passed is the same as the userid of the player passed. No loop required. This goes for all tasks.
Code:
set_task(0.0, "Timer_DelayedSendMotd", 0, parameters, 1);
Code:
new m_szSteamID[32] = "STEAM_1:0:0"; // May be uninitialized yet...
get_user_authid(client, STRING(m_szSteamID));
What?
Code:
format(STRING(m_szMotdURL), "http://motdgd.com/motd/?user=%d&ip=%s&pt=%d&v=%s&st=%s&gm=%s", get_pcvar_num(g_cvarUserID), g_szServerIP, g_iServerPort, PLUGIN_VERSION, m_szSteamID, g_szModName);
format() again.