Quote:
Originally Posted by fysiks
Can you translate this to English?
|
It means a temporary solution to answer my question
Anyway, this is what I wrote with the help of it
PHP Code:
#include <amxmodx>
new bool:Colortype;
new iRed, iGreen, iBlue;
enum _:Colors
{
Name[32],
Red,
Green,
Blue,
Info[3]
}
new const g_Colors[][Colors] =
{
{ "Red", 255, 0, 0, "0" },
{ "Green", 0, 255, 0, "1" },
{ "Blue", 0, 0, 255, "2" },
{ "Random", 0, 0, 0, "*" }
}
public plugin_init()
{
register_clcmd("say /test", "hudMenu")
set_task(1.0, "Test", .flags = "b")
}
public Test()
{
set_hudmessage(Colortype ? random(255) : iRed, Colortype ? random(255) : iGreen, Colortype ? random(255) : iBlue, 0.5, 0.5, 0, 0.1, 0.1, 0.5, 0.15,4)
show_hudmessage(0,"Test")
}
public hudMenu(id)
{
new iMenu = menu_create("Hud Menu", "hudHandler")
for(new i; i < sizeof(g_Colors); i++)
menu_additem(iMenu, g_Colors[i][Name], g_Colors[i][Info])
menu_display(id, iMenu, 0)
return PLUGIN_HANDLED
}
public hudHandler(id, iMenu, iItem){
if(iItem == MENU_EXIT)
{
menu_destroy(iMenu);
return PLUGIN_HANDLED;
}
static iAccess, szInfo[2], hCallback;
menu_item_getinfo(iMenu, iItem, iAccess, szInfo, 1, _, _, hCallback);
if(szInfo[0] == '*')
{
Colortype =! Colortype;
}
else
{
iRed = g_Colors[iItem][Red];
iGreen = g_Colors[iItem][Green];
iBlue = g_Colors[iItem][Blue];
}
hudMenu(id)
return PLUGIN_HANDLED
}
__________________