Raised This Month: $32 Target: $400
 8% 

Show it only for Admin's (Flag_H)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
balauris
Junior Member
Join Date: Mar 2010
Old 04-26-2010 , 11:44   Show it only for Admin's (Flag_H)
Reply With Quote #1

Hey, i have some problem, that menu is showed for all player, i need to show it to only admins who have Flag H. (it's automaticaly showed in start of the round). Thank you for helping me !

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>
#include <amxmisc>
#include <fun>
 
#define PLUGIN_NAME   "JAILBREAK VIP"
#define PLUGIN_AUTHOR   "AURIMASKO"
#define PLUGIN_VERSION   "0.1"
#define ADMINACCESS ADMIN_LEVEL_H
static const COLOR[] = "^x04"
static const CONTACT[] = ""
new maxplayers
new gmsgSayText
new bool:FirstSpawn[33]
public 
plugin_init()
{
 
   
register_plugin(PLUGIN_NAMEPLUGIN_AUTHORPLUGIN_VERSION);
   
register_event("ResetHUD","event_reset_hud","be");
 
    
register_clcmd"say vipmenu","MenuCmd",ADMIN_LEVEL_H,"Description of the command");
    
register_menucmd(register_menuid("Vali vaade"), 1023"setview"
    
register_clcmd("camera""chooseview")
    
register_clcmd("camera""chooseview"
   
register_cvar("amx_contactinfo"CONTACTFCVAR_SERVER)
   
gmsgSayText get_user_msgid("SayText")
   
maxplayers get_maxplayers()
    
RegisterHam        (Ham_Spawn"player""Player_Spawn"1)
    
register_forwardFM_PlayerPreThink"forward_player_prethink" );
    
register_logevent"logevent_round_start"2"1=Round_Start" );
}
public 
event_reset_hud(id)
{
   if(
is_user_alive(id) && get_user_flags(id) & ADMIN_LEVEL_H)
      return 
PLUGIN_CONTINUE;
 
   if(!
access(id,ADMIN_LEVEL_H))
      return 
PLUGIN_CONTINUE;
 
   
set_task(1.0,"give_stuff",id);
 
   return 
PLUGIN_CONTINUE;
}
public 
give_stuff(id)
{
   if(!
is_user_connected(id))
      return;
 
   
fm_give_item(id"weapon_flashbang");
   
fm_give_item(id"weapon_flashbang");
   
set_user_health(idget_user_health(id) + 30);
}
 
public 
handle_say(id)
{
   new 
said[192]
   
read_args(said,192)
   if(( 
containi(said"who") != -&& containi(said"admin") != -1) || contain(said"/vips") != -1)
      
set_task(0.1,"print_viplist"id)
   return 
PLUGIN_CONTINUE
}
public 
print_viplist(user)
{
   new 
adminnames[33][32]
   new 
message[256]
   new 
contactinfo[256], contact[112]
   new 
idcountxlen
 
   
for(id id <= maxplayers id++)
      if(
is_user_connected(id))
         if(
get_user_flags(id) & ADMIN_LEVEL_H)
            
get_user_name(idadminnames[count++], 31)
   
len format(message255"%s Prisijunge vipai: ",COLOR)
   if(
count 0) {
      for(
count x++) {
         
len += format(message[len], 255-len"%s%s "adminnames[x], < (count-1) ? ", ":"")
         if(
len 96 ) {
            
print_message(usermessage)
            
len format(message255"%s ",COLOR)
         }
      }
      
print_message(usermessage)
   }
   else {
      
len += format(message[len], 255-len"Nera prisijungusiu vipu.")
      
print_message(usermessage)
   }
   
get_cvar_string("amx_contactinfo"contact63)
   if(
contact[0])  {
      
format(contactinfo111"%s Contact Server Admin -- %s"COLORcontact)
      
print_message(usercontactinfo)
   }
}
print_message(idmsg[])
{
   
message_begin(MSG_ONEgmsgSayText, {0,0,0}, id)
   
write_byte(id)
   
write_string(msg)
   
message_end()
}
 
public 
Player_Spawn(id)
{
    if( !
is_user_alive(id) )
 
        {
            
FirstSpawn[id] = true
            
return
        }
    
FirstSpawn[id] = false
    
new menu menu_create("VIP MENU:""vip_menu");
    
menu_additem(menu"Glockas + 20HP""1"ADMIN_LEVEL_H);
    
menu_additem(menu"Usp + 20HP""2"ADMIN_LEVEL_H);
    
menu_additem(menu"+100 armor""3"ADMIN_LEVEL_H);
    
menu_additem(menu ,"+50 HP""4" ADMIN_LEVEL_H);
    
menu_additem(menu ,"Usp +50 armor""5" ADMIN_LEVEL_H);
    
menu_additem(menu ,"Glockas + 50 armor""6" ADMIN_LEVEL_H);
    
menu_additem(menu ,"Glokas""7" ADMIN_LEVEL_H);
    
menu_additem(menu ,"Usp""8" ADMIN_LEVEL_H);
 
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}
public 
vip_menu(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:
        {
            
strip_user_weapons (id)
            
fm_give_itemid"weapon_knife" );
            
fm_give_itemid"weapon_glock18" );
            
fm_give_itemid"ammo_50ae" );
            
fm_set_user_healthidget_user_healthid ) + 20 );
            
client_print(idprint_chat"Gavai Glocka + 20HP");
            
menu_destroy(menu);
            return 
PLUGIN_HANDLED;
        }
        case 
2:
        {
            
strip_user_weapons (id)
            
fm_give_itemid"weapon_knife" );
            
fm_give_itemid"weapon_usp" );
            
fm_give_itemid"ammo_50ae" );
            
fm_set_user_healthidget_user_healthid ) + 20 );
            
client_print(idprint_chat"Gavai Usp + 20 HP");
        }
case 
3:
        {
            
fm_set_user_armoridget_user_armorid ) + 100 );
            
client_print(idprint_chat"Gavai 100 Armoro");
        }
case 
4:
        {
            
fm_set_user_healthidget_user_healthid ) + 50 );
            
client_print(idprint_chat"Gavai + 50 HP");
        }
case 
5:
        {
            
fm_give_itemid"weapon_knife" );
            
fm_give_itemid"weapon_usp" );
            
fm_give_itemid"ammo_50ae" );
             
fm_set_user_armoridget_user_armorid ) + 50 );
            
client_print(idprint_chat"Gavai Usp + 50 Armor");
        }
case 
6:
        {
            
fm_give_itemid"weapon_knife" );
            
fm_give_itemid"weapon_glock18" );
            
fm_give_itemid"ammo_50ae" );
            
fm_set_user_armoridget_user_armorid ) + 50 );
            
client_print(idprint_chat"Gavai Glocka + 50 Armor");
        }
case 
7:
        {
 
            
fm_give_itemid"weapon_knife" );
            
fm_give_itemid"weapon_glock18" );
            
fm_give_itemid"ammo_50ae" );
            
fm_give_itemid"ammo_50ae" );
            
client_print(idprint_chat"Gavai Gloka ");
        }
case 
8:
        {
            
fm_give_itemid"weapon_knife" );
            
fm_give_itemid"weapon_usp" );
            
fm_give_itemid"ammo_50ae" );
            
fm_give_itemid"ammo_50ae" );
            
client_print(idprint_chat"Gavai Usp ");
        }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;

balauris is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 04-26-2010 , 12:55   Re: Show it only for Admin's (Flag_H)
Reply With Quote #2

Dont duplicate topics, or you will end up getting both trashed. http://forums.alliedmods.net/showthread.php?t=125146
__________________
I am out of order!
grimvh2 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 03:28.


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