Greetings everybody,
I honestly don't know where to post this, since there aren't any sections for this type of questions. Also, I've searched about this and couldn't find an answer.
This is a very... uhh.. basic question that you all may find absolutely hilarious, but:
Before I started coding on my own I decided to learn from existing plugins, and started with a basic one, antiflood.amxx, which is included in AMXX already.
Here's the code:
PHP Code:
new Float:g_Flooding[33] = {0.0, ...}
new g_Flood[33] = {0, ...}
new amx_flood_time;
public plugin_init()
{
register_plugin("Anti Flood", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("antiflood.txt")
register_clcmd("say", "chkFlood")
register_clcmd("say_team", "chkFlood")
amx_flood_time=register_cvar("amx_flood_time", "0.75")
}
public chkFlood(id)
{
new Float:maxChat = get_pcvar_float(amx_flood_time)
if (maxChat)
{
new Float:nexTime = get_gametime()
if (g_Flooding[id] > nexTime)
{
if (g_Flood[id] >= 3)
{
client_print(id, print_notify, "** %L **", id, "STOP_FLOOD")
g_Flooding[id] = nexTime + maxChat + 3.0
return PLUGIN_HANDLED
}
g_Flood[id]++
}
else if (g_Flood[id])
{
g_Flood[id]--
}
g_Flooding[id] = nexTime + maxChat
}
return PLUGIN_CONTINUE
}
I came across this:
PHP Code:
if (maxChat)
{
new Float:nexTime = get_gametime()
if (g_Flooding[id] > nexTime)
{
if (g_Flood[id] >= 3)
{
client_print(id, print_notify, "** %L **", id, "STOP_FLOOD")
g_Flooding[id] = nexTime + maxChat + 3.0
return PLUGIN_HANDLED
}
g_Flood[id]++
And I'm just struggling to understand how "id" (which I believe is the player index) fits into this and how this all works. It just doesn't make sense to me and I've had previous experience with programming. The whole sequence just seems illogical.
Uhh... Don't make fun of me
I've gone through the tutorials and have an understanding of pretty much everything they covered.
Cheers