hlmod.hu
https://hlmod.hu/

Secondary fegyvercsomag hozzáírás
https://hlmod.hu/viewtopic.php?f=9&t=23356
Oldal: 1 / 1

Szerző:  attila2660 [2015.12.31. 12:48 ]
Hozzászólás témája:  Secondary fegyvercsomag hozzáírás

Sziasztok valaki hozzá tudna írni egy secondary fegyvercsomagot ami ugyan olyan színű mint az első oldal? Csak persze elsőként kiválasztják a nagyobb kaliberű fegyvert utána rögtön bedobja őket a pisztolyválasztáshoz kiválasztják ez a 2-őt és ennyi. Itt az SMA:

  1. #include < amxmodx >
  2.  #include < amxmisc >
  3.  #include < fun >
  4.  #include < fakemeta >
  5.  #include < cstrike >
  6.  #include < hamsandwich >
  7.  #include < chatcolor >
  8.  
  9.  #pragma semicolon 1
  10.  
  11.  #define VERSION "0.0.1"
  12.  
  13.  #define Max_Players 32
  14.  
  15.  #define OFFSET_PRIMARYWEAPON 116
  16.  #define OFFSET_C4_SLOT 372
  17.  
  18.  #define Weapon_Menu_Name "Fegyver Csomagok"
  19.  
  20.  #define Next_Button "Következő"
  21.  #define Back_Button "Vissza"
  22.  #define Exit_Button "Kilépés"
  23.  
  24.  #define Money_Hud ( 1 << 5 )
  25.  
  26.  new g_iWPCT;
  27.  new g_iWPTE;
  28.  
  29.  new pCvarMaxCTWps;
  30.  new pCvarMaxTEWps;
  31.  
  32.  new pCvarWPBlock;
  33.  
  34.  new pCvarFlash;
  35.  new pCvarHe;
  36.  new pCvarSmoke;
  37.  
  38.  new pCvarKevlar;
  39.  new pCvarDefuser;
  40.  
  41.  new pCvarPrefix;
  42.  new pCvarMoney;
  43.  new pCvarBlockBuy;
  44.  new pCvarUnAmmo;
  45.  new pCvarweapnew;
  46.  
  47.  new const g_szMessages [ ] [ ] =
  48.  {
  49.  "",
  50.  "^1Csapatonként csak két ember AWP-zhet.",
  51.  "^4%s ^1AWP csak ^44v4-től ^1használható.",
  52.  "^1A vásárlás letiltva.",
  53.  "^1Te már választottál fegyvert."
  54.  };
  55.  
  56.  new const g_szWeaponMenuNames [ ] [ ] = {
  57.  
  58.  "M4A1 Csomag",
  59.  "AK47 Csomag",
  60.  "AWP Csomag",
  61.  "M249 Csomag",
  62.  "AUG Csomag",
  63.  "Famas Csomag",
  64.  "Galil Csomag",
  65.  "MP5 Csomag",
  66.  "XM1014 Csomag",
  67.  "M3 Csomag",
  68.  "Scout Csomag"
  69.  };
  70.  
  71.  new const g_szWeaponsName [ ] [ ] = {
  72.  
  73.  "weapon_m4a1",
  74.  "weapon_ak47",
  75.  "weapon_awp",
  76.  "weapon_m249",
  77.  "weapon_aug",
  78.  "weapon_famas",
  79.  "weapon_galil",
  80.  "weapon_mp5navy",
  81.  "weapon_xm1014",
  82.  "weapon_m3",
  83.  "weapon_scout"
  84.  };
  85.  
  86.  new const g_szPistolName [ ] = "weapon_deagle";
  87.  
  88.  const DoNotReload = ( ( 1 << CSW_HEGRENADE ) | ( 1 << CSW_SMOKEGRENADE ) | ( 1 << CSW_FLASHBANG ) | ( 1 << CSW_KNIFE ) | ( 1 << CSW_C4 ) );
  89.  new const maxAmmo[ 31 ] = {
  90.  
  91.  0,
  92.  52,
  93.  0,
  94.  90,
  95.  1,
  96.  32,
  97.  1,
  98.  100,
  99.  90,
  100.  1,
  101.  120,
  102.  100,
  103.  100,
  104.  90,
  105.  90,
  106.  90,
  107.  100,
  108.  120,
  109.  30,
  110.  120,
  111.  200,
  112.  32,
  113.  90,
  114.  120,
  115.  90,
  116.  2,
  117.  35,
  118.  90,
  119.  90,
  120.  0,
  121.  100
  122.  };
  123.  
  124.  new g_szBuyCommands[ ][ ] =
  125.  {
  126.  "usp", "glock", "deagle", "p228", "elites", "fn57", "m3", "xm1014", "mp5", "tmp", "p90", "mac10", "ump45", "ak47",
  127.  "galil", "famas", "sg552", "m4a1", "aug", "scout", "awp", "g3sg1", "sg550", "m249", "vest", "vesthelm", "flash", "hegren",
  128.  "sgren", "defuser", "nvgs", "shield", "primammo", "secammo", "km45", "9x19mm", "nighthawk", "228compact", "12gauge",
  129.  "autoshotgun", "smg", "mp", "c90", "cv47", "defender", "clarion", "krieg552", "bullpup", "magnum", "d3au1", "krieg550",
  130.  "buyammo1", "buyammo2"
  131.  };
  132.  
  133.  new const g_szMenuCommands[ ] [ ] =
  134.  {
  135.  "say /fegyver",
  136.  "say_team /fegyver"
  137.  
  138.  };
  139.  
  140.  new g_szChatPrefix[ 64 ];
  141.  new g_msgHideWeapon;
  142.  new g_bHasWeapon[ Max_Players ];
  143.  
  144.  public plugin_init ( ) {
  145.  
  146.  register_plugin( "Advanced Weapon Menu", VERSION, "#YouCantStopMe" );
  147.  
  148.  RegisterHam( Ham_Spawn, "player", "func_OpenWeaponMenu", 1 );
  149.  
  150.  pCvarMaxCTWps = register_cvar( "awm_max_ct_awp", "2" ); // Ct-nél 2 AWP-s lehet.
  151.  pCvarMaxTEWps = register_cvar( "awm_max_te_awp", "2" ); // Terroristáknál 2 AWP-s lehet.
  152.  
  153.  pCvarWPBlock = register_cvar( "awm_allow_wp_player", "4" ); // Ha mindkét csapatban van 4-4 játékos akkor engedi az AWP-t
  154.  
  155.  pCvarFlash = register_cvar( "awm_give_flash", "2" ); // Itt tudod beállítani ,hogy adjon-e füst gránátot. ( 0 = Nem ad ) Alap: 2 Flash gránát
  156.  pCvarHe = register_cvar( "awm_give_he", "1" ); // Itt tudod beállítani ,hogy adjon-e füst gránátot. ( 0 = Nem ad ) Alap: 1 Robanó gránát
  157.  pCvarSmoke = register_cvar( "awm_give_smoke", "0" ); // Itt tudod beállítani ,hogy adjon-e füst gránátot. ( 0 = Nem ad )
  158.  
  159.  pCvarKevlar = register_cvar( "awm_give_kevlar", "2" ); // Itt tudod beállítani ,hogy adjon-e kevlárt. ( 0 = Nem Ad ) Alap: 2 ( Kevlár + Sisak )
  160.  pCvarDefuser = register_cvar( "awm_give_defuser", "1" ); // Itt tudod beállítani ,hogy adjon-e defusert. ( 0 = Nem Ad )
  161.  
  162.  pCvarUnAmmo = register_cvar( "awm_unlimited_ammo", "1" ); // Itt tudod beállítani ,hogy elfoggyon-e a tár vagy ne. Alap: 1 ( Tehát nem fogy el a tár )
  163.  
  164.  pCvarBlockBuy = register_cvar( "awm_block_buy", "1" ); // Itt tudod beállítani ,hogy tiltsa-e a vásárlást vagy ne. Alap 1 ( Tehát tiltva van ) ( 0 = Nincs tiltva )
  165.  pCvarMoney = register_cvar( "awm_set_money", "0" ); // Itt tudod beállítani ,hogy mennyi pénze legyen a játékosoknak. ( 0 = Nincs , eltűnik a hudról is ) Alap: 0
  166.  pCvarPrefix = register_cvar( "awm_prefix", "SzerverPrefix" ); // Itt tudod beállítani, hogy mi legyen a Fegyvermenü prefix-je.
  167.  
  168.  pCvarweapnew = register_cvar( "awm_ujfegyver", "1");
  169.  
  170.  g_msgHideWeapon = get_user_msgid( "HideWeapon" );
  171.  
  172.  for( new i = 0; i < sizeof( g_szBuyCommands ); i++ )
  173.  register_clcmd( g_szBuyCommands[ i ], "cmd_BlockBuy" );
  174.  
  175.  for( new i = 0; i < sizeof( g_szMenuCommands ); i++ )
  176.  register_clcmd( g_szMenuCommands[ i ], "cmd_ShowWeaponMenu" );
  177.  
  178.  register_event( "ResetHUD", "onResetHUD", "b" );
  179.  register_event( "CurWeapon", "eCurWeapon", "be", "1=1" );
  180.  
  181.  register_message( g_msgHideWeapon, "msgHideWeapon" );
  182.  
  183.  register_logevent( "eRoundEnd", 2, "1=Round_End" );
  184.  }
  185.  
  186.  public client_connect( iClient ) {
  187.  
  188.  g_bHasWeapon[ iClient ] = false;
  189.  }
  190.  
  191.  public client_disconnect( iClient ) {
  192.  
  193.  g_bHasWeapon[ iClient ] = false;
  194.  }
  195.  
  196.  public cmd_ShowWeaponMenu( iClient ) {
  197.  
  198.  if( !get_pcvar_num(pCvarweapnew) ) {
  199.  switch( g_bHasWeapon[ iClient ] ) {
  200.  
  201.  case true:
  202.  {
  203.  get_pcvar_string( pCvarPrefix, g_szChatPrefix, charsmax( g_szChatPrefix ) );
  204.  client_print_color( iClient, Red, "^3%s %s" , g_szChatPrefix, g_szMessages[ 4 ] );
  205.  
  206.  return PLUGIN_HANDLED;
  207.  }
  208.  case false: func_OpenWeaponMenu( iClient );
  209.  }
  210.  }
  211.  else {
  212.  func_OpenWeaponMenu( iClient );
  213.  }
  214.  return PLUGIN_HANDLED;
  215.  }
  216.  
  217.  public cmd_BlockBuy( iClient ) {
  218.  
  219.  if( !get_pcvar_num( pCvarBlockBuy ) )
  220.  return PLUGIN_CONTINUE;
  221.  
  222.  get_pcvar_string( pCvarPrefix, g_szChatPrefix, charsmax( g_szChatPrefix ) );
  223.  client_print_color( iClient, Red, "^3%s %s" , g_szChatPrefix, g_szMessages[ 3 ] );
  224.  return PLUGIN_HANDLED;
  225.  }
  226.  
  227.  public eCurWeapon( iClient ) {
  228.  
  229.  if( get_pcvar_num( pCvarUnAmmo ) ) {
  230.  
  231.  if( is_user_alive( iClient ) ) {
  232.  
  233.  new weapon = read_data( 2 );
  234.  if( !( DoNotReload & ( 1 << weapon ) ) ) {
  235.  
  236.  cs_set_user_bpammo( iClient, weapon, maxAmmo[ weapon ] );
  237.  }
  238.  }
  239.  }
  240.  }
  241.  
  242.  public onResetHUD( iClient ) {
  243.  
  244.  if( !get_pcvar_num( pCvarMoney ) ) {
  245.  
  246.  message_begin( MSG_ONE, g_msgHideWeapon, _, iClient );
  247.  write_byte( Money_Hud );
  248.  message_end( );
  249.  }
  250.  }
  251.  
  252.  public msgHideWeapon( ) {
  253.  
  254.  if( !get_pcvar_num( pCvarMoney ) ) {
  255.  
  256.  set_msg_arg_int( 1, ARG_BYTE, get_msg_arg_int( 1 ) | Money_Hud );
  257.  }
  258.  }
  259.  
  260.  public eRoundEnd ( ) {
  261.  
  262.  g_iWPCT = 0;
  263.  g_iWPTE = 0;
  264.  }
  265.  
  266.  public func_OpenWeaponMenu ( iClient ) {
  267.  
  268.  if( !is_user_alive( iClient ) )
  269.  return;
  270.  
  271.  cs_set_user_money( iClient, get_pcvar_num( pCvarMoney ) );
  272.  
  273.  get_pcvar_string( pCvarPrefix, g_szChatPrefix, charsmax( g_szChatPrefix ) );
  274.  
  275.  g_bHasWeapon[ iClient ] = false;
  276.  
  277.  new szMenuTitle[ 121 ];
  278.  new szMenuItem[ 121 ];
  279.  
  280.  format( szMenuTitle, charsmax( szMenuTitle ), "\r%s^n\w%s", g_szChatPrefix, Weapon_Menu_Name );
  281.  
  282.  StripUserWeapons( iClient );
  283.  new menu = menu_create( szMenuTitle, "func_OpenWeaponMenu_handler" );
  284.  
  285.  for( new i = 0; i < sizeof( g_szWeaponMenuNames ); i++ ) {
  286.  
  287.  if( i != 2 ) {
  288.  
  289.  format( szMenuItem, charsmax( szMenuItem ), "\r[\y%s\r]", g_szWeaponMenuNames[ i ] );
  290.  }
  291.  else {
  292.  switch( get_user_team( iClient ) )
  293.  {
  294.  case 1: format( szMenuItem, charsmax( szMenuItem ), "\r[\y%s\r] [\yElső %d embernek\r]", g_szWeaponMenuNames[ i ], get_pcvar_num( pCvarMaxTEWps ) );
  295.  case 2: format( szMenuItem, charsmax( szMenuItem ), "\r[\y%s\r] [\yElső %d embernek\r]", g_szWeaponMenuNames[ i ], get_pcvar_num( pCvarMaxCTWps ) );
  296.  default: continue;
  297.  }
  298.  }
  299.  
  300.  menu_additem( menu, szMenuItem, _, 0 );
  301.  }
  302.  
  303.  menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
  304.  menu_setprop( menu, MPROP_BACKNAME, Back_Button );
  305.  menu_setprop( menu, MPROP_NEXTNAME, Next_Button );
  306.  menu_setprop( menu, MPROP_EXITNAME, Exit_Button );
  307.  menu_display( iClient, menu );
  308.  }
  309.  
  310.  public func_OpenWeaponMenu_handler( iClient, iMenu, iItem ) {
  311.  
  312.  if( iItem == MENU_EXIT ) {
  313.  
  314.  menu_destroy( iMenu );
  315.  return PLUGIN_HANDLED;
  316.  }
  317.  
  318.  new data[ 6 ], szName[ 64 ];
  319.  new access, callback;
  320.  menu_item_getinfo( iMenu, iItem, access, data, charsmax( data ), szName, charsmax( szName ), callback );
  321.  
  322.  get_pcvar_string( pCvarPrefix, g_szChatPrefix, charsmax( g_szChatPrefix ) );
  323.  
  324.  if( iItem != 2 ) {
  325.  
  326.  give_item( iClient, g_szWeaponsName[ iItem ] );
  327.  give_item( iClient, g_szPistolName );
  328.  
  329.  client_print_color( iClient, Red, "^4%s ^1Te az ^4%sot ^1választottad!", g_szChatPrefix, g_szWeaponMenuNames[ iItem ] );
  330.  }
  331.  else {
  332.  
  333.  new iTeams[ CsTeams ];
  334.  GetPlayerCount( iTeams );
  335.  
  336.  if( iTeams[ CS_TEAM_T ] < get_pcvar_num( pCvarWPBlock )
  337.  || iTeams[ CS_TEAM_CT ] < get_pcvar_num( pCvarWPBlock ) ) {
  338.  
  339.  client_print_color( iClient, Red, g_szMessages[ 2 ], g_szChatPrefix );
  340.  func_OpenWeaponMenu( iClient );
  341.  
  342.  return PLUGIN_HANDLED;
  343.  }
  344.  
  345.  new CsTeams:userTeam = cs_get_user_team( iClient );
  346.  if( userTeam == CS_TEAM_CT ) {
  347.  
  348.  if( g_iWPCT < get_pcvar_num( pCvarMaxCTWps ) ) {
  349.  
  350.  give_item( iClient, g_szWeaponsName[ iItem ] );
  351.  give_item( iClient, g_szPistolName );
  352.  
  353.  client_print_color( iClient, Red, "^4%s ^1Te az ^4%sot ^1választottad!", g_szChatPrefix, g_szWeaponMenuNames[ iItem ] );
  354.  g_iWPCT++;
  355.  }
  356.  else {
  357.  
  358.  client_print( iClient, print_center, g_szMessages[ 1 ] );
  359.  func_OpenWeaponMenu ( iClient );
  360.  
  361.  return PLUGIN_HANDLED;
  362.  }
  363.  }
  364.  
  365.  if( userTeam == CS_TEAM_T ) {
  366.  
  367.  if( g_iWPTE < get_pcvar_num( pCvarMaxTEWps ) ) {
  368.  
  369.  
  370.  give_item( iClient, g_szWeaponsName[ iItem ] );
  371.  give_item( iClient, g_szPistolName );
  372.  
  373.  client_print_color( iClient, Red, "^4%s ^1Te az ^4%sot ^1választottad!", g_szChatPrefix, g_szWeaponMenuNames[ iItem ] );
  374.  g_iWPTE++;
  375.  }
  376.  else {
  377.  
  378.  client_print( iClient, print_center, g_szMessages[ 1 ] );
  379.  func_OpenWeaponMenu( iClient );
  380.  
  381.  return PLUGIN_HANDLED;
  382.  }
  383.  }
  384.  }
  385.  
  386.  give_item( iClient, "weapon_knife" );
  387.  give_player_stuff( iClient );
  388.  
  389.  menu_destroy( iMenu );
  390.  return PLUGIN_HANDLED;
  391.  }
  392.  
  393.  GetPlayerCount( iTeamPlayers[ CsTeams ] ) {
  394.  
  395.  new iPlayers[ 32 ] , iPlayerCount;
  396.  
  397.  get_players( iPlayers , iPlayerCount );
  398.  
  399.  for ( new i = 0 ; i < iPlayerCount ; i++ )
  400.  iTeamPlayers[ cs_get_user_team( iPlayers[ i ] ) ]++;
  401.  }
  402.  
  403.  stock give_player_stuff( iClient ) {
  404.  
  405.  if( get_pcvar_num( pCvarFlash ) ) {
  406.  
  407.  give_item( iClient, "weapon_flashbang" );
  408.  cs_set_user_bpammo( iClient, CSW_FLASHBANG, get_pcvar_num( pCvarFlash ) );
  409.  }
  410.  
  411.  if( get_pcvar_num( pCvarHe ) ) {
  412.  
  413.  give_item( iClient, "weapon_hegrenade" );
  414.  cs_set_user_bpammo( iClient, CSW_HEGRENADE, get_pcvar_num( pCvarHe ) );
  415.  }
  416.  
  417.  if( get_pcvar_num( pCvarSmoke ) ) {
  418.  
  419.  give_item( iClient, "weapon_smokegrenade" );
  420.  cs_set_user_bpammo( iClient, CSW_SMOKEGRENADE, get_pcvar_num( pCvarSmoke ) );
  421.  }
  422.  
  423.  if( get_pcvar_num( pCvarKevlar ) ) {
  424.  
  425.  switch( get_pcvar_num( pCvarKevlar ) ) {
  426.  
  427.  case 1: give_item( iClient, "item_kevlar" );
  428.  case 2: give_item( iClient, "item_assaultsuit" );
  429.  default: return PLUGIN_CONTINUE;
  430.  }
  431.  }
  432.  
  433.  if( get_pcvar_num( pCvarDefuser ) ) {
  434.  
  435.  give_item( iClient, "item_thighpack" );
  436.  }
  437.  
  438.  if( !get_pcvar_num( pCvarUnAmmo ) ) {
  439.  
  440.  new weapons[ 32 ];
  441.  new weaponsnum;
  442.  get_user_weapons( iClient, weapons, weaponsnum );
  443.  for( new i = 0; i < weaponsnum; i++ )
  444.  if( is_user_alive( iClient ) )
  445.  if( maxAmmo[ weapons[ i ] ] > 0 )
  446.  cs_set_user_bpammo( iClient, weapons[ i ], maxAmmo[ weapons[ i ] ] );
  447.  }
  448.  
  449.  g_bHasWeapon[ iClient ] = true;
  450.  return PLUGIN_CONTINUE;
  451.  }
  452.  
  453.  
  454.  //Stolen from CSDM Weapon Menu
  455.  stock StripUserWeapons( iClient ) {
  456.  
  457.  new iC4Ent = get_pdata_cbase( iClient, OFFSET_C4_SLOT );
  458.  
  459.  if( iC4Ent > 0 ) {
  460.  
  461.  set_pdata_cbase( iClient, OFFSET_C4_SLOT, FM_NULLENT );
  462.  }
  463.  
  464.  strip_user_weapons( iClient );
  465.  set_pdata_int( iClient, OFFSET_PRIMARYWEAPON, 0 );
  466.  
  467.  if( iC4Ent > 0 ) {
  468.  
  469.  set_pev( iClient, pev_weapons, pev( iClient, pev_weapons ) | ( 1 << CSW_C4 ) );
  470.  set_pdata_cbase( iClient, OFFSET_C4_SLOT, iC4Ent );
  471.  
  472.  cs_set_user_bpammo( iClient, CSW_C4, 1 );
  473.  cs_set_user_plant( iClient, 1 );
  474.  }
  475.  
  476.  return PLUGIN_HANDLED;
  477.  }
  478. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  479. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
  480. */

Szerző:  lada xp [2016.01.01. 01:25 ]
Hozzászólás témája:  Re: Secondary fegyvercsomag hozzáírás

Parancsolj:
(Figyelem! Az eredeti téma rar fájlában is megtalálhato.)

Csatolmányok:
weapon_menu_with_pistols.sma [13.96KiB]
Letöltve 56 alkalommal.

Szerző:  attila2660 [2016.01.01. 13:01 ]
Hozzászólás témája:  Re: Secondary fegyvercsomag hozzáírás

Köszi!

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/