|
Senior Member
|

04-29-2011
, 11:31
Re: Help for sub menu
|
#6
|
I look again carefully, finally, I found out that I forgot to put menu_destroy.
But now I get another problem.
I want to use color print out the message, but is cannot show the color.
Code:
new szSayText
public plugin_init()
{
//...
szSayText = get_user_msgid("SayText")
}
public actionBanMenu(id, key)
{
switch (key)
{
case 7:
{
/* BEGIN OF CHANGES BY MISTAGEE ADDED A FEW MORE OPTIONS */
++g_menuOption[id]
g_menuOption[id] %= ArraySize(g_bantimes);
g_menuSettings[id] = ArrayGetCell(g_bantimes, g_menuOption[id]);
displayBanMenu(id, g_menuPosition[id])
}
case 8: displayBanMenu(id, ++g_menuPosition[id])
case 9: displayBanMenu(id, --g_menuPosition[id])
default:
{
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
new name[32], name2[32], authid[32], authid2[32]
get_user_name(player, name2, 31)
get_user_authid(id, authid, 31)
get_user_authid(player, authid2, 31)
get_user_name(id, name, 31)
new userid2 = get_user_userid(player)
if (g_menuSettings[id]==0) // permanent
{
client_printc(id, "[BAN] ADMIN ^x03%s ^x01ban ^x03%s ^x04permanently.", name, name2)
}
else
{
new tempTime[32];
formatex(tempTime,sizeof(tempTime)-1,"%d",g_menuSettings[id]);
client_printc(id, "[BAN] ADMIN ^x03%s ^x01ban ^x03%s for ^x04%d Mins.", name, name2, tempTime)
}
/* ---------- check for Steam ID added by MistaGee --------------------
IF AUTHID == 4294967295 OR VALVE_ID_LAN OR HLTV, BAN PER IP TO NOT BAN EVERYONE */
if (equal("4294967295", authid2)
|| equal("HLTV", authid2)
|| equal("STEAM_ID_LAN", authid2)
|| equali("VALVE_ID_LAN", authid2))
{
/* END OF MODIFICATIONS BY MISTAGEE */
new ipa[32]
get_user_ip(player, ipa, 31, 1)
server_cmd("addip %d %s;writeip", g_menuSettings[id], ipa)
}
else
{
server_cmd("banid %d #%d kick;writeid", g_menuSettings[id], userid2)
}
server_exec()
displayBanMenu(id, g_menuPosition[id])
}
}
return PLUGIN_HANDLED
}
stock client_printc(const id, const string[], {Float, Sql, Resul,_}:...)
{
new msg[512], players[32], count = 1;
vformat(msg, sizeof msg - 1, string, 3);
replace_all(msg,511,"\g","^4");
replace_all(msg,511,"\y","^1");
replace_all(msg,511,"\t","^3");
if(id)
players[0] = id;
else
get_players(players,count,"ch");
new index;
for (new i = 0 ; i < count ; i++)
{
index = players[i];
message_begin(MSG_ONE_UNRELIABLE, szSayText,_, index);
write_byte(index);
write_string(msg);
message_end();
}
}
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others
|
|