Raised This Month: $51 Target: $400
 12% 

[REQ] Create menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XMaDNeSS
Member
Join Date: Oct 2016
Location: Palestine, Nablus.
Old 11-23-2016 , 15:43   [REQ] Create menu
Reply With Quote #1

Hello everyone. i want easy plugin...i want only create glow should be have access "e" for open it. and menu is open with say /glow
Containing.
1.yellow
2.Blue
3.Red
4.Green

when choose one, call comment (amx_glow "Name (myself)" "color")
THX ALL.
__________________
http://zombieonzone.com ForEver
Free Palestine.
[ZoZ].:Zombie Plague:.1000FPS FastDL NonSteam
91.134.234.190:27015
XMaDNeSS is offline
XMaDNeSS
Member
Join Date: Oct 2016
Location: Palestine, Nablus.
Old 11-23-2016 , 16:17   Re: [REQ] Create menu
Reply With Quote #2

This all what i can make please help me complete it
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

#define ACCESSFLAG_MAX_LENGTH 2
// Access flags
new g_access_glow[ACCESSFLAG_MAX_LENGTH] = "e"

enum
{
    
ACTION_MENU_glow
}
    const 
KEYSMENU MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0

public plugin_init()
{
    
register_plugin("[AMXX] glow menu""0.0.1""MaDNeSS")
    
register_menu(".:[AMXX]:. Glow Menu"KEYSMENU"menu_glow")
    
register_clcmd("say /glow""clcmd_adminmenu")
{
    
    public 
clcmd_glowmenu(id)
{
    
show_menu_glow(id)
}
// Glow Menu
show_menu_glow(id)
{
    static 
menu[250]
    new 
lenuserflags get_user_flags(id)
    
    
// Title
    
len += formatex(menu[len], charsmax(menu) - len"\y[AMXX] Glow menu:^n^n")
        
// 1. Yellow command
    
if (userflags read_flags(g_access_glow))
        
len += formatex(menu[len], charsmax(menu) - len"\r1. Yellow^n")
        
// 2. Blue
    
if (userflags read_flags(g_access_glow))
        
len += formatex(menu[len], charsmax(menu) - len"\r1. Blue^n")
        
// 3. Red
    
if (userflags read_flags(g_access_glow))
        
len += formatex(menu[len], charsmax(menu) - len"\r1. Red^n")
        
// 4. Green
    
if (userflags read_flags(g_access_glow))
        
len += formatex(menu[len], charsmax(menu) - len"\r1. Green^n")
        { 
__________________
http://zombieonzone.com ForEver
Free Palestine.
[ZoZ].:Zombie Plague:.1000FPS FastDL NonSteam
91.134.234.190:27015

Last edited by XMaDNeSS; 11-23-2016 at 16:26.
XMaDNeSS is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 11-23-2016 , 16:57   Re: [REQ] Create menu
Reply With Quote #3

Sorry, this is all i can do at the moment, you will have to wait for some one to come and add admin access for the menu and the set rendering native
PHP Code:

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /glow""handle_command_glow")
    
    
// Add your code here...
}

public 
handle_command_glow(id)
{
    
menu_glow_show(id)
}

public 
menu_glow_show(id)
{
    new 
menu menu_create("Glow Menu""menu_glow_handle")
    
    
menu_additem(menu"Red Glow"""0)
    
menu_additem(menu"Green Glow"""0)
    
menu_additem(menu"Blue Glow"""0)
    
menu_additem(menu"Yellow Glow"""0)
    
menu_additem(menu"Remove Glow"""0)
    
    
menu_display(idmenu0)
    
}

public 
menu_glow_handle(idmenukey)
{
    switch(
key)
    {
        
// Red
        
case 0:
        {
            
        }
        
// Green
        
case 1:
        {
            
        }
        
// Blue
        
case 2:
        {
            
        }
        
// Yellow
        
case 3:
        {
            
        }
        
// Remove
        
case 4:
        {
            
        }
    }
    
menu_destroy(menu)

__________________

Last edited by Depresie; 11-23-2016 at 16:58.
Depresie is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 11-23-2016 , 17:28   Re: [REQ] Create menu
Reply With Quote #4

PHP Code:
public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /glow""handle_command_glow")
    
    
// Add your code here...
}

public 
handle_command_glow(id)
{
    
menu_glow_show(id)
}

public 
menu_glow_show(id)
{
    new 
menu menu_create("Glow Menu""menu_glow_handle")
    
    
menu_additem(menu"Red Glow"""0)
    
menu_additem(menu"Green Glow"""0)
    
menu_additem(menu"Blue Glow"""0)
    
menu_additem(menu"Yellow Glow"""0)
    
menu_additem(menu"Remove Glow"""0)
    
    
menu_display(idmenu0)
    
}

public 
menu_glow_handle(idmenukey)
{
    switch(
key)
    {
        
// Red
        
case 0:
        {
        
set_user_rendering(idkRenderFxGlowShell2550,  0kRenderNormal35
            
        }
        
// Green
        
case 1:
        {
        
set_user_rendering(idkRenderFxGlowShell0255,  0kRenderNormal35)             
        }
        
// Blue
        
case 2:
        {
        
set_user_rendering(idkRenderFxGlowShell00,  255kRenderNormal35)             
        }
        
// Yellow
        
case 3:
        {
        
set_user_rendering(idkRenderFxGlowShell255255,  0kRenderNormal35)             
        }
        
// Remove
        
case 4:
        {
        
set_user_rendering(id))             
        }
    }
return 
0

__________________

Last edited by edon1337; 11-23-2016 at 17:29.
edon1337 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-23-2016 , 18:21   Re: [REQ] Create menu
Reply With Quote #5

1. handle_command_glow is not needed.
2. You should return PLUGIN_HANDLED in both functions.
3. The menu needs to be destroyed after usage.
4. You have an extra bracket in the last case.

This can be made much better:

PHP Code:
#include <amxmodx>
#include <fun>

enum _:Colors
{
    
Name[16],
    
Red,
    
Green,
    
Blue,
    
Alpha
}

new const 
g_eColors[Colors] =
{
    { 
"Red"2550040 },
    { 
"Green"0255040 },
    { 
"Blue"0025540 },
    { 
"Turn Off"000255 }
}

public 
plugin_init()
{
    
register_plugin("Personal Glow Menu""1.0""OciXCrom")
    
register_clcmd("say /glow""GlowMenu")
    
register_clcmd("say_team /glow""GlowMenu")
}

public 
GlowMenu(id)
{
    if(!
HasAccess(id))
        
client_print(idprint_chat"* You have no access to this command.")
    else
    {
        new 
iMenu menu_create("Glow Menu""GlowHandler")

        for(new 
isizeof(g_eColors); i++)
            
menu_additem(iMenug_eColors[i][Name]

        
menu_display(idiMenu0)
    }

    return 
PLUGIN_HANDLED
}

public 
GlowHandler(idiMenuiItem)
{
    if(
iItem != MENU_EXIT && HasAccess(id))
    {
        
set_user_rendering(idkRenderFxGlowShellg_eColors[iItem][Red], g_eColors[iItem][Green],
g_eColors[iItem][Blue], kRenderNormalg_eColors[iItem][Alpha])

        
client_print(idprint_chat"* Selected Glow: %s"g_eColors[iItem][Name])
        
menu_destroy(iMenu)
    }

    return 
PLUGIN_HANDLED
}

bool:HasAccess(id)
    return 
get_user_flags(id) & ADMIN_SLAY true false 
__________________

Last edited by OciXCrom; 11-23-2016 at 18:46.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 11-23-2016 , 18:26   Re: [REQ] Create menu
Reply With Quote #6

https://forums.alliedmods.net/showthread.php?t=170660
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Old 11-23-2016, 18:47
Napoleon_be
This message has been deleted by Napoleon_be.
Depresie
Veteran Member
Join Date: Nov 2013
Old 11-24-2016 , 09:51   Re: [REQ] Create menu
Reply With Quote #7

I preffer to create a function to handle the command ( check for admin flags ) and from there send the menu, it's cleaner, especially when im working on larger plugins and i like to sort the functions
__________________

Last edited by Depresie; 11-24-2016 at 09:52.
Depresie is offline
XMaDNeSS
Member
Join Date: Oct 2016
Location: Palestine, Nablus.
Old 11-26-2016 , 10:25   Re: [REQ] Create menu
Reply With Quote #8

i want make menu for this glow please...and i wanna to block comment amx_glow...

PHP Code:
/* Admin glow 
About
This plugin allows admins to make other players glow in a spesfic color, the supported colors are: red,purple,green,yellow & blue. This plugin logs & echos admin actions, it does NOT allow 
admins to enter the RGB value of th color they want ( To stop usage of "cheat" colors that make ppl hard to spot). This plugin also support having players go say /glow <color> to make themself glow in 
any of the defined colors. 

Usage: 
amx_glow <name or #userid> <color> 
amx_unglow <name or #userid> 

say /glow <color> 

Modules required: 
fun 

FAQ) 
Q) How do i enable public glow? 
A) Check in the define section- 

Q) Can i disable the public glow on the server in runtime? 
A) Yes, change the amx_publicglow cvar. 

Plugin forum thread: http://www.amxmodx.org/forums/viewtopic.php?t=1531 

Credits: 
OP`s in #amxmod @ Quakenet, for helping me alot with my endless questions. 

Changelog: 
   1.3.3 ( 3.11.2004 ) 
    - Fixed: Fixed possible issue with index out of bounds 
    - Added: Making players glow engine module instead of fun module ( change WhatModule define, fun module is standard) 
     
   1.3.2 ( 06.07.2004 ) 
    - Fixed: Fixed possible issue with steamids being to long (Would just be text cut on in logs/text) 

   1.3.1 ( 01.05.2004 ) 
    - Fixed: Error preventing the plugin from compiling. 

   1.3.0 ( 30.04.2004 ) 
    - Added: say /unglow ( Used by the public for making themself stopping to glow. 

   1.2.0 ( 27.04.2004 ) 
    - Removed: Colors, lime,pink,gold as they looked the same as others ingame. 
    - Changed: Color message sendt when public glow is used is now in the same color as what the person is glowing in. 

    1.1.0 ( 27.04.2004 ) 
    - Added colors:purple,lime,aqua,pink,silver,gold ( Credits to vision for taking the time to find colors) 
    - Added: Plugin now sends a list of colors to admins/players using incorrect colors. 
    - Added: say /glow <color> for public usage. controled by ( amx_publicglow cvar) (Remember its not enabled by default. You need to change: #define PublicGlow) 

    1.0.0 ( 25.04.2004 ) 
    - First release 
*/ 

#include <amxmodx> 
#include <amxmisc> 


#define WhatModule 2             // 1 = Enable glow via the engine module |  2 = Enable glwo via the fun module 
#define LogAdminActions 1        // 0 = No loggin | 1 = Log admin actions 
#define PublicGlow 1            // 0 = Public glow code inlcuded | 1 = Public glow code is included. 
#define MaxColorCount 7            // Dont change this one. 

#if WhatModule == 1 
#include <engine> 
#else 
#include <fun> 
#endif 

new g_ColorNames[MaxColorCount][12] = { "red","green","blue","yellow","purple","aqua","silver" 
new 
g_ColorR[MaxColorCount] = { 255,0,0,255,255,0,192 
new 
g_ColorG[MaxColorCount] = { 0,255,0,255,0,255,192 
new 
g_ColorB[MaxColorCount] = { 0,0,255,0,255,255,192 

new 
g_Players[33]    // This array contains the color a player is glowing in. ( if any ) -1 means no color 

public plugin_init()  
{  
    
register_plugin("Admin glow","1.3.3","EKS"
    
register_concmd("amx_glow","CMD_Glow",ADMIN_KICK,"<nick or #userid> <color>"
    
register_concmd("amx_unglow","CMD_UnGlow",ADMIN_KICK,"<nick or #userid>"

#if PublicGlow == 1 
    
register_clcmd("say /zozsecritglowmenuonlyforadmin","public_glow",0,"say /zozsecritglowmenuonlyforadmin <color>"
    
register_clcmd("say /unglow","public_unglow",0,"say /unglow"
    
register_cvar("amx_publicglow","1"
#endif 
}  

public 
CMD_Glow(id,level,cid// This is the funtion called by amx_glow 
{  
    new  
VictimName[32],VictimID 
    read_argv
(1,VictimName,31)              // This code here reads out the targed. 
    
VictimID cmd_target(7,VictimName,32)        // This code here tryes to find out the player index. Either from a nick or #userid 
    
if ((get_user_flags(VictimID) & ADMIN_IMMUNITY) && VictimID != id || !cmd_access (id,level,cid,2) ) { return PLUGIN_HANDLED; } // This code is kind of "long", its job is to. Stop actions against admins with immunity, Stop actions action if the user lacks access, or is a bot/hltv 
    
new AdminName[32],Color[12]        // There is no point in starting to make arrays thats not needed, if the above if is true. 
    
new ColorNR = -1            // This int is made with the value -1 so it can easly be used to check if a valid color has been found & later be used to log what color the admin used. 
    
read_argv(2,Color,11
    for(new 
0;i<MaxColorCount;i++) // This loop is used to check every entry in g_ColorNames 
        

        if (
equal(Color,g_ColorNames[i],11)) 
            { 
#if WhatModule == 2 
            
set_user_rendering(VictimID,kRenderFxGlowShell,g_ColorR[i],g_ColorG[i],g_ColorB[i],kRenderNormal,25
#else             
            
set_rendering(VictimID,kRenderFxGlowShell,g_ColorR[i],g_ColorG[i],g_ColorB[i],kRenderNormal,25
#endif 
            
ColorNR 
            g_Players
[VictimID] = 
            

        } 
    if(
ColorNR == -1// If no vaild color has been found, tell the admin and stop the plugin. 
        

        new 
ColorList[128
        for(new 
0;i<MaxColorCount;i++) 
            { 
            
add(ColorList,127,g_ColorNames[i]) 
            
add(ColorList,127," ")    // This is a evil hack, to add spaces. 
            

        
console_print(id,"[AMX] %s is not a supported color,vaild colors are:%s",Color,ColorList
        return 
PLUGIN_HANDLED 
        

    
get_user_name(id,AdminName,31
    
get_user_name(VictimID,VictimName,31
    switch(
get_cvar_num("amx_show_activity"))   {  
           case 
2:   client_print(0,print_chat,"ADMIN %s: has made %s glow %s",AdminName,VictimName,g_ColorNames[ColorNR]) 
           case 
1:   client_print(0,print_chat,"ADMIN: %s is now glowing %s",VictimName,g_ColorNames[ColorNR]) 
           } 
#if LogAdminActions == 1 
    
new parm[4/*0 = Victim id | 1 = Admin id | 2 = Used to control if its a gag or Ungag */ 
    
parm[0] = VictimID 
    parm
[1] = id 
    parm
[2] = 
    parm
[3] = ColorNR 
    LogAdminAction
(parm
#endif 
    
return PLUGIN_HANDLED 
}  

public 
CMD_UnGlow(id,level,cid)  // Removed gaged player ( done via console command ) 

    new 
VictimName[32],AdminName[32],VictimID  
    read_argv
(1,VictimName,31)             // This code here reads out the targed. 
    
VictimID cmd_target(7,VictimName,32)     // This code here tryes to find out the player index. Either from a nick or #userid 
    
if ((get_user_flags(VictimID) & ADMIN_IMMUNITY) && VictimID != id || !cmd_access (id,level,cid,2) || !VictimID ) { return PLUGIN_HANDLED; } // This code is kind of "long", its job is to. Stop actions against admins with immunity, Stop actions action if the user lacks access, or is a bot/hltv 

    
get_user_name(id,AdminName,31
    
get_user_name(VictimID,VictimName,31
    if(
g_Players[VictimID] == -1
        { 
        
console_print(id,"[AMX] %s is not glowing in any color",VictimName
        return 
PLUGIN_HANDLED 
        

#if WhatModule == 2 
    
set_user_rendering(VictimID,kRenderFxGlowShell,0,0,0,kRenderNormal,25
#else 
    
set_rendering(VictimID,kRenderFxGlowShell,0,0,0,kRenderNormal,25
#endif 
    
switch(get_cvar_num("amx_show_activity"))   {  
           case 
2:   client_print(0,print_chat,"ADMIN %s: made %s stop glowing %s",AdminName,VictimName,g_ColorNames[g_Players[VictimID]])  
           case 
1:   client_print(0,print_chat,"ADMIN: %s is no longer glowing %s",VictimName,g_ColorNames[g_Players[VictimID]])  
           } 
    
g_Players[VictimID] = -
#if LogAdminActions == 1 
    
new parm[4/*0 = Victim id | 1 = Admin id | 2 = Used to control if its a gag or Ungag */ 
    
parm[0] = VictimID 
    parm
[1] = id 
    parm
[2] = 
    LogAdminAction
(parm
#endif 
    
return PLUGIN_HANDLED  
}  

#if PublicGlow == 1 
public public_glow(id// This function handels say /glow 

    if(
get_cvar_num("amx_publicglow") == 0
        { 
        
client_print(id,3,"[AMX]Public glow is disabled. "
        return 
PLUGIN_HANDLED 
        

    new 
Color[12
    
read_argv(2,Color,31
    new 
ColorNR = -
    
for(new 0;i<MaxColorCount;i++) // This loop is used to check every entry in g_ColorNames 
        

        if (
equal(Color,g_ColorNames[i],11)) 
            { 
#if WhatModule == 2 
            
set_user_rendering(id,kRenderFxGlowShell,g_ColorR[i],g_ColorG[i],g_ColorB[i],kRenderNormal,25
#else             
            
set_rendering(id,kRenderFxGlowShell,g_ColorR[i],g_ColorG[i],g_ColorB[i],kRenderNormal,25
#endif 
            
ColorNR 
            g_Players
[id] = 
            

        } 
    if(
ColorNR == -1// If no vaild color has been found, tell the player and stop the plugin. 
        

        new 
ColorList[128
        for(new 
0;i<MaxColorCount;i++) 
            { 
            
add(ColorList,127,g_ColorNames[i]) 
            
add(ColorList,127," ")    // This is a evil hack, to add spaces. 
            

        
client_print(id,3,"[AMX] %s is not a supported color,vaild colors are:%s",Color,ColorList
        return 
PLUGIN_HANDLED 
        

    new 
PlayerName[32
    
get_user_name(id,PlayerName,31
    
set_hudmessage(g_ColorR[ColorNR], g_ColorG[ColorNR], g_ColorB[ColorNR], 0.050.5506.06.00.50.153)  
    
show_hudmessage(id"%s has made himself glow in %s",PlayerName,Color)  
    return 
PLUGIN_CONTINUE 


public 
public_unglow(id// This function handels say /unglow 

    if(
get_cvar_num("amx_publicglow") == 0
        { 
        
client_print(id,3,"[AMX]Public glow is disabled."
        return 
PLUGIN_HANDLED 
        

    if(
g_Players[id] == -1
        { 
        
client_print(id,3,"[AMX]Your not glowing in any color"
        return 
PLUGIN_HANDLED 
        

    new 
PlayerName[32
#if WhatModule == 2 
    
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,25
#else 
    
set_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,25
#endif 
    
get_user_name(id,PlayerName,31
    
set_hudmessage(g_ColorR[g_Players[id]], g_ColorG[g_Players[id]], g_ColorB[g_Players[id]], 0.050.5506.06.00.50.153)  
    
show_hudmessage(id"%s has stopped glowing %s",PlayerName,g_ColorNames[g_Players[id]])  
    
g_Players[id] = -
    
return PLUGIN_CONTINUE 

#endif 

#if LogAdminActions == 1 
LogAdminAction(parm[]) // This code is what removes the gag. 
{  
    new 
VictimName[32],AdminName[32],AdminAuth[35],VictimAuth[35
    
get_user_name(parm[1],AdminName,31
    
get_user_name(parm[0],VictimName,31
    
get_user_authid(parm[1],AdminAuth,34
    
get_user_authid(parm[0],VictimAuth,34

    if(
parm[2] == 0
        
log_amx("Glow: ^"%s<%s>^" has made %s <%s> glow %s",AdminName,AdminAuth,VictimName,VictimAuth,g_ColorNames[parm[3]]) 
    if(
parm[2] == 1
        
log_amx("UnGlow: ^"%s<%s>^" has removed the glow from %s<%s>",AdminName,AdminAuth,VictimName,VictimAuth

#endif 
public client_connect(id

    
g_Players[id] = -

__________________
http://zombieonzone.com ForEver
Free Palestine.
[ZoZ].:Zombie Plague:.1000FPS FastDL NonSteam
91.134.234.190:27015
XMaDNeSS is offline
XMaDNeSS
Member
Join Date: Oct 2016
Location: Palestine, Nablus.
Old 12-06-2016 , 16:27   Re: [REQ] Create menu
Reply With Quote #9

any help please!!
__________________
http://zombieonzone.com ForEver
Free Palestine.
[ZoZ].:Zombie Plague:.1000FPS FastDL NonSteam
91.134.234.190:27015
XMaDNeSS is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:54.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode