daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest Mar 17th, 2019 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <engine>
  4. #include <fun>
  5. #include <fakemeta_util>
  6. #include <hamsandwich>
  7. #include <colorchat>
  8.  
  9.  
  10. #define PLUGIN "Vip"
  11. #define VERSION "1.0a"
  12. #define AUTHOR "costea"
  13.  
  14.  
  15. #define ADMIN_GOLD   ADMIN_LEVEL_H //t
  16. #define ADMIN_SILVER   ADMIN_LEVEL_G //s
  17.  
  18.  
  19. #define SCOREATTRIB_DEAD    ( 1 << 0 )
  20. #define SCOREATTRIB_VIP  ( 1 << 2 )
  21.  
  22.  
  23. new Cvar_VIP
  24. new Runda_Arme = 3
  25. new bool: Activare = false
  26. new Contor = 0
  27. new g_szMessage[256]
  28. new const g_szBeginning[ ] = "Membrii VIP"
  29.  
  30.  
  31. const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90);
  32. const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE);
  33.  
  34.  
  35. new mkb,mhb,cvar_vip_maxhp,cvar_vip_maxap,cvar_hp_kill_premium,cvar_ap_kill_premium,cvar_hp_kill_classic,cvar_ap_kill_classic,cvar_vip_jump
  36. new cvar_vip_in_out,jumpnum[33], bool: dojump[33],cvar_vip_showC,cvar_vip_showH,SyncHudMessage
  37.  
  38. #define tag "INFO-VIP"
  39.  
  40. public plugin_init () {
  41.    
  42.    register_plugin ("PLUGIN", "VERSION", "AUTHOR")
  43.    new MapName[32]
  44.    get_mapname(MapName,31)
  45.    if(MapName[0] == 'a' && MapName[1] == 'w' && MapName[2] == 'p')
  46.       pause("ac","vipnew.amxx")
  47.    if(equal(MapName,"35hp_2"))
  48.       pause("ac","vipnew.amxx")
  49.    if(equal(MapName,"35hp"))
  50.       pause("ac","vipnew.amxx")  
  51.    
  52.  
  53.  
  54.    register_clcmd("say /wantvip", "vip_info")
  55.    register_clcmd("say /vips", "print_adminlist")
  56.    RegisterHam(Ham_Spawn, "player", "cmdSpawn", 1)
  57.    register_event("DeathMsg", "eDeathMsg", "a")
  58.    register_logevent("RoundStart", 2, "1=Round_Start")
  59.    register_message(get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib")
  60.    Cvar_VIP = register_cvar("amx_vip" , "0")
  61.    cvar_vip_in_out = register_cvar("amx_vip_in_out", "1")
  62.    cvar_vip_jump = register_cvar("amx_vip_jump", "1" )
  63.    cvar_hp_kill_premium = register_cvar("amx_vip_addhp", "15")  
  64.    cvar_ap_kill_premium = register_cvar("amx_vip_addap", "10")
  65.    cvar_hp_kill_classic = register_cvar("amx_vip_addhp", "10")  
  66.    cvar_ap_kill_classic = register_cvar("amx_vip_addap", "10")
  67.    cvar_vip_maxhp = register_cvar("amx_vip_maxhp", "100")
  68.    cvar_vip_maxap = register_cvar("amx_vip_maxap", "100")  
  69.    mkb = register_cvar("money_kill_bonus","300")
  70.    mhb = register_cvar("money_hs_bonus","500")
  71.    cvar_vip_showC = register_cvar("amx_vip_show_chat", "1")
  72.    cvar_vip_showH = register_cvar("amx_vip_show_hud", "1")
  73.    
  74.  
  75.    set_task( 1.0, "TaskDisplayVips", _, _, _, "b", 0 )
  76.    SyncHudMessage = CreateHudSyncObj( )
  77.  
  78. }
  79.  
  80. public TaskDisplayVips( )
  81. {
  82.    if(get_pcvar_num(cvar_vip_showH))
  83.    {
  84.       static iPlayers[ 32 ];
  85.       static iPlayersNum;
  86.    
  87.       get_players( iPlayers, iPlayersNum, "ch" );
  88.       if( !iPlayersNum )
  89.          return 1;
  90.    
  91.       static iVipsConnected, szVipsNames[ 128 ], szName[ 32 ];
  92.       formatex( szVipsNames, sizeof ( szVipsNames ) -1, "" ); // Is this needed ?
  93.       iVipsConnected = 0;
  94.    
  95.       static id, i;
  96.       for( i = 0; i < iPlayersNum; i++ )
  97.       {
  98.          id = iPlayers[ i ];
  99.          if( get_user_flags( id ) & ADMIN_GOLD )
  100.          {
  101.             get_user_name( id, szName, sizeof ( szName ) -1 );
  102.          
  103.             add( szVipsNames, sizeof ( szVipsNames ) -1, szName );
  104.             add( szVipsNames, sizeof ( szVipsNames ) -1, "^n" );
  105.          
  106.             iVipsConnected++;
  107.          }
  108.       }
  109.    
  110.       formatex( g_szMessage, sizeof ( g_szMessage ) -1, "%s ( %i )^n%s",
  111.          g_szBeginning, iVipsConnected, szVipsNames );
  112.      
  113.       set_hudmessage( 25, 255, 25, 0.01, 0.25, 0, 0.0, 1.0, 0.1, 0.1, -1 );
  114.       ShowSyncHudMsg( 0, SyncHudMessage, g_szMessage );
  115.    }
  116.    return PLUGIN_CONTINUE;
  117.      
  118. }
  119.  
  120. public print_adminlist(user)
  121. {
  122.    if(get_pcvar_num(cvar_vip_showC))
  123.    {
  124.       new adminnames[33][32];
  125.       new message[256];
  126.       new id, count, x, len;
  127.  
  128.       for(id = 1 ; id <= get_maxplayers() ; id++)
  129.          if(is_user_connected(id))
  130.             if(get_user_flags(id) & ADMIN_GOLD || get_user_flags(id) & ADMIN_SILVER)
  131.                get_user_name(id, adminnames[count++], charsmax(adminnames[ ]));
  132.    
  133.       len = format(message, 255, "^3[%s] ^1VIP ACTIVE:^4 " ,tag);
  134.       if(count > 0)
  135.          {
  136.          for(x = 0 ; x < count ; x++)
  137.             {
  138.             len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count-1) ? ", ":"");
  139.             if(len > 96)
  140.             {
  141.                print_message(user, message);
  142.                len = format(message, 255, " ");
  143.             }
  144.             }
  145.          print_message(user, message);
  146.          }
  147.       else
  148.       {
  149.          ColorChat(0, GREEN, "^3[%s] ^1Momentan pe server nu se afla nici un ^4VIP^1 ACTIV .", tag);
  150.       }
  151.    }
  152.    return PLUGIN_CONTINUE;  
  153. }
  154.  
  155. print_message(id, msg[])
  156. {
  157.    message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, id);
  158.    write_byte(id);
  159.    write_string(msg);
  160.    message_end();
  161. }
  162.  
  163. public MessageScoreAttrib(iMsgID, iDest, iReceiver) // Display VIP pe TAB
  164. {
  165.        new iPlayer = get_msg_arg_int(1);
  166.        if(is_user_connected( iPlayer )
  167.        && (get_user_flags( iPlayer ) & ADMIN_GOLD))
  168.       {
  169.               set_msg_arg_int(2, ARG_BYTE, is_user_alive(iPlayer) ? SCOREATTRIB_VIP : SCOREATTRIB_DEAD);
  170.           }
  171. }
  172.  
  173. public in(id)    
  174. {
  175.    if(get_pcvar_num(cvar_vip_in_out))
  176.    {
  177.       new name[32];
  178.  
  179.       get_user_name(id, name, charsmax(name));
  180.  
  181.  
  182.       if(get_user_flags(id) & ADMIN_GOLD || get_user_flags(id) & ADMIN_SILVER)  
  183.       {
  184.          ColorChat(0, GREEN, "^3[%s] ^1VIP: ^4%s ^1s-a conectat.", tag, name);
  185.       }
  186.       return PLUGIN_HANDLED;
  187.    }
  188.    return PLUGIN_CONTINUE;
  189. }
  190.  
  191. public out(id)    
  192. {  
  193.    if(get_pcvar_num(cvar_vip_in_out))
  194.    {
  195.       new name[32];
  196.       get_user_name(id, name, charsmax(name));
  197.  
  198.       if(get_user_flags(id) & ADMIN_GOLD || get_user_flags(id) & ADMIN_SILVER)  
  199.       {
  200.          ColorChat(0, GREEN, "^3[%s] ^1VIP: ^4%s ^1s-a deconectat.", tag, name);
  201.       }
  202.       return PLUGIN_HANDLED;
  203.    }
  204.    return PLUGIN_CONTINUE;
  205. }
  206.  
  207. public client_connect(id) {
  208.    if(get_pcvar_num(Cvar_VIP) !=0 && !(get_user_flags(id) & ADMIN_SILVER))
  209.       set_user_flags(id,get_user_flags(id) + 262144)
  210. }
  211.  
  212. public client_PreThink(id)
  213. {
  214.    if(!is_user_alive(id))
  215.       return PLUGIN_CONTINUE;
  216.  
  217.    new BUTON = get_user_button(id)
  218.    new OLDBUTON = get_user_oldbutton(id)
  219.    new JUMP_VIP = get_pcvar_num(cvar_vip_jump)
  220.  
  221.    if((BUTON & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(OLDBUTON & IN_JUMP))
  222.    {
  223.       if(((get_user_flags(id) & ADMIN_GOLD) && (jumpnum[id] < JUMP_VIP)))
  224.       {
  225.          dojump[id] = true
  226.          jumpnum[id]++
  227.       }
  228.    }
  229.  
  230.    if((BUTON & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
  231.    {
  232.       jumpnum[id] = 0
  233.    }
  234.  
  235.    return PLUGIN_CONTINUE;
  236. }
  237.  
  238. public client_PostThink(id)
  239. {
  240.    if(!is_user_alive(id))
  241.       return PLUGIN_CONTINUE;
  242.  
  243.    if(dojump[id] == true)
  244.    {
  245.       new Float: velocity[3]  
  246.       entity_get_vector(id, EV_VEC_velocity, velocity)
  247.       velocity[2] = random_float(265.0, 285.0)
  248.       entity_set_vector(id, EV_VEC_velocity, velocity)
  249.       dojump[id] = false
  250.    }
  251.    return PLUGIN_CONTINUE;
  252. }
  253.  
  254. public client_putinserver(id)
  255. {  
  256.    set_task(2.0, "in", id)
  257.    jumpnum[id] = 0
  258.    dojump[id] = false
  259. }
  260.  
  261. public client_disconnect(id)
  262. {
  263.    set_task(2.0, "out", id)
  264.    jumpnum[id] = 0;
  265.    dojump[id] = false;
  266. }
  267.  
  268. public vip_info(id)
  269. {
  270.    show_motd(id, "/addons/amxmodx/configs/vip_info.html");
  271. }
  272.  
  273. public eDeathMsg()
  274. {
  275.    new id_Killer = read_data(1);
  276.    new VIP_MAXHP = get_pcvar_num(cvar_vip_maxhp);
  277.    new VIP_MAX_HP = get_user_health(id_Killer);
  278.    new VIP_MAXAP = get_pcvar_num(cvar_vip_maxap);
  279.    new VIP_MAX_AP = get_user_armor(id_Killer);
  280.  
  281.    if(is_user_alive(id_Killer))
  282.    {
  283.       if(get_user_flags(id_Killer) & ADMIN_GOLD && read_data(3) == 0)
  284.          {
  285.             set_user_health(id_Killer, get_user_health(id_Killer) + get_pcvar_num(cvar_hp_kill_premium));
  286.             set_user_armor(id_Killer, get_user_armor(id_Killer) + get_pcvar_num(cvar_ap_kill_premium));
  287.             cs_set_user_money(id_Killer,cs_get_user_money(id_Killer) + get_pcvar_num(mkb))
  288.          }
  289.       if(get_user_flags(id_Killer) & ADMIN_GOLD && read_data(3) == 1)
  290.          {
  291.             set_user_health(id_Killer, get_user_health(id_Killer) + get_pcvar_num(cvar_hp_kill_premium));
  292.             set_user_armor(id_Killer, get_user_armor(id_Killer) + get_pcvar_num(cvar_ap_kill_premium));
  293.             cs_set_user_money(id_Killer,cs_get_user_money(id_Killer) + get_pcvar_num(mhb))
  294.          }  
  295.       if(get_user_flags(id_Killer) & ADMIN_SILVER && read_data(3) == 1 && !(get_user_flags(id_Killer) & ADMIN_GOLD))
  296.          {
  297.             set_user_health(id_Killer, get_user_health(id_Killer) + get_pcvar_num(cvar_hp_kill_classic));
  298.             set_user_armor(id_Killer, get_user_armor(id_Killer) + get_pcvar_num(cvar_ap_kill_classic));
  299.             cs_set_user_money(id_Killer,cs_get_user_money(id_Killer) + get_pcvar_num(mhb))
  300.          }
  301.       if(get_user_flags(id_Killer) & ADMIN_SILVER && read_data(3) == 0 && !(get_user_flags(id_Killer) & ADMIN_GOLD))
  302.          {
  303.             cs_set_user_money(id_Killer,cs_get_user_money(id_Killer) + get_pcvar_num(mkb))
  304.          }
  305.    }
  306.    if(VIP_MAX_HP >= VIP_MAXHP)
  307.       {
  308.          set_user_health(id_Killer, get_pcvar_num(cvar_vip_maxhp));
  309.          return PLUGIN_HANDLED;
  310.       }
  311.    
  312.    if(VIP_MAX_AP >= VIP_MAXAP)
  313.       {
  314.          set_user_armor(id_Killer, get_pcvar_num(cvar_vip_maxap));
  315.          return PLUGIN_HANDLED;
  316.       }
  317.  
  318.    return PLUGIN_HANDLED;
  319. }
  320.  
  321. public GoldMenu( id )
  322. {
  323.    static menu;
  324.    menu = menu_create ("\rPRO-VIP GOLD \wGUN MENU","menu_gold");
  325.    
  326.    menu_additem ( menu,"\rM4A1 \y+ \wDeagle \y+ \wiTem Pack \r[PRO-VIP]","1", ADMIN_GOLD)
  327.    menu_additem ( menu,"\rAK47 \y+ \wDeagle \y+ \wiTem Pack \r[PRO-VIP]","2", ADMIN_GOLD)
  328.    menu_additem ( menu,"\rAWP \y+ \wDeagle \y+ \wiTem Pack \r[PRO-VIP]","3", ADMIN_GOLD)
  329.    
  330.    menu_setprop ( menu, MPROP_NUMBER_COLOR,"\y");
  331.    menu_setprop ( menu, MPROP_EXIT, MEXIT_ALL );
  332.    
  333.    menu_display ( id, menu, 0 );
  334.    return 0;
  335. }
  336.  
  337.  
  338. public menu_gold ( id, menu, item )
  339. {
  340.    if ( item == MENU_EXIT )
  341.    {
  342.       menu_destroy ( menu );
  343.       return 1;
  344.    }
  345.    
  346.    new data [ 6 ], szName [ 64 ];
  347.    new access, callback;
  348.    
  349.    menu_item_getinfo ( menu, item, access, data, charsmax ( data ), szName, charsmax ( szName ), callback );
  350.    
  351.    new key = str_to_num ( data );
  352.    
  353.    switch ( key )
  354.    {
  355.       case 1:
  356.       {
  357.          drop_weapons(id,1)
  358.          drop_weapons(id,2)
  359.          give_item(id, "weapon_hegrenade")
  360.          give_item(id, "weapon_flashbang")
  361.          cs_set_user_bpammo(id, CSW_FLASHBANG, 2)
  362.          give_item(id, "item_assaultsuit")
  363.          give_item(id, "item_thighpack")
  364.          give_item ( id,"weapon_deagle" );
  365.          cs_set_user_bpammo( id, CSW_DEAGLE, 35 );
  366.          give_item ( id,"weapon_m4a1" )
  367.          cs_set_user_bpammo( id, CSW_M4A1, 90 );
  368.          ColorChat(id, GREEN, "^3[%s]^1 Ai ales:^4 M4A1+Deagle+^3iTem Pack", tag);
  369.       }
  370.       case 2:
  371.       {
  372.          drop_weapons(id,1)
  373.          drop_weapons(id,2)
  374.          give_item(id, "weapon_hegrenade")
  375.          give_item(id, "weapon_flashbang")
  376.          cs_set_user_bpammo(id, CSW_FLASHBANG, 2)
  377.          give_item(id, "item_assaultsuit")
  378.          give_item(id, "item_thighpack")
  379.          give_item ( id,"weapon_deagle" );
  380.          cs_set_user_bpammo( id, CSW_DEAGLE, 35 );                
  381.          give_item ( id,"weapon_ak47" )
  382.          cs_set_user_bpammo( id, CSW_AK47, 90 )
  383.          ColorChat(id, GREEN, "^3[%s]^1 Ai ales:^4 AK47+Deagle+^3iTem Pack", tag);
  384.       }      
  385.       case 3:
  386.       {
  387.          drop_weapons(id,1)
  388.          drop_weapons(id,2)
  389.          give_item(id, "weapon_hegrenade")
  390.          give_item(id, "weapon_flashbang")
  391.          cs_set_user_bpammo(id, CSW_FLASHBANG, 2)
  392.          give_item(id, "item_assaultsuit")
  393.          give_item(id, "item_thighpack")
  394.          give_item ( id,"weapon_deagle" );
  395.          cs_set_user_bpammo( id, CSW_DEAGLE, 35 );                
  396.          give_item ( id,"weapon_awp" )
  397.          cs_set_user_bpammo( id, CSW_AWP, 30 )
  398.          ColorChat(id, GREEN, "^3[%s]^1 Ai ales:^4 AWP+Deagle+^3iTem Pack", tag);
  399.       }              
  400.    }
  401.    menu_destroy ( menu );
  402.    return 1;
  403. }
  404.  
  405.  
  406. public cmdSpawn(id) {
  407.    if(get_user_flags(id) & ADMIN_GOLD && is_user_alive(id)) {
  408.       if(Activare)
  409.          GoldMenu( id )
  410.    }
  411.    else if(get_user_flags(id) & ADMIN_SILVER && is_user_alive(id))
  412.    {
  413.       if(Activare)
  414.          SilverMenu( id )
  415.    }
  416.    
  417.    if(get_pcvar_num(Cvar_VIP) !=0 && !(get_user_flags(id) & ADMIN_SILVER))
  418.       set_user_flags(id,get_user_flags(id) + 262144)
  419. }
  420.  
  421. public SilverMenu ( id )
  422. {
  423.    static menu;
  424.    menu = menu_create ("\rPRO-VIP SILVER \wGUN MENU","menu_silver");
  425.    
  426.    menu_additem ( menu,"\rM4A1 \y+ \wDeagle \y+ \wiTem Pack \r[PRO-VIP]","1", ADMIN_SILVER)
  427.    menu_additem ( menu,"\rAK47 \y+ \wDeagle \y+ \wiTem Pack \r[PRO-VIP]","2", ADMIN_SILVER)
  428.  
  429.  
  430.    menu_setprop ( menu, MPROP_NUMBER_COLOR,"\y");
  431.    menu_setprop ( menu, MPROP_EXIT, MEXIT_ALL );
  432.    
  433.    menu_display ( id, menu, 0 );
  434.    return 0;
  435. }
  436.  
  437.  
  438. public menu_silver ( id, menu, item )
  439. {
  440.    if ( item == MENU_EXIT )
  441.    {
  442.       menu_destroy ( menu );
  443.       return 1;
  444.    }
  445.    
  446.    new data [ 6 ], szName [ 64 ];
  447.    new access, callback;
  448.    
  449.    menu_item_getinfo ( menu, item, access, data, charsmax ( data ), szName, charsmax ( szName ), callback );
  450.    
  451.    new key = str_to_num ( data );
  452.    
  453.    switch ( key )
  454.    {
  455.       case 1:
  456.       {
  457.          drop_weapons(id,1)
  458.          drop_weapons(id,2)
  459.          give_item(id, "weapon_hegrenade")
  460.          give_item(id, "weapon_flashbang")
  461.          cs_set_user_bpammo(id, CSW_FLASHBANG, 2)
  462.          give_item(id, "item_assaultsuit")
  463.          give_item(id, "item_thighpack")
  464.          give_item ( id,"weapon_deagle" )
  465.          cs_set_user_bpammo( id, CSW_DEAGLE, 35 )              
  466.          give_item ( id,"weapon_m4a1" )
  467.          cs_set_user_bpammo( id, CSW_M4A1, 90 )
  468.          ColorChat(id, GREEN, "^3[%s]^1 Ai ales:^4 M4A1+Deagle+^3iTem Pack", tag);
  469.       }
  470.       case 2:
  471.       {
  472.          drop_weapons(id,1)
  473.          drop_weapons(id,2)
  474.          give_item(id, "weapon_hegrenade")
  475.          give_item(id, "weapon_flashbang")
  476.          cs_set_user_bpammo(id, CSW_FLASHBANG, 2)
  477.          give_item(id, "item_assaultsuit")
  478.          give_item(id, "item_thighpack")
  479.          give_item ( id,"weapon_deagle" )
  480.          cs_set_user_bpammo( id, CSW_DEAGLE, 35 )                
  481.          give_item ( id,"weapon_ak47" )
  482.          cs_set_user_bpammo( id, CSW_AK47, 90 )
  483.      ColorChat(id, GREEN, "^3[%s]^1 Ai ales:^4 AK47+Deagle+^3iTem Pack", tag);
  484.       }              
  485.    }
  486.    menu_destroy ( menu );
  487.    return PLUGIN_HANDLED
  488. }
  489.  
  490. public RoundStart( )
  491. {
  492.    Contor++
  493.    if(Contor >= Runda_Arme)
  494.       Activare = true
  495.      
  496. }
  497. stock drop_weapons(id, dropwhat)
  498. {
  499.    static Weapons[32], Num, i, WeaponID;
  500.    Num = 0;
  501.    get_user_weapons(id, Weapons, Num);
  502.    for(i = 0; i < Num; i ++)
  503.    {
  504.       WeaponID = Weapons[i];
  505.       if((dropwhat == 1 && ((1 << WeaponID) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == 2 && ((1 << WeaponID) & SECONDARY_WEAPONS_BIT_SUM )))
  506.       {
  507.          static DropName[32], WeaponEntity;
  508.          get_weaponname(WeaponID, DropName, charsmax(DropName));
  509.          WeaponEntity = fm_find_ent_by_owner(-1, DropName, id);
  510.          set_pev(WeaponEntity, pev_iuser1, cs_get_user_bpammo (id, WeaponID));
  511.          engclient_cmd(id, "drop", DropName);
  512.          cs_set_user_bpammo(id, WeaponID, 0);
  513.       }
  514.    }
  515. }
  516.  
  517. #pragma tabsize 0
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top