Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin
Archive › Old Forum Threads › Help › Scripting Help › Need help with script
8 posts, 3 people · 1,562 views Thread Rating: ★★★★★
closedNeed help with script
Started by Dethmaul on 10-05-2006, 03:19 AM
D Dethmaul
started this thread
Posts: 4
Threads: 1
Joined: Feb 2005
10-05-2006, 03:19 AM #1

Here is a script I am trying to get working: It compiles fine, but when I try to use it ingame it says the command is invalid. If I am right the command to run this plugin should be "amx_pointmenu"rnI have racked my brain and cannot figure it out.rnAny help would be greatly appreciatedrnrnrn

/* Plugin Created by DethmaulrnThis plugins is a heavily modified version of admin_aimmenu created by EKS.rnrnUsage:rnBind keys to : amx_pointmenu, amx_lastadminmenurnAim at desired target and then press the key to bring up the Point MenurnThe amx_lastadminmenu basicaly recalls the last targeted player (Allows you to quickly target a player that was kicked - rnas long as you haven't selected a new target since kicking the last perpetrator.rnThis plugins requires the following other plugins to  work correctly: dod_eviladmin, amx_forcequit, & spray_managementrnto work correctly.  */rnrn#include <amxmodx>rn#include <amxmisc>rnrn/* ******************************* Define section *********************************** */rnrn#define SlapDMG 0			// How much damag the slap command doesrn#define LastAdminTarget 1		// Include amx_lastadminmenu codern#define MaxPlayers 20			// Max playersrn#define MaxPlayers 20rnrn/* ******************************* Define section end *********************************** */rnrnnew g_AdminTarget[MaxPlayers+1]		// Used to store the target, a array is used incase 2+ admins use the menu at the same time.rnnew g_LastTarget[MaxPlayers+1]		// Contains the ID of the last admin target.rnrnpublic plugin_init()rn	{  rn	register_plugin("PointMenu","1.0","Dethmaul")rn	register_menucmd(register_menuid("Point Menu"), 1023, "pointmenu" )rn	//register_concmd("amx_pointmenu","point_menu",ADMIN_BAN, "Amx_pointmenu Options First..")rn	register_clcmd("amx_pointmenu","cmdPointMenu",ADMIN_BAN, "Amx_pointmenu Options First..")rn#if LastAdminTarget == 1rn	register_clcmd("amx_lastadminmenu","cmdLastAdminTarget",ADMIN_BAN,"Loads adminmenu based on the last player a admin action was taken agaist")rn#endifrn	}rn	rn	rnpublic pointmenu(id,key){rn	if (!is_user_connected(g_AdminTarget[id])){rn		client_print(id,print_center,"This player has left the server") 		rn		return PLUGIN_HANDLEDrn		}rn	new param[2]	rn	switch(key)rn	{rn		case 0: {rn			g_LastTarget[id] = g_AdminTarget[id]rn			//param[0] = 0rn			param[0] = g_AdminTarget[id]rn			param[1] = idrn			//EchoAdminAction(param)rn			server_cmd("amx_evilglow #%d",get_user_userid(g_AdminTarget[id]))rn			}rn			rn		case 1: {rn			user_slap(g_AdminTarget[id],SlapDMG)rn			g_LastTarget[id] = g_AdminTarget[id]rn			//param[0] = 0rn			param[0] = g_AdminTarget[id]rn			param[1] = idrn			//EchoAdminAction(param)rn			}rn						rn		case 2: {rn			g_LastTarget[id] = g_AdminTarget[id]rn			//param[0] = 0rn			param[0] = g_AdminTarget[id]rn			param[1] = idrn			//EchoAdminAction(param)rn			server_cmd("amx_nick #%d DoDUser",get_user_userid(g_AdminTarget[id]))rn			}rn		rn		case 3: {rn			g_LastTarget[id] = g_AdminTarget[id]rn			//param[0] = 0rn			param[0] = g_AdminTarget[id]rn			param[1] = idrn			//EchoAdminAction(param)rn			server_cmd("amx_evilbury #%d",get_user_userid(g_AdminTarget[id]))rn			}rn		rn		case 4: {rn			g_LastTarget[id] = g_AdminTarget[id]rn			//param[0] = 0rn			param[0] = g_AdminTarget[id]rn			param[1] = idrn			//EchoAdminAction(param)rn			server_cmd("amx_evilvision #%d",get_user_userid(g_AdminTarget[id]))rn			}rn		rn		case 5: {rn			g_LastTarget[id] = g_AdminTarget[id]rn			//param[0] = 0rn			param[0] = g_AdminTarget[id]rn			param[1] = idrn			//EchoAdminAction(param)rn			server_cmd("amx_evilmelee #%d",get_user_userid(g_AdminTarget[id]))rn			}rn			rn		case 6: {rn			g_LastTarget[id] = g_AdminTarget[id]rn			//param[0] = 0rn			param[0] = g_AdminTarget[id]rn			param[1] = idrn			//EchoAdminAction(param)rn			server_cmd("amx_evilpimpslap #%d",get_user_userid(g_AdminTarget[id]))rn			}rn		rn		case 7: {rn			g_LastTarget[id] = g_AdminTarget[id]rn			//param[0] = 0rn			param[0] = g_AdminTarget[id]rn			param[1] = idrn			//EchoAdminAction(param)rn			client_cmd(id,"SecondPointMenu")rn			}rn		}rn		rn	return PLUGIN_HANDLEDrn	}		rn	rn	rnpublic DisplayPointMenu(id)rn	{rn				rn	new szMenuBody[512],VictimName[33],lenrn	get_user_name(g_AdminTarget[id],VictimName,32)rn	new keysrn	len = format(szMenuBody,2047,"
Point Menu^nTarget aquired:  %s^n^n",VictimName)rn	//new len = format( szMenuBody, 255, "
Point Menu:^n" )rn	len += format( szMenuBody[len], 2047-len, "^ny1. Make Player Glow/Not Glow^n",SlapDMG )rn	len += format( szMenuBody[len], 2047-len, "^ny2. Slap Player (%d Damage)^n" )rn	len += format( szMenuBody[len], 2047-len, "^ny3. Change Player Name to DoDUser^n" )rn	len += format( szMenuBody[len], 2047-len, "^ny4. Bury/Unbury Player^n" )rn	len += format( szMenuBody[len], 2047-len, "^ny5. Change Player Vision^n" )rn	len += format( szMenuBody[len], 2047-len, "^ny6. Force Melee/Regular^n" )rn	len += format( szMenuBody[len], 2047-len, "^ny7. Change Player Run Speed^n" )rn	len += format( szMenuBody[len], 2047-len, "^ny8. MegaSlap Player^n" )rn	len += format( szMenuBody[len], 2047-len, "^n^ny0. Exit" )rn	rn	keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)rn	show_menu(id,keys,szMenuBody)rn	}rn	rnpublic cmdPointMenu(id,level,cid){ // This part of the code gets who the admin is aiming at, and checks for immmunityrn	if(!cmd_access (id,level,cid,1)) return PLUGIN_HANDLEDrn	new TargetID,body rn	get_user_aiming(id,TargetID,body) rn	rn	if (!TargetID){ // Checks to see if "TargetID" has any value, if it does not. Then the admin is not aiming at anyone.rn		client_print(id,print_center,"No valid target for Adminmenu")rn		return PLUGIN_HANDLEDrn		}rn	if (get_user_flags(TargetID) & ADMIN_IMMUNITY){ // Checks if the TargetID has admin immunityrn		client_print(id,print_center,"Target has admin immunity")rn		return PLUGIN_HANDLEDrn		}rnrn	g_AdminTarget[id] = TargetIDrn	rn	DisplayPointMenu(id)rn	return PLUGIN_CONTINUErn	}rn#if LastAdminTarget == 1rnpublic cmdLastAdminTarget(id,level,cid){ // This code checks if g_LastTarget[id] has any value.  If it does, it opens the menu menurn	if(!cmd_access (id,level,cid,1)) return PLUGIN_HANDLEDrn	if (!g_LastTarget[id]){ // Checks to see if "TargetID" has any value, if it does not. Then the admin is not aiming at anyone.rn		client_print(id,print_center,"There is no last admin target.")rn		return PLUGIN_HANDLEDrn		}rn	g_AdminTarget[id] = g_LastTarget[id]rn	DisplayPointMenu(id)rn	return PLUGIN_CONTINUErn	}rn#endif
H Hell Phoenix
posted here
Posts: 201
Threads: 17
Joined: Jan 2005
10-05-2006, 12:37 PM #2

Try this for your public cmdPointMenu (I didnt have time to test it...its just what I saw off the top of my head):n

public cmdPointMenu(id,level,cid){ // This part of the code gets who the admin is aiming at, and checks for immmunityn if(!cmd_access (id,level,cid,1)) n  {n  return PLUGIN_HANDLEDn }n n new TargetID,body n get_user_aiming(id,TargetID,body) n n if (!TargetID){ // Checks to see if "TargetID" has any value, if it does not. Then the admin is not aiming at anyone.n  client_print(id,print_center,"No valid target for Adminmenu")n  return PLUGIN_HANDLEDn }n if (get_user_flags(TargetID) && ADMIN_IMMUNITY){ // Checks if the TargetID has admin immunityn  client_print(id,print_center,"Target has admin immunity")n  return PLUGIN_HANDLEDn }n n g_AdminTarget[id] = TargetIDn n DisplayPointMenu(id)n return PLUGIN_CONTINUEn}
diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
10-05-2006, 07:28 PM #3

also note that when using clcmd... you will always get like invalid or unknown command in the console if you dont have the function return PLUGIN_HANDLED...

D Dethmaul
started this thread
Posts: 4
Threads: 1
Joined: Feb 2005
10-05-2006, 09:32 PM #4

OK. This plugin loads and pulls up the menus, but when I press a key for the actions it doesnt do anything but close the menu.nn

n/* Plugin Created by DethmaulnThis plugins is a heavily modified version of admin_aimmenu.nnUsage:nBind keys to : amx_aimadminmenu, amx_lastadminmenunAim at desired target and then press the key to bring up the Point MenunThe amx_lastadminmenu basicaly recalls the last targeted player (Allows you to quickly target a player that was kicked - nas long as you haven't selected a new target since kicking the last perpetrator.nThis plugins requires the following other plugins to  work correctly: dod_eviladmin, amx_forcequit, & spray_managementnto work correctly.  n*/nn#include <amxmodx>n#include <amxmisc>nn/* ******************************* Define section *********************************** */nn#define MaxPlayers 20            // Max playersn#define BanTime 10            // How long the Temp ban should lastn#define LastAdminTarget 1        // Include amx_lastadminmenu coden#define SlapDMG 0                // How much dmg the slap doesnn// If you want to change the command sent to the client to show the rules search for "amx_publicrules"n/* ******************************* Define section end *********************************** */nnnew g_AdminTarget[MaxPlayers+1]        // Used to store the target, a array is used incase 2+ admins use the menu at the same time.nnew g_LastTarget[MaxPlayers+1]        // Contains the ID of the last admin target.nnnpublic plugin_init() {n    register_plugin("AMX Point Mneu","1.0","Dethmaul")n    register_menucmd(register_menuid("Aim Adminmenu"),1023,"aimadminmenu")n    //register_concmd("amx_pointmenu", "cmdPointMenu", ADMIN_LEVEL_B, "Amx_pointmenu Options First..")n    register_clcmd("amx_aimadminmenu","cmdAimAdminmenu",ADMIN_BAN,"Loads adminmenu based on who your aiming at")n#if LastAdminTarget == 1n    register_clcmd("amx_lastadminmenu","cmdLastAdminTarget",ADMIN_BAN,"Loads adminmenu based on the last player a admin action was taken agaist")n#endifn    }nnpublic aimadminmenu(id,key){n    if (!is_user_connected(g_AdminTarget[id])){n        client_print(id,print_center,"This player has left the server")         n        return PLUGIN_HANDLEDn        }n    new param[2]n    switch(key){n        case 0: {n            g_LastTarget[id] = g_AdminTarget[id]n            //param[0] = 0n            param[0] = g_AdminTarget[id]n            param[1] = idn            //EchoAdminAction(param)n            server_cmd("amx_evilglow #%d",get_user_userid(g_AdminTarget[id]))n            }n            n        case 1: {n            user_slap(g_AdminTarget[id],SlapDMG)n            g_LastTarget[id] = g_AdminTarget[id]n            //param[0] = 0n            param[0] = g_AdminTarget[id]n            param[1] = idn            //EchoAdminAction(param)n            }n                        n        case 2: {n            g_LastTarget[id] = g_AdminTarget[id]n            //param[0] = 0n            param[0] = g_AdminTarget[id]n            param[1] = idn            //EchoAdminAction(param)n            server_cmd("amx_nick #%d DoDUser",get_user_userid(g_AdminTarget[id]))n            }n        n        case 3: {n            g_LastTarget[id] = g_AdminTarget[id]n            //param[0] = 0n            param[0] = g_AdminTarget[id]n            param[1] = idn            //EchoAdminAction(param)n            server_cmd("amx_evilbury #%d",get_user_userid(g_AdminTarget[id]))n            }n        n        case 4: {n            g_LastTarget[id] = g_AdminTarget[id]n            //param[0] = 0n            param[0] = g_AdminTarget[id]n            param[1] = idn            //EchoAdminAction(param)n            server_cmd("amx_evilvision #%d",get_user_userid(g_AdminTarget[id]))n            }n        n        case 5: {n            g_LastTarget[id] = g_AdminTarget[id]n            //param[0] = 0n            param[0] = g_AdminTarget[id]n            param[1] = idn            //EchoAdminAction(param)n            server_cmd("amx_evilmelee #%d",get_user_userid(g_AdminTarget[id]))n            }n            n        case 6: {n            g_LastTarget[id] = g_AdminTarget[id]n            //param[0] = 0n            param[0] = g_AdminTarget[id]n            param[1] = idn            //EchoAdminAction(param)n            server_cmd("amx_evilpimpslap #%d",get_user_userid(g_AdminTarget[id]))n            }n        n        }n    return PLUGIN_HANDLEDn    }nnpublic DisplayAimAdminmenu(id){n    new menuBody[512],VictimName[33],lenn    get_user_name(g_AdminTarget[id],VictimName,32)nn    len = format(menuBody,2047,"
Point Menu^nTarget aquired:  %s^n^n",VictimName) n    len += format(menuBody[len],2047 - len,"w1. Make Player Glow/Not Glow^n" )n    len += format(menuBody[len],2047 - len,"w2. Slap Player (%d Damage)^n",SlapDMG )n    len += format(menuBody[len],2047 - len,"w3. Change Player Name to DoDUser^n" )n    len += format(menuBody[len],2047 - len,"w4. Bury/Unbury Player^n" )n    len += format(menuBody[len],2047 - len,"w5. Change Player Vision^n" )n    len += format(menuBody[len],2047 - len,"w6. Force Melee/Regular^n" )n    len += format(menuBody[len],2047 - len,"w7. Change Player Run Speed^n" )n    len += format(menuBody[len],2047 - len,"w8. MegaSlap Player^n^n^n" )n    len += format(menuBody[len],2047 - len,"w0. Exit" )nn    new keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)n    show_menu(id,keys,menuBody)n    }npublic cmdAimAdminmenu(id,level,cid){ // This part of the code gets who the admin is aiming at, and checks for immmunityn     if(!cmd_access (id,level,cid,1)) n      {n      return PLUGIN_HANDLEDn     }n     new TargetID,body n     get_user_aiming(id,TargetID,body) n n     if (!TargetID){ // Checks to see if "TargetID" has any value, if it does not. Then the admin is not aiming at anyone.n          client_print(id,print_center,"No valid target for Adminmenu")n          return PLUGIN_HANDLEDn         }n     if(access(TargetID, ADMIN_IMMUNITY)) { n    //if (get_user_flags(TargetID) && ADMIN_IMMUNITY){ // Checks if the TargetID has admin immunityn          client_print(id,print_center,"Target has admin immunity")n          return PLUGIN_HANDLEDn         }n n     g_AdminTarget[id] = TargetIDn n     DisplayAimAdminmenu(id)n     return PLUGIN_HANDLEDn    }nn#if LastAdminTarget == 1npublic cmdLastAdminTarget(id,level,cid){ // This code checks if g_LastTarget[id] has any value.  If it does, it opens the menu menun    if(!cmd_access (id,level,cid,1)) return PLUGIN_HANDLEDn    if (!g_LastTarget[id]){ // Checks to see if "TargetID" has any value, if it does not. Then the admin is not aiming at anyone.n        client_print(id,print_center,"There is no last admin target.")n        return PLUGIN_HANDLEDn        }n    g_AdminTarget[id] = g_LastTarget[id]n    DisplayAimAdminmenu(id)n    return PLUGIN_HANDLEDn    }n#endif
diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
10-05-2006, 10:46 PM #5

from now on use code tags so that it keeps its formatting..

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
10-05-2006, 11:00 PM #6

do this to line 130:nchangen

show_menu(id,keys,menuBody)
ton
show_menu(id,keys,menuBody, -1, "Aim Adminmenu")
nnow i get msgs like:n
nUnknown command: amx_evilvisionnUnknown command: amx_evilmeleen
which is just becuase i dont have those commands so it should work for you..

D Dethmaul
started this thread
Posts: 4
Threads: 1
Joined: Feb 2005
10-06-2006, 02:03 AM #7

Thamks for all you help.. Got it working. Turns out my register menuid command was invalid

D Dethmaul
started this thread
Posts: 4
Threads: 1
Joined: Feb 2005
10-19-2006, 07:08 PM #8

Ok so I changed my plugin to have more menu pages. Everything is working except my options to go back a menu page. i can go forward to next menu but when I hit the option to go back a menu it just closes the menu like an invalid key is pressed. I meesed with the key parameters... removing one key and then on my second menu I could get it to go back to first menu but the key was 9 instead of 0 and the third menu still continued to close the menu completelyrnrnrnrnHere is the plugin, I cannot seem to get it to copy correctly herernhttp://forums.alliedmods.net/showthread.php?t=46131

Archive › Old Forum Threads › Help › Scripting Help › Need help with script
DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC