Hey! I am currently trying to make something like a GAG plugin. But I was wondering how can I set two or more strings in one trie with the same key if it is possible. I'm talking about reason, time and date, and admin name of the gag. The code for now:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <colorchat>
#define PLUGIN "GAG"
#define VERSION "1.0"
#define AUTHOR "Flicker"
new const szPrefix[] = "[GAG]"
const ACCESS = ADMIN_BAN
new Trie:g_tGaggedPlayers
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_gag", "cmdGag", ACCESS, "<nick> <time> ^"reason^"")
register_concmd("amx_ungag", "cmdUnGag", ACCESS, "<nick>")
register_clcmd("say", "cmdSay")
register_clcmd("say_team", "cmdSay")
g_tGaggedPlayers = TrieCreate()
}
public cmdSay(id)
{
new szID[16]
get_user_ip(id, szID, charsmax(szID), 1)
new num
if(TrieGetCell(g_tGaggedPlayers, szID, num))
{
new szReason[32]
TrieGetString(g_tGaggedPlayers, szID, szReason, charsmax(szReason))
gChat(id, "You are gagged")
}
}
public cmdGag(id, level, cid)
{
if(!cmd_access(id, level, cid, 4))
return PLUGIN_HANDLED
new arg1[32], arg2[32], arg3[32]
read_argv(1, arg1, charsmax(arg1))
read_argv(2, arg2, charsmax(arg2))
read_argv(3, arg3, charsmax(arg3))
new target = cmd_target(id, arg1, 0)
new itime = str_to_num(arg2)
new szID[16]
get_user_authid(target, szID, charsmax(szID))
TrieSetCell(g_tGaggedPlayers, szID, 1)
TrieSetString(g_tGaggedPlayers, szID, arg3)
}
stock gChat(const id, const szMsg[], any:...)
{
new szText[192]
vformat(szText, charsmax(szText), szMsg, 3)
ColorChat(id, GREEN, "%s^1 %s", szPrefix, szText)
}
public plugin_end()
TrieDestroy(g_tGaggedPlayers)
There is TrieSetString - but I think that it is for only one string. So, how can I put the reason, the name of admin and the date and time. Thanks!
And maybe it will be better to use Array?
__________________