Raised This Month: $ Target: $400
 0% 

Putting together a plugin? (VIPMenu)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 07-24-2010 , 17:33   Re: Putting together a plugin? (VIPMenu)
Reply With Quote #1

Hmm, I found out how. I'm on my iPhone right now so I won't say it now but I'll tell you once I get on my computer.

Just read through this sma- http://forums.alliedmods.net/attachm...6&d=1176789689
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
SozzZod
Junior Member
Join Date: Oct 2009
Old 07-24-2010 , 18:46   Re: Putting together a plugin? (VIPMenu)
Reply With Quote #2

I think the set_task is too hard for a beginner... i think i will just use the "once in a round" code... anyway thanks for trying =)
SozzZod is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 07-24-2010 , 18:50   Re: Putting together a plugin? (VIPMenu)
Reply With Quote #3

K

Just ask If you need help

Last edited by nikhilgupta345; 07-24-2010 at 19:00.
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
SozzZod
Junior Member
Join Date: Oct 2009
Old 07-24-2010 , 19:29   Re: Putting together a plugin? (VIPMenu)
Reply With Quote #4

Now i do =(

Alot of errors during compiling...
Undefined symbol ADMIN_LEVEL_T, item, menu_handler
unreacable code and so on =(((

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

}

public 
plugin_init()
{
 
register_clcmd"say /vipmenu","VIPMenu");
}
public 
VIPMenu(id)
{
if( !(
get_user_flagsid ) & ADMIN_LEVEL_T ) ) {
     return;
 
vip_menu menu_create("\rVip menu:""menu_handler");
 
menu_additem(vip_menu"\wHealth And Armor""1"0);
 
menu_additem(vip_menu"\wGive Deagle""2"0);
 
menu_additem(vip_menu"\wGrenades""3"0); //is it right?
 
menu_additem(vip_menu"\wScout""4" 0);
 
menu_setprop(vip_menuMPROP_EXITMEXIT_ALL);
}

public 
menu_handler(idmenuitem)
{
 if( 
item == MENU_EXIT )
 {
  
menu_destroy(menu);
  return 
PLUGIN_HANDLED;
 }
 new 
data[6], iName[64];
 new 
accesscallback;
 
 
menu_item_getinfo(menuitemaccessdata,5iName63callback);
 new 
key str_to_num(data);
 switch(
key)
 {
  case 
1:
  {
   
set_user_health(id150); //Sets health of id to 150
   
set_user_armor(id200); //Sets armor of id to 200
  
}
 
  case 
2:
  {
   
give_item(id"weapon_deagle");
   
give_item(id"ammo_50ae"); 
  }
  case 
3:
 {
   
give_item(id"weapon_flashbang") ;
   
give_item(id"weapon_flashbang") ;
   
give_item(id"weapon_smokegrenade") ;
   
give_item(id"weapon_hegrenade") ;
  }  
  case 
4:
  {
   
give_item(id"weapon_scout") ;
  } 
 }
 
menu_destroy(menu);
 return 
PLUGIN_HANDLED;

SozzZod is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 07-24-2010 , 19:52   Re: Putting together a plugin? (VIPMenu)
Reply With Quote #5

So I think I was mistaken, what you should've done, instead of the if statement, was register_clcmd( "say /vipmenu", "VIPMenu", "ADMIN_LEVEL_A") The admin levels have to be from a-h. then remove the if statement.
Code:
#include <amxmodx> 
#include <fun> 
new vip_menu 
 
public plugin_init() 
{ 
register_clcmd( "say /vipmenu","VIPMenu", ADMIN_LEVEL_A); 
} 
public VIPMenu(id) 
{ 
vip_menu = menu_create("\rVip menu:", "menu_handler"); 
menu_additem(vip_menu, "\wHealth And Armor", "1", 0); 
menu_additem(vip_menu, "\wGive Deagle", "2", 0); 
menu_additem(vip_menu, "\wGrenades", "3", 0); //is it right? 
menu_additem(vip_menu, "\wScout", "4" , 0); 
menu_setprop(vip_menu, MPROP_EXIT, MEXIT_ALL); 
} 
 
public menu_handler(id, menu, item) 
{ 
if( item == MENU_EXIT ) 
{ 
menu_destroy(menu); 
return PLUGIN_HANDLED; 
} 
new data[6], iName[64]; 
new access, callback; 
 
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback); 
new key = str_to_num(data); 
switch(key) 
{ 
case 1: 
{ 
set_user_health(id, 150); //Sets health of id to 150 
set_user_armor(id, 200); //Sets armor of id to 200 
} 
 
case 2: 
{ 
give_item(id, "weapon_deagle"); 
give_item(id, "ammo_50ae");  
} 
case 3: 
{ 
give_item(id, "weapon_flashbang") ; 
give_item(id, "weapon_flashbang") ; 
give_item(id, "weapon_smokegrenade") ; 
give_item(id, "weapon_hegrenade") ; 
}   
case 4: 
{ 
give_item(id, "weapon_scout") ; 
}  
} 
menu_destroy(menu); 
return PLUGIN_HANDLED; 
}  
Try that and then try to compile. Post the log if it doesn't work.

Last edited by nikhilgupta345; 07-24-2010 at 19:59.
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 07-24-2010 , 20:00   Re: Putting together a plugin? (VIPMenu)
Reply With Quote #6

I was just able to compile the above plugin, but since i do not have counter-strike installed on this computer, nor a dedicated server to run it on, I cannot test it out.

Oh, and btw, you had a closing brace right after new vip_menu, which messed up the compilation. Also, the if statement thing that i told you to do was wrong :/. MY BAD
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
SozzZod
Junior Member
Join Date: Oct 2009
Old 07-24-2010 , 20:00   Re: Putting together a plugin? (VIPMenu)
Reply With Quote #7

Now i have 3 errors... :
error 054: unmatched closing brace
warning 217: loose indentation

and could not find output file blablabla compiled\vip_menu.amx <compile failed>

1 error actually* that output thingy... the others arent errors.. smth else

Last edited by SozzZod; 07-24-2010 at 20:03.
SozzZod is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 07-24-2010 , 20:02   Re: Putting together a plugin? (VIPMenu)
Reply With Quote #8

Yea, try again. i just edited the code I posted to remove the closing brace. Loose indentation doesn't matter THAT much, but try to fix it. It cannot find the output file because it failed to compile. Loose indentation can be fixed just by lining up the lines where it says loose indentation
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-24-2010 , 20:06   Re: Putting together a plugin? (VIPMenu)
Reply With Quote #9

Putting an access level in register_clcmd() or other registers DOES NOT restrict access to that command be itself. The code that you posted is available to everybody on the server.
__________________
fysiks is offline
SozzZod
Junior Member
Join Date: Oct 2009
Old 07-24-2010 , 20:06   Re: Putting together a plugin? (VIPMenu)
Reply With Quote #10

compiled =)))
SozzZod 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:09.


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