hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2025.06.21. 06:18



Jelenlévő felhasználók

Jelenleg 389 felhasználó van jelen :: 3 regisztrált, 0 rejtett és 386 vendég

A legtöbb felhasználó (2761 fő) 2025.01.09. 20:06-kor tartózkodott itt.

Regisztrált felhasználók: Bing [Bot], Google [Bot], Majestic-12 [Bot]az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása Hozzászólás a témához  [16 hozzászólás ]  Oldal12Következő
Szerző Üzenet
 Hozzászólás témája: shop plugin átírás
HozzászólásElküldve:2012.02.11. 08:56 
Offline
Őskövület
Avatar

Csatlakozott:2011.09.26. 20:33
Hozzászólások:2105
Megköszönt másnak: 28 alkalommal
Megköszönték neki: 33 alkalommal
hi
ezt a plugint kéne átírni úgy hogy több player modellt lehessen választani akár ne csak az alapokat
thx

Kód:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#include <fun>

#if defined UL_COMPAT
   #include <money_ul>
#endif

/*================================================================================
 [Defines & Variables]
=================================================================================*/

// Plugin Info
#define PLUGIN_NAME "CS Shop"
#define PLUGIN_VERS "5.0"
#define PLUGIN_AUTH "iNeedHelp" // Old Name :(

// Weapons BitSum (drop stocks)
#define PRIMARY_WEAPONS_BITSUM ((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))

// Max Players
#define MAX_PLAYERS   32

// Compatibility with Unlimited Money
#if defined UL_COMPAT
   #define get_user_money(%1) cs_get_user_money_ul(%1)
   #define set_user_money(%1,%2) cs_set_user_money_ul(%1,%2)
#else
   #define set_user_money(%1,%2) cs_set_user_money(%1,%2)
   #define get_user_money(%1) cs_get_user_money(%1)
#endif

// Pointers
new g_pGravityCvarPointer

// Main Cvars
new g_pCvarEnable
new g_pCvarMessage
new g_pCvarPrefix

// Menu Cvars
new g_pMenuEnableCvars[7]

new g_pCtGunsMenuCvars[6]
new g_pTeGunsMenuCvars[5]

new g_pInvisibilityMenuCvars[3]
new g_pGravityMenuCvars[4]
new g_pHealthMenuCvars[4]
new g_pSpeedMenuCvars[5]
new g_pSkinsMenuCvars[2]

// Menu vars
new g_iHasSpeed[MAX_PLAYERS+1] = { -1, ... }         
new bool:g_bHasCustomModel[MAX_PLAYERS+1] = { false, ... }   

// Menus Items
new g_szMainShopMenu[][] =
{
   "CT's Guns",
   "T's Guns",
   "Invisibility Menu",
   "Gravity Menu",
   "Health Menu",
   "Speed Menu",
   "Skins Menu"
}

new g_szCTGunsMenu[][] =
{
   "M4A1",
   "Bullpup",
   "TMP",
   "Five Seven",
   "Famas",
   "Shield"
}

new g_szTGunsMenu[][] =
{
   "Ak 47",
   "Krieg 552",
   "Mac 10",
   "Dual Elites",
   "Galil"
}

new g_szInvisibilityMenu[][] =
{
   "Low Invisibility",
   "Medium Invisibility",
   "High Invisibility"
}

new g_szGravityMenu[][] =
{
   "500 Gravity",
   "400 Gravity",
   "300 Gravity",
   "200 Gravity"
}

new g_szHealthMenu[][] =
{
   "+15 Health",
   "+35 Health",
   "+65 Health",
   "+95 Health"
}

new g_szSpeedMenu[][] =
{
   "260 Speed",
   "300 Speed",
   "340 Speed",
   "380 Speed",
   "420 Speed"
}

new g_szSkinsMenu[][] =
{
   "Terrorist Skin",
   "Counter-Terrorist Skin"
}

// Menus Data
new g_szCTGunsWeapons[][] =
{
   "weapon_m4a1",
   "weapon_aug",
   "weapon_tmp",
   "weapon_fiveseven",
   "weapon_famas",
   "weapon_shield"
}

new g_szTGunsWeapons[][] =
{
   "weapon_ak47",
   "weapon_sg552",
   "weapon_mac10",
   "weapon_elite",
   "weapon_galil"
}

new g_szCTGunsAmmo[][] = { "556nato", "556nato", "9mm", "57mm", "556nato" }
new g_szTGunsAmmo[][] = { "762nato", "556nato", "45acp", "9mm", "556nato" }

new g_iCTGunsLoad[] = { 90, 90, 120, 100, 90 }
new g_iTGunsLoad[] = { 90, 90, 100, 120, 90 }

new g_iCTGunsMaxAmmo[] = { 90, 90, 120, 100, 90 }
new g_iTGunsMaxAmmo[] = { 90, 90, 100, 120, 90 }

new g_iInvisibilityLevel[] = { 150, 100, 25 }
new g_iHealthLevel[] = { 15, 35, 65, 95 }

new Float:g_flGravityLevel[] = { 500.0, 400.0, 300.0, 200.0 }
new Float:g_flSpeedLevel[] = { 260.0, 300.0, 340.0, 380.0, 420.0 }

new g_szSkinsName[][] = { "gign", "leet" }

// Message Hooks
new g_iMsgSayText

// Others
new const g_szShopFile[] = "shop.cfg";   // Shop file

/*================================================================================
 [Init]
=================================================================================*/

public plugin_init()
{
   register_plugin(PLUGIN_NAME, PLUGIN_VERS, PLUGIN_AUTH)
   
   // Multi-Lingual
   register_dictionary("shop.txt")
   
   // Commands
   register_clcmd("say /shop", "ClCmd_Say")
   register_clcmd("say_team /shop", "ClCmd_Say")
   
   // Ham Forwards
   RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1)
   
   // FM Forwards
   register_forward(FM_SetClientKeyValue, "Fwd_SetClientKeyValue")
   
   // Events
   register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
   
   // Variables....
   
   // Messages Hooks
   g_iMsgSayText         = get_user_msgid("SayText")
   
   // Cvars
   g_pGravityCvarPointer      = get_cvar_pointer("sv_gravity")
   
   g_pCvarEnable          = register_cvar("amx_shop_enable", "1")
   g_pCvarMessage          = register_cvar("amx_shop_msg", "1")
   g_pCvarPrefix         = register_cvar("amx_shop_prefix", "[CS Shop]")
   
   g_pMenuEnableCvars[0]       = register_cvar("amx_shop_ct", "1")
   g_pCtGunsMenuCvars[0]       = register_cvar("amx_shop_m4a1", "3100")
   g_pCtGunsMenuCvars[1]       = register_cvar("amx_shop_bullpup", "3500")
   g_pCtGunsMenuCvars[2]       = register_cvar("amx_shop_tmp", "1250")
   g_pCtGunsMenuCvars[3]       = register_cvar("amx_shop_fiveseven", "750")
   g_pCtGunsMenuCvars[4]       = register_cvar("amx_shop_famas", "2250")
   g_pCtGunsMenuCvars[5]       = register_cvar("amx_shop_shield", "2200")
   
   g_pMenuEnableCvars[1]       = register_cvar("amx_shop_t", "1")
   g_pTeGunsMenuCvars[0]       = register_cvar("amx_shop_ak47", "2500")
   g_pTeGunsMenuCvars[1]       = register_cvar("amx_shop_sg552", "3500")
   g_pTeGunsMenuCvars[2]       = register_cvar("amx_shop_mac10", "1400")
   g_pTeGunsMenuCvars[3]       = register_cvar("amx_shop_elites", "800")
   g_pTeGunsMenuCvars[4]       = register_cvar("amx_shop_galil", "2000")
   
   g_pMenuEnableCvars[2]       = register_cvar("amx_shop_invis", "1")
   g_pInvisibilityMenuCvars[0]    = register_cvar("amx_shop_low", "3000")
   g_pInvisibilityMenuCvars[1]    = register_cvar("amx_shop_medium", "6000")
   g_pInvisibilityMenuCvars[2]    = register_cvar("amx_shop_high", "12000")
   
   g_pMenuEnableCvars[3]       = register_cvar("amx_shop_grav", "1")
   g_pGravityMenuCvars[0]       = register_cvar("amx_shop_g500", "1500")
   g_pGravityMenuCvars[1]       = register_cvar("amx_shop_g400", "3000")
   g_pGravityMenuCvars[2]       = register_cvar("amx_shop_g300", "4500")
   g_pGravityMenuCvars[3]       = register_cvar("amx_shop_g200", "6000")
   
   g_pMenuEnableCvars[4]       = register_cvar("amx_shop_hp", "1")
   g_pHealthMenuCvars[0]       = register_cvar("amx_shop_15hp", "1500")
   g_pHealthMenuCvars[1]       = register_cvar("amx_shop_35hp", "3000")
   g_pHealthMenuCvars[2]       = register_cvar("amx_shop_65hp", "6000")
   g_pHealthMenuCvars[3]       = register_cvar("amx_shop_95hp", "7500")
      
   g_pMenuEnableCvars[5]       = register_cvar("amx_shop_speed", "1")
   g_pSpeedMenuCvars[0]       = register_cvar("amx_shop_260speed", "3000")
   g_pSpeedMenuCvars[1]       = register_cvar("amx_shop_300speed", "6000")
   g_pSpeedMenuCvars[2]       = register_cvar("amx_shop_340speed", "9000")
   g_pSpeedMenuCvars[3]       = register_cvar("amx_shop_380speed", "12000")
   g_pSpeedMenuCvars[4]       = register_cvar("amx_shop_420speed", "15000")
   
   g_pMenuEnableCvars[6]       = register_cvar("amx_shop_skins", "1")
   g_pSkinsMenuCvars[0]       = register_cvar("amx_shop_tskin", "9000")
   g_pSkinsMenuCvars[1]       = register_cvar("amx_shop_ctskin", "9000")
}

public plugin_precache()
{
   new sModels[128]
   
   for (new i = 0; i < sizeof(g_szSkinsName); i++)
   {
      format(sModels, sizeof(sModels)-1, "models/player/%s/%s.mdl", g_szSkinsName[i], g_szSkinsName[i])
      precache_model(sModels)
   }
}
      
public plugin_cfg()
{
   new ConfigsDir[64]
   get_localinfo("amxx_configsdir", ConfigsDir, charsmax(ConfigsDir))
   format(ConfigsDir, charsmax(ConfigsDir), "%s/%s", ConfigsDir, g_szShopFile)
   
   if (!file_exists(ConfigsDir))
   {
      server_print("CS Shop file [%s] doesn't exists!", ConfigsDir)
      return;
   }
   server_cmd("exec ^"%s^"", ConfigsDir)
}

/*================================================================================
 [Menus]
=================================================================================*/

public ClCmd_Say(id)
{
   if (!is_user_alive(id))
   {
      client_print_c(id, "%L", id, "SHOP_DEAD")
      return PLUGIN_HANDLED
   }
      
   if (!get_pcvar_num(g_pCvarEnable))
   {
      client_print_c(id, "%L", id, "SHOP_DISABLED")
      return PLUGIN_HANDLED
   }
   Create_Menu(id)
   return PLUGIN_HANDLED
}

Create_Menu(id)
{
   new Menu = menu_create("\rCS Shop Menu", "MainMenu_Handler")
   new Items[32], Position[3]
   
   for (new i = 0; i < sizeof(g_szMainShopMenu); i++)
   {
      formatex(Items, charsmax(Items), "%s%s",  get_pcvar_num(g_pMenuEnableCvars[i]) ? "\w" : "\d", g_szMainShopMenu[i])
      num_to_str(i, Position, charsmax(Position))
      
      menu_additem(Menu, Items, Position)
   }
   menu_setprop(Menu, MPROP_EXIT, MEXIT_ALL)
   menu_display(id, Menu, 0)      
}

public MainMenu_Handler(id, Menu, item)
{
   if (item == MENU_EXIT)
   {
      menu_destroy(Menu)
      return PLUGIN_HANDLED
   }
   
   new Data[6], Name[64];
   new Access, Callback;
   menu_item_getinfo(Menu, item, Access, Data, 5, Name, 63, Callback)
   
   new Key = str_to_num(Data);
   
   switch (Key)
   {
      case 0:
      {
         new Cts_Menu = menu_create("\rCT's Guns", "CtMenu_Handler")
         new Items[32], PriceString[32], Position[3]
         
         for (new i = 0; i < sizeof(g_szCTGunsMenu); i++)
         {
            formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pCtGunsMenuCvars[i]))
            formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pCtGunsMenuCvars[i]) > 0 ? "\w" : "\d", g_szCTGunsMenu[i], get_pcvar_num(g_pCtGunsMenuCvars[i]) > 0 ? PriceString : "")
            
            num_to_str(i, Position, charsmax(Position))
            
            menu_additem(Cts_Menu, Items, Position)
         }
            
         menu_setprop(Cts_Menu, MPROP_EXIT, MEXIT_ALL)
         
         if (!get_pcvar_num(g_pMenuEnableCvars[0]))
         {
            client_print_c(id, "%L", id, "SHOP_CT_OFF")
            return PLUGIN_HANDLED;
         }
         else   
            menu_display(id, Cts_Menu, 0)   
      }
      
      case 1:
      {
         new Ts_Menu = menu_create("\rT's Guns", "TeMenu_Handler")
         new Items[32], PriceString[32], Position[3]
         
         for (new i = 0; i < sizeof(g_szTGunsMenu); i++)
         {
            formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pTeGunsMenuCvars[i]))
            formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pTeGunsMenuCvars[i]) > 0 ? "\w" : "\d", g_szTGunsMenu[i], get_pcvar_num(g_pTeGunsMenuCvars[i]) > 0 ? PriceString : "")
            
            num_to_str(i, Position, charsmax(Position))
            
            menu_additem(Ts_Menu, Items, Position)
         }
            
         menu_setprop(Ts_Menu, MPROP_EXIT, MEXIT_ALL)

         if (!get_pcvar_num(g_pMenuEnableCvars[1]))
         {
            client_print_c(id, "%L", id, "SHOP_T_OFF")
            return PLUGIN_HANDLED
         }
         else
            menu_display(id, Ts_Menu, 0)
            
      }
      
      case 2:
      {
         new Inv_Menu = menu_create("\rInvisibility Menu", "InvisibilityMenu_Handler")
         new Items[32], PriceString[32], Position[3]
         
         for (new i = 0; i < sizeof(g_szInvisibilityMenu); i++)
         {
            formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pInvisibilityMenuCvars[i]))
            formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pInvisibilityMenuCvars[i]) > 0 ? "\w" : "\d", g_szInvisibilityMenu[i], get_pcvar_num(g_pInvisibilityMenuCvars[i]) > 0 ? PriceString : "")
            
            num_to_str(i, Position, charsmax(Position))
            
            menu_additem(Inv_Menu, Items, Position)
         }
            
         menu_setprop(Inv_Menu, MPROP_EXIT, MEXIT_ALL)
      
         if (!get_pcvar_num(g_pMenuEnableCvars[2]))
         {
            client_print_c(id, "%L", id, "SHOP_INVIS_OFF")
            return PLUGIN_HANDLED
         }
         else
            menu_display(id, Inv_Menu, 0)   
      }
      
      case 3:
      {
         new Grav_Menu = menu_create("\rGravity Menu", "GravityMenu_Handler")
         new Items[32], PriceString[32], Position[3]
         
         for (new i = 0; i < sizeof(g_szGravityMenu); i++)
         {
            formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pGravityMenuCvars[i]))
            formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pGravityMenuCvars[i]) > 0 ? "\w" : "\d", g_szGravityMenu[i], get_pcvar_num(g_pGravityMenuCvars[i]) > 0 ? PriceString : "")
            
            num_to_str(i, Position, charsmax(Position))
            
            menu_additem(Grav_Menu, Items, Position)
         }
            
         menu_setprop(Grav_Menu, MPROP_EXIT, MEXIT_ALL)
         
         if (!get_pcvar_num(g_pMenuEnableCvars[3]))
         {
            client_print_c(id, "%L", id, "SHOP_GRAV_OFF")
            return PLUGIN_HANDLED
         }
         else
            menu_display(id, Grav_Menu, 0)   
      }
      
      case 4:
      {
         new Hp_Menu = menu_create("\rHealth Menu", "HealthMenu_Handler")
         new Items[32], PriceString[32], Position[3]
         
         for (new i = 0; i < sizeof(g_szHealthMenu); i++)
         {
            formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pHealthMenuCvars[i]))
            formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pHealthMenuCvars[i]) > 0 ? "\w" : "\d", g_szHealthMenu[i], get_pcvar_num(g_pHealthMenuCvars[i]) > 0 ? PriceString : "")
            
            num_to_str(i, Position, charsmax(Position))
            
            menu_additem(Hp_Menu, Items, Position)
         }
            
         menu_setprop(Hp_Menu, MPROP_EXIT, MEXIT_ALL)
         
         if (!get_pcvar_num(g_pMenuEnableCvars[4]))
         {
            client_print_c(id, "%L", id, "SHOP_HEALTH_OFF")
            return PLUGIN_HANDLED
         }   
         else
            menu_display(id, Hp_Menu, 0)   
      }

      case 5:
      {
         new Speed_Menu = menu_create("\rSpeed Menu", "SpeedMenu_Handler")
         new Items[32], PriceString[32], Position[3]
         
         for (new i = 0; i < sizeof(g_szSpeedMenu); i++)
         {
            formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pSpeedMenuCvars[i]))
            formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pSpeedMenuCvars[i]) > 0 ? "\w" : "\d", g_szSpeedMenu[i], get_pcvar_num(g_pSpeedMenuCvars[i]) > 0 ? PriceString : "")
            
            num_to_str(i, Position, charsmax(Position))
            
            menu_additem(Speed_Menu, Items, Position)
         }      
         
         menu_setprop(Speed_Menu, MPROP_EXIT, MEXIT_ALL)
      
         if (!get_pcvar_num(g_pMenuEnableCvars[5]))
         {
            client_print_c(id, "%L", id, "SHOP_SPEED_OFF")
            return PLUGIN_HANDLED
         }   
         else
            menu_display(id, Speed_Menu, 0)   
      }
      
      case 6:
      {
         new Skins_Menu = menu_create("\ySkins Menu", "SkinsMenu_Handler")
         new Items[32], PriceString[32], Position[3]
         
         for (new i = 0; i < sizeof(g_szSkinsMenu); i++)
         {
            formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pSkinsMenuCvars[i]))
            formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pSkinsMenuCvars[i]) > 0 ? "\w" : "\d", g_szSkinsMenu[i], get_pcvar_num(g_pSkinsMenuCvars[i]) > 0 ? PriceString : "")
            
            num_to_str(i, Position, charsmax(Position))
            
            menu_additem(Skins_Menu, Items, Position)
         }      
         
         menu_setprop(Skins_Menu, MPROP_EXIT, MEXIT_ALL)
      
         if (!get_pcvar_num(g_pMenuEnableCvars[6]))
         {
            client_print_c(id, "%L", id, "SHOP_SKINS_OFF")
            return PLUGIN_HANDLED
         }
         else
            menu_display(id, Skins_Menu, 0)
      }
   }
   menu_destroy(Menu)
   return PLUGIN_HANDLED
}

public CtMenu_Handler(id, Cts_Menu, item)
{
   if (item == MENU_EXIT)
   {
      menu_destroy(Cts_Menu)
      return PLUGIN_HANDLED
   }
   
   new Data[6], Name[64]
   new Access, Callback;
   menu_item_getinfo(Cts_Menu, item, Access, Data, 5, Name, 63, Callback)
   
   new Key = str_to_num(Data)
   
   new Money = get_user_money(id)
   new Pcvar = get_pcvar_num(g_pCtGunsMenuCvars[Key])
         
   if (!Pcvar)
   {
      client_print_c(id, "%L", id, "SHOP_ITEM_DISABLED")
      return PLUGIN_HANDLED
   }
         
   if (Money < Pcvar)
      client_print_c(id, "%L", id, "SHOP_ITEM_MONEY")
   else
   {
      client_print_c(id, "%L", id, "SHOP_ITEM_BUY", g_szCTGunsMenu[Key])
            
      set_user_money(id, Money-Pcvar)
      
      if (equali(g_szCTGunsMenu[Key], "Five Seven"))
         secondary_wpn_drop(id)
      else
         primary_wpn_drop(id)
      
      give_item(id, g_szCTGunsWeapons[Key])   
      
      if (!equali(g_szCTGunsMenu[Key], "Shield"))
         ExecuteHamB(Ham_GiveAmmo, id, g_iCTGunsLoad[Key], g_szCTGunsAmmo[Key], g_iCTGunsMaxAmmo[Key])
   }
   menu_destroy(Cts_Menu)
   return PLUGIN_HANDLED
}

public TeMenu_Handler(id, Tts_Menu, item)
{
   if (item == MENU_EXIT)
   {
      menu_destroy(Tts_Menu)
      return PLUGIN_HANDLED
   }
   
   new Data[6], Name[64]
   new Access, Callback;
   menu_item_getinfo(Tts_Menu, item, Access, Data, 5, Name, 63, Callback)
   
   new Key = str_to_num(Data)
   
   new Money = get_user_money(id)
   new Pcvar = get_pcvar_num(g_pTeGunsMenuCvars[Key])
   
   if (!Pcvar)
   {
      client_print_c(id, "%L", id, "SHOP_ITEM_DISABLED")
      return PLUGIN_HANDLED
   }
   
   if (Money < Pcvar)
      client_print_c(id, "%L", id, "SHOP_ITEM_MONEY")
   else
   {
      client_print_c(id, "%L", id, "SHOP_ITEM_BUY", g_szTGunsMenu[Key])
      
      set_user_money(id, Money-Pcvar)
      
      if (equali(g_szTGunsMenu[Key], "Dual Elites"))
         secondary_wpn_drop(id)
      else
         primary_wpn_drop(id)
      
      give_item(id, g_szTGunsWeapons[Key])
      ExecuteHamB(Ham_GiveAmmo, id, g_iTGunsLoad[Key], g_szTGunsAmmo[Key], g_iTGunsMaxAmmo[Key])
   }
   menu_destroy(Tts_Menu)
   return PLUGIN_HANDLED
}

public InvisibilityMenu_Handler(id, Inv_Menu, item)
{
   if (item == MENU_EXIT)
   {
      menu_destroy(Inv_Menu)
      return PLUGIN_HANDLED
   }
   
   new Data[6], Name[64]
   new Access, Callback;
   menu_item_getinfo(Inv_Menu, item, Access, Data, 5, Name, 63, Callback)
   
   new Key = str_to_num(Data)
   
   new Money = get_user_money(id)
   new Pcvar = get_pcvar_num(g_pInvisibilityMenuCvars[Key])
         
   if (!Pcvar)
   {
      client_print_c(id, "%L", id, "SHOP_ITEM_DISABLED")
      return PLUGIN_HANDLED
   }
      
   if (Money < Pcvar)
      client_print_c(id, "%L", id, "SHOP_ITEM_MONEY")
   else
   {
      client_print_c(id, "%L", id, "SHOP_ITEM_BUY", g_szInvisibilityMenu[Key])
      
      set_user_money(id, Money-Pcvar)
      set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, g_iInvisibilityLevel[Key])
   }
   menu_destroy(Inv_Menu)
   return PLUGIN_HANDLED
}

public GravityMenu_Handler(id, Grav_Menu, item)
{
   if (item == MENU_EXIT)
   {
      menu_destroy(Grav_Menu)
      return PLUGIN_HANDLED
   }
   
   new Data[6], Name[64]
   new Access, Callback;
   menu_item_getinfo(Grav_Menu, item, Access, Data, 5, Name, 63, Callback)

   new Key = str_to_num(Data)
   
   new Money = get_user_money(id)
   new Pcvar = get_pcvar_num(g_pGravityMenuCvars[Key])
         
   if (!Pcvar)
   {
      client_print_c(id, "%L", id, "SHOP_ITEM_DISABLED")
      return PLUGIN_HANDLED
   }
         
   if (Money < Pcvar)
      client_print_c(id, "%L", id, "SHOP_ITEM_MONEY")
   else
   {
      client_print_c(id, "%L", id, "SHOP_ITEM_BUY", g_szGravityMenu[Key])
            
      set_user_money(id, Money-Pcvar)
      set_user_gravity(id, (g_flGravityLevel[Key] / get_pcvar_float(g_pGravityCvarPointer)))
   }
   menu_destroy(Grav_Menu)
   return PLUGIN_HANDLED
}               

public HealthMenu_Handler(id, Hp_Menu, item)
{
   if (item == MENU_EXIT)
   {
      menu_destroy(Hp_Menu)
      return PLUGIN_HANDLED
   }
   
   new Data[6], Name[64]
   new Access, Callback
   menu_item_getinfo(Hp_Menu, item, Access, Data, 5, Name, 63, Callback)
   
   new Key = str_to_num(Data)
   
   new Money = get_user_money(id)
   new Pcvar = get_pcvar_num(g_pHealthMenuCvars[Key])
   new Health = get_user_health(id)
         
   if (!Pcvar)
   {
      client_print_c(id, "%L", id, "SHOP_ITEM_DISABLED")
      return PLUGIN_HANDLED
   }
         
   if (Money < Pcvar)
      client_print_c(id, "%L", id, "SHOP_ITEM_MONEY")
   else
   {
      client_print_c(id, "%L", id, "SHOP_ITEM_BUY", g_szHealthMenu[Key])
            
      set_user_money(id, Money-Pcvar)
      set_user_health(id, Health+g_iHealthLevel[Key])   
   }
   menu_destroy(Hp_Menu)
   return PLUGIN_HANDLED
}                           

public SpeedMenu_Handler(id, Speed_Menu, item)
{
   if (item == MENU_EXIT)
   {
      menu_destroy(Speed_Menu)
      return PLUGIN_HANDLED
   }
   
   new Data[6], Name[64]
   new Access, Callback;
   menu_item_getinfo(Speed_Menu, item, Access, Data, 5, Name, 63, Callback)
   
   new Key = str_to_num(Data)
   
   new Money = get_user_money(id)
   new Pcvar = get_pcvar_num(g_pSpeedMenuCvars[Key])
         
   if (!Pcvar)
   {
      client_print_c(id, "%L", id, "SHOP_ITEM_DISABLED")
      return PLUGIN_HANDLED
   }
         
   if (Money < Pcvar)
      client_print_c(id, "%L", id, "SHOP_ITEM_MONEY")
   else
   {
      g_iHasSpeed[id] = Key
            
      client_print_c(id, "%L", id, "SHOP_ITEM_BUY", g_szSpeedMenu[Key])
            
      set_user_money(id, Money-Pcvar)
      set_user_maxspeed(id, g_flSpeedLevel[Key])
   }
   menu_destroy(Speed_Menu)
   return PLUGIN_HANDLED
}                           

public SkinsMenu_Handler(id, Mdl_Menu, item)
{
   if (item == MENU_EXIT)
   {
      menu_destroy(Mdl_Menu)
      return PLUGIN_HANDLED
   }
   
   new Data[6], Name[64]
   new Access, Callback
   menu_item_getinfo(Mdl_Menu, item, Access, Data, 5, Name, 63, Callback)
   
   new Key = str_to_num(Data)
   
   new Money = get_user_money(id)
   new Pcvar = get_pcvar_num(g_pSkinsMenuCvars[Key])
   
   new CsTeams:Team = cs_get_user_team(id)
         
   if (!Pcvar)
   {
      client_print_c(id, "%L", id, "SHOP_ITEM_DISABLED")
      return PLUGIN_HANDLED
   }   
         
   switch (Team)
   {
      case CS_TEAM_T:
      {
         if (Key == 0)
         {
            client_print_c(id, "%L", id, "SHOP_ITEM_NOT")
            return PLUGIN_HANDLED
         }
      }
      
      case CS_TEAM_CT:
      {
         if (Key == 1)
         {
            client_print_c(id, "%L", id, "SHOP_ITEM_NOCT")
            return PLUGIN_HANDLED
         }
      }
   }
            
   if (Money < Pcvar)
      client_print_c(id, "%L", id, "SHOP_ITEM_MONEY")
   else
   {
      client_print_c(id, "%L", id, "SHOP_ITEM_BUY", g_szSkinsMenu[Key])
            
      set_user_money(id, Money-Pcvar)
      fm_set_user_model(id, g_szSkinsName[Key])
   }         
   menu_destroy(Mdl_Menu)
   return PLUGIN_HANDLED
}   
   
/*================================================================================
 [Forwards]
=================================================================================*/

public Fwd_PlayerSpawn_Post(id)
{
   if (is_user_alive(id))
   {
      set_user_rendering(id)
      set_user_gravity(id, 1.0)
   
      if (g_bHasCustomModel[id])
         fm_reset_user_model(id)
   
      if (g_iHasSpeed[id])
      {
         set_user_maxspeed(id, 250.0)
         g_iHasSpeed[id] = -1
      }
      
      if (get_pcvar_num(g_pCvarEnable))
         if (get_pcvar_num(g_pCvarMessage))
            client_print_c(id, "%L", id, "SHOP_PRINT")
   }
}

public Fwd_SetClientKeyValue(id, const infobuffer[], const key[])
{   
   if (g_bHasCustomModel[id] && equal(key, "model"))
      return FMRES_SUPERCEDE
       
   return FMRES_IGNORED
}

public Event_CurWeapon(id)
{
   if (!is_user_alive(id))
      return
   
   switch (g_iHasSpeed[id])
   {
      case 0: set_user_maxspeed(id, 260.0)
      case 1: set_user_maxspeed(id, 300.0)
      case 2: set_user_maxspeed(id, 340.0)
      case 3: set_user_maxspeed(id, 380.0)
      case 4: set_user_maxspeed(id, 420.0)
   }
}

/*================================================================================
 [Stocks]
=================================================================================*/   
   
stock primary_wpn_drop(index)
{
   new weapons[32], num, Weapon
   get_user_weapons(index, weapons, num)
   
   for (new i = 0; i < num; i++)
   {
      Weapon = weapons[i]
      
      if (PRIMARY_WEAPONS_BITSUM & (1<<Weapon))
      {
         static wname[32]
         get_weaponname(Weapon, wname, sizeof wname - 1)
         
         engclient_cmd(index, "drop", wname)
      }
   }
}

stock secondary_wpn_drop(index)
{
   new weapons[32], num, Weapon
   get_user_weapons(index, weapons, num)
   
   for (new i = 0; i < num; i++)
   {
      Weapon = weapons[i]
      
      if (!(PRIMARY_WEAPONS_BITSUM & (1<<Weapon)))
      {
         static wname[32]
         get_weaponname(Weapon, wname, sizeof wname - 1)
         
         engclient_cmd(index, "drop", wname)
      }
   }
}   

stock fm_set_user_model(index, const mdl[])
{
   engfunc(EngFunc_SetClientKeyValue, index, engfunc(EngFunc_GetInfoKeyBuffer, index), "model", mdl)
   g_bHasCustomModel[index] = true
}

stock fm_reset_user_model(index)
{
   g_bHasCustomModel[index] = false
   dllfunc(DLLFunc_ClientUserInfoChanged, index, engfunc(EngFunc_GetInfoKeyBuffer, index))
}

stock client_print_c(index, const Msg[], {Float, Sql, Result,_}:...)
{
   if (!is_user_connected(index))
      return;
   
   new Buffer[512], Buffer2[512], Prefix[32]
   get_pcvar_string(g_pCvarPrefix, Prefix, charsmax(Prefix))
   formatex(Buffer2, charsmax(Buffer2), "^x04%s ^x01%s", Prefix, Msg);
   vformat(Buffer, charsmax(Buffer), Buffer2, 3);
   
   message_begin(MSG_ONE_UNRELIABLE, g_iMsgSayText, _, index);
   write_byte(index);
   write_string(Buffer);
   message_end();
}


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: shop plugin átírás
HozzászólásElküldve:2012.02.11. 09:30 
Offline
Őstag

Csatlakozott:2011.11.05. 10:03
Hozzászólások:1098
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 4 alkalommal
Mi legyen a modelleknek a neve? (leet helyett valami..érted)

_________________
OFF


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: shop plugin átírás
HozzászólásElküldve:2012.02.11. 09:33 
Offline
Őstag

Csatlakozott:2011.11.05. 10:03
Hozzászólások:1098
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 4 alkalommal
Tessék itt 1 példa így a player/lol1/lol1 lol2 és lol3 modelleket olvassa be.

Kód:
new g_szSkinsMenu[][] =
{
   
"Terrorist Skin",
   
"Counter-Terrorist Skin"
   "LoL 1"
   "LoL 2"
   "LoL 3" 


Kód:
new g_szSkinsName[][] = { "gign""leet""lol1""lol2""lol3" 

_________________
OFF


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: shop plugin átírás
HozzászólásElküldve:2012.02.11. 09:46 
Offline
Őskövület
Avatar

Csatlakozott:2011.09.26. 20:33
Hozzászólások:2105
Megköszönt másnak: 28 alkalommal
Megköszönték neki: 33 alkalommal
ja értem, szóval csak hozzá kell írni? kössz :D


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: shop plugin átírás
HozzászólásElküldve:2012.02.11. 09:47 
Offline
Őstag

Csatlakozott:2011.11.05. 10:03
Hozzászólások:1098
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 4 alkalommal
rericsi8 írta:
ja értem, szóval csak hozzá kell írni? kössz :D

Elméletileg igen. :mrgreen:

_________________
OFF


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: shop plugin átírás
HozzászólásElküldve:2012.02.11. 09:52 
Offline
Tiszteletbeli

Csatlakozott:2010.02.04. 19:12
Hozzászólások:3528
Megköszönt másnak: 26 alkalommal
Megköszönték neki: 180 alkalommal
CocaIne.^ írta:
Tessék itt 1 példa így a player/lol1/lol1 lol2 és lol3 modelleket olvassa be.

Kód:
new g_szSkinsMenu[][] =
{
   "Terrorist Skin",
   "Counter-Terrorist Skin"
   "LoL 1"
   "LoL 2"
   "LoL 3"


Kód:
new g_szSkinsName[][] = { "gign", "leet", "lol1", "lol2", "lol3" }

nem fog menni így, nem tettél vesszőket

_________________
http://www.ebateam.eu/


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: shop plugin átírás
HozzászólásElküldve:2012.02.11. 09:54 
Offline
Őskövület
Avatar

Csatlakozott:2011.09.26. 20:33
Hozzászólások:2105
Megköszönt másnak: 28 alkalommal
Megköszönték neki: 33 alkalommal
tehát hogy lenne a jó?


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: shop plugin átírás
HozzászólásElküldve:2012.02.11. 09:56 
Offline
Őskövület
Avatar

Csatlakozott:2011.09.17. 17:54
Hozzászólások:2350
Megköszönt másnak: 40 alkalommal
Megköszönték neki: 57 alkalommal
Kód:
new g_szSkinsMenu[][] =
{
   "Terrorist Skin",
   "Counter-Terrorist Skin",
   "Lol1",
   "Lol2",
   "STB"
}


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: shop plugin átírás
HozzászólásElküldve:2012.02.11. 09:58 
Offline
Őskövület
Avatar

Csatlakozott:2011.09.26. 20:33
Hozzászólások:2105
Megköszönt másnak: 28 alkalommal
Megköszönték neki: 33 alkalommal
azért mert oda berakom azt a skint is fogja használni?


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: shop plugin átírás
HozzászólásElküldve:2012.02.11. 09:59 
Offline
Őskövület
Avatar

Csatlakozott:2011.09.17. 17:54
Hozzászólások:2350
Megköszönt másnak: 40 alkalommal
Megköszönték neki: 57 alkalommal
Kód:
new g_szSkinsName[][] = { "gign", "leet", "lol1", "lol2", "lol3" }

A lol1 meg ezeket.Csak a mappa és a fájl neve is ugyan az legyen.


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése: Rendezés 
Új téma nyitása Hozzászólás a témához  [16 hozzászólás ]  Oldal12Következő


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 30 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole