Здравствуйте, гость Вход | Регистрация
Наши новости:
|
| Дата поста: | В теме: | За сообщение: | Спасибо сказали: | ||
|---|---|---|---|---|---|
| 14.6.2016, 20:39 | Vip custom weapon 1.0.0 | Помогите переделать плагин так что бы выдавал в начале раунда не обычный дигл а золотой CODE /*********************** V.I.P Custom Weapons ********************** * * Credits: * ConnorMcLeod for cstrike_pdatas * Safety1st for plugin "Weapon Menu Hardcoded" * SISA for help * AlejandroSk for plugin "Golden Ak-47" *********************************************************************/ #include <amxmodx> #include <fakemeta> #include <hamsandwich> #define PLUGIN_NAME "V.I.P Custom DEAGLE" // don't change this! #define PLUGIN_VERSION "1.0.0" // version for "V.I.P Custom Weapons" #define PLUGIN_AUTHOR "Vaqtincha" #define get_weapon_owner(%1) get_pdata_cbase(%1, m_pPlayer, XO_WEAPON) #define fm_get_user_money(%1) get_pdata_int(%1, m_iAccount, XO_PLAYER) #if AMXX_VERSION_NUM < 183 #define HasShield(%1) (get_pdata_int(%1, m_iUserPrefs, XO_PLAYER) & m_bHasShield) #else #define HasShield(%1) get_pdata_bool(%1, m_bHasShield) #endif #define IsPlayer(%1) ( 1 <= (%1) <= giMaxPlayers ) #define MAX_PLAYERS 32 /*-----------------------------------------------------------------*/ #define WP 7788 // #define SHIELD_SUPPORT new const weapon_name[] = "weapon_deagle" new const ammo_type[] = "50ae" new const max_bpammo[] = 35 new const buy_cmd[] = "say /dg" new const weapon_id = CSW_DEAGLE new const V_MODEL[] = "models/golden/v_deagle.mdl" // view weapon model new const P_MODEL[] = "models/golden/p_deagle.mdl" // player weapon model new const W_MODEL[] = "models/golden/w_deagle.mdl" // world weapon model new const W_DEF_MODEL[] = "models/w_deagle.mdl" // default world model #if defined SHIELD_SUPPORT new const V_SHIELD_MODEL[] = "models/shield/v_shield_deagle.mdl" new const P_SHIELD_MODEL[] = "models/shield/p_shield_deagle.mdl" #endif /*-----------------------------------------------------------------*/ static buyaccess new weapcost, droptype, alw_round_buy, accuracy_fix new Float:damage, inbuyzone, buytime new Float:g_GameTime new bool:g_HasWeap[MAX_PLAYERS + 1] = false new bool:g_buyzone[MAX_PLAYERS + 1] new giCounter, giMaxPlayers 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 const SECONDARY_WEAPONS_BIT_SUM = 1<<CSW_P228|1<<CSW_ELITE|1<<CSW_FIVESEVEN|1<<CSW_USP|1<<CSW_GLOCK18|1<<CSW_DEAGLE // Offsets #if AMXX_VERSION_NUM < 183 const m_bHasShield = 1<<24 const m_iUserPrefs = 510 #else const m_bHasShield = 2043 #endif const m_flAccuracy = 62 const m_pPlayer = 41 const XO_PLAYER = 5 const XO_WEAPON = 4 const m_pActiveItem = 373 const m_rgpPlayerItems_wpnbx_slot2 = 36 // secondary weapon slot // const m_rgpPlayerItems_wpnbx_slot1 = 35 // primary weapon slot #if cellbits == 32 const m_iAccount = 115 #else const m_iAccount = 140 #endif public plugin_init() { new mapname[4] get_mapname(mapname, charsmax(mapname)) if(equali(mapname, "de_") || equali(mapname, "cs_")) { register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR) register_dictionary ( "vip_custom.txt" ) loadconfig() giMaxPlayers = get_maxplayers() register_clcmd( buy_cmd, "buyCMD") // don't change this! if(inbuyzone) register_event("StatusIcon", "event_buyzone_icon", "b", "2=buyzone") // Events register_event( "TextMsg", "Event_NewGame", "a", "2=#Game_will_restart_in", "2=#Game_Commencing" ) register_event ( "HLTV", "Event_NewRound", "a", "1=0", "2=0" ) register_event("DeathMsg", "Death", "a") register_forward(FM_SetModel, "fw_SetModel") RegisterHam(Ham_Item_Deploy, weapon_name, "fw_ItemDeploy_Weap_Post", 1) RegisterHam(Ham_Item_AttachToPlayer, weapon_name, "fw_Item_AttachToPlayer_Pre", 0) RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage_Pre", 0) if(accuracy_fix) RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_Weapon_PrimaryAttack_Pre", 0) #if defined SHIELD_SUPPORT RegisterHam(Ham_Weapon_SecondaryAttack, weapon_name, "fw_Weapon_SecondaryAttack_Post", 1) #endif } else pause("a") } public loadconfig() { new ConfigFile[64], szMsg[128] // "addons/amxmodx/configs/vip_custom.ini" 37 get_localinfo("amxx_configsdir", ConfigFile, charsmax(ConfigFile)) add(ConfigFile, charsmax(ConfigFile), "/vip_custom.ini") if( !file_exists(ConfigFile) ) { formatex( szMsg, charsmax(szMsg), "%s Config File Not Found!", PLUGIN_NAME ) set_fail_state(szMsg) return } new fp = fopen(ConfigFile, "rt") if( fp ) { new Datas[86], Setting[24], Value[15] while( !feof(fp) ) { fgets(fp, Datas, charsmax(Datas)) trim(Datas) if(!Datas[0] || Datas[0] == ';' || Datas[0] == '#' || Datas[0] == '/'|| Datas[0] == '[') { continue } new Sign[3] parse(Datas, Setting, charsmax(Setting), Sign, charsmax(Sign), Value, charsmax(Value)) if( equali(Setting, "buy_access")){ buyaccess = read_flags(Value) }else if( equali(Setting, "drop_type")){ droptype = str_to_num(Value) }else if( equali(Setting, "allowed_round_buymenu")){ alw_round_buy = str_to_num(Value) }else if( equali(Setting, "buyzone_check")){ inbuyzone = str_to_num(Value) ? true : false }else if( equali(Setting, "buytime_check")){ buytime = str_to_num(Value) ? true : false }else if( equali(Setting, "deagle_cost")){ weapcost = str_to_num(Value) }else if( equali(Setting, "deagle_damage")){ damage = str_to_float(Value) }else if( equali(Setting, "deagle_accuracy_fix")){ accuracy_fix = str_to_num(Value) ? true : false } } formatex( szMsg, charsmax(szMsg), "%s Config Successfully Loaded!", PLUGIN_NAME ) server_print(szMsg) } } public plugin_precache() { precache_model(V_MODEL) precache_model(P_MODEL) precache_model(W_MODEL) #if defined SHIELD_SUPPORT precache_model(V_SHIELD_MODEL) precache_model(P_SHIELD_MODEL) #endif } public event_buyzone_icon(id) { g_buyzone[id] = bool:read_data(1) } public client_putinserver(id) { g_HasWeap[id] = false } public client_disconnect(id) { g_HasWeap[id] = false if(inbuyzone) { g_buyzone[id] = false } } public Event_NewGame() { giCounter = 0 new iPlayers[32], iNum get_players(iPlayers, iNum ) for ( --iNum; iNum >= 0; --iNum ) { g_HasWeap[iPlayers[iNum]] = false } } public Event_NewRound() { giCounter++ if(buytime) { g_GameTime = get_gametime() } } public Death() { g_HasWeap[read_data(2)] = false } public buyCMD(id) { if(!is_user_alive(id)) { client_print(id, print_center, "%L", LANG_SERVER,"ONLY_ALIVE") return PLUGIN_HANDLED } // Check if the player is in the buyzone if(inbuyzone) { if(!g_buyzone[id]) { client_print(id, print_center, "%L", LANG_SERVER,"OUTSIDE_BUYZONE") return PLUGIN_HANDLED } } // Check buying time if(buytime) { new Float:buytime = get_cvar_float("mp_buytime") * 60.0 new Float:timepassed = get_gametime() - g_GameTime if(floatcmp(timepassed , buytime) == 1) { client_print(id, print_center, "%L", LANG_SERVER,"SECONDS_HAVE_PASSED",buytime) return PLUGIN_HANDLED } } if(giCounter < alw_round_buy) { client_print(id, print_center, "%L", LANG_SERVER,"NOT_AVAILABLE") return PLUGIN_HANDLED } if(!(get_user_flags(id) & buyaccess )) { client_print(id, print_center, "%L", LANG_SERVER,"NO_ACC_CMD") return PLUGIN_HANDLED } if(fm_get_user_money(id) < weapcost ) { client_print(id, print_center, "%L", LANG_SERVER,"INSUFFICIENT_FUNDS") return PLUGIN_HANDLED } else{ fm_set_user_money(id, fm_get_user_money(id) - weapcost , 1) GiveWeapon(id) } return PLUGIN_CONTINUE } public GiveWeapon(id) { #if defined SHIELD_SUPPORT // "check shield" by Safety1st (thanks very much!) new iRestoreData if(HasShield(id)) { // temporary set new info to be able to drop weapon #if AMXX_VERSION_NUM < 183 iRestoreData = get_pdata_int( id, m_iUserPrefs ) set_pdata_int( id, m_iUserPrefs, iRestoreData & ~m_bHasShield ) #else iRestoreData = set_pdata_bool( id, m_bHasShield, false ) #endif } #endif drop_weapons(id, 2) #if defined SHIELD_SUPPORT if( iRestoreData ) { #if AMXX_VERSION_NUM < 183 set_pdata_int( id, m_iUserPrefs, iRestoreData | m_bHasShield ) #else set_pdata_bool( id, m_bHasShield, true ) #endif // due to weapon dropping we have deployed another weapon without a shield drawn ;) so redeploy it new iActiveItem = get_pdata_cbase( id, m_pActiveItem ) if( iActiveItem ) ExecuteHamB( Ham_Item_Deploy, iActiveItem ) } #endif g_HasWeap[id] = true fm_give_item(id, weapon_name) ExecuteHamB(Ham_GiveAmmo, id, max_bpammo, ammo_type, max_bpammo) engclient_cmd(id, weapon_name) } public fw_ItemDeploy_Weap_Post(ent) { new iPlayer = get_weapon_owner(ent) if(iPlayer > 0 && g_HasWeap[iPlayer]) { #if defined SHIELD_SUPPORT if(HasShield(iPlayer)) { set_pev(iPlayer, pev_viewmodel2, V_SHIELD_MODEL) set_pev(iPlayer, pev_weaponmodel2, P_SHIELD_MODEL) } else{ set_pev(iPlayer, pev_viewmodel2, V_MODEL) set_pev(iPlayer, pev_weaponmodel2, P_MODEL) } #else set_pev(iPlayer, pev_viewmodel2, V_MODEL) set_pev(iPlayer, pev_weaponmodel2, P_MODEL) #endif } return HAM_IGNORED } #if defined SHIELD_SUPPORT public fw_Weapon_SecondaryAttack_Post(ent) { new iPlayer = get_weapon_owner(ent) if(iPlayer > 0 && g_HasWeap[iPlayer] && HasShield(iPlayer)) { set_pev(iPlayer, pev_weaponmodel2, P_SHIELD_MODEL) } } #endif public fw_Weapon_PrimaryAttack_Pre(ent) { new iPlayer = get_weapon_owner(ent) if(iPlayer > 0 && g_HasWeap[iPlayer]) { set_pdata_float(ent, m_flAccuracy, 1.0, XO_WEAPON) } } public fw_Item_AttachToPlayer_Pre(ent, id) { if ( pev (ent, pev_impulse)==WP) g_HasWeap[id] = true if( get_pdata_cbase(id, m_pActiveItem) != ent) { return HAM_IGNORED } fw_ItemDeploy_Weap_Post(ent) return HAM_IGNORED } public fw_SetModel(ent, model[]) { new id = pev (ent, pev_owner) if( pev_valid(ent)) { if( equal(model, W_DEF_MODEL)) { new weapon = get_pdata_cbase(ent, m_rgpPlayerItems_wpnbx_slot2, XO_WEAPON) if(weapon > 0 && pev(weapon, pev_impulse)==WP) { g_HasWeap[id] = false engfunc(EngFunc_SetModel, ent, W_MODEL ) return FMRES_SUPERCEDE } } } return FMRES_IGNORED } public fw_TakeDamage_Pre(victim, inflictor, attacker, Float:fdamage, damage_bits) { if(!(damage_bits & DMG_BULLET)||!IsPlayer(attacker)|| get_user_weapon(attacker) != weapon_id) return HAM_IGNORED if(g_HasWeap[attacker] && attacker == inflictor ) { SetHamParamFloat(4, fdamage * damage) return HAM_HANDLED } return HAM_IGNORED } //================================ STOCKS ==============================// stock drop_weapons(id, dropwhat) { static weapons[32], num, i, weaponid num = 0 get_user_weapons(id, weapons, num) for (i = 0; i < num; i++) { weaponid = weapons[i] if((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM || HasShield(id))) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM))) { static wname[32] get_weaponname(weaponid, wname, charsmax(wname)) switch(droptype) { case 0: ham_strip_weapon(id, wname) case 1: engclient_cmd(id, "drop", wname) } } } } stock fm_give_item(index, const item[]) { if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5)) return 0 new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item)) if (!pev_valid(ent)) return 0 new Float:origin[3] pev(index, pev_origin, origin) set_pev(ent, pev_origin, origin) set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN) set_pev(ent, pev_impulse, WP) dllfunc(DLLFunc_Spawn, ent) new save = pev(ent, pev_solid) dllfunc(DLLFunc_Touch, ent, index) if (pev(ent, pev_solid) != save) return ent engfunc(EngFunc_RemoveEntity, ent) return -1 } stock ham_strip_weapon(id,weapon[]) { if(!equal(weapon,"weapon_",7)) return 0 new wId = get_weaponid(weapon) if(!wId) return 0 new wEnt while((wEnt = engfunc(EngFunc_FindEntityByString, wEnt, "classname", weapon)) && pev(wEnt, pev_owner) != id) {} if(!wEnt) return 0 new iTmp if(get_user_weapon(id, iTmp, iTmp) == wId) ExecuteHamB(Ham_Weapon_RetireWeapon, wEnt) if(!ExecuteHamB(Ham_RemovePlayerItem, id, any:wEnt)) return 0 ExecuteHamB(Ham_Item_Kill, wEnt) set_pev(id, pev_weapons, pev(id, pev_weapons) & ~(1<<wId)) return 1 } stock fm_set_user_money(client, money, flash=1) { set_pdata_int(client, m_iAccount, money, XO_PLAYER) static Money if( Money || (Money = get_user_msgid("Money")) ) { emessage_begin(MSG_ONE_UNRELIABLE, Money, _, client) ewrite_long(money) ewrite_byte(flash ? 1 : 0) emessage_end() } } а вот главный скрипт плагинов CODE /************************ V.I.P Custom Weapons ************************* * * Last update: * 05/12/2015 * * Cmds: * weaponmenu or (say /wm) - Free guns menu * * Credits: * - Safety1st - for plugin "Weapon Menu Hardcoded" (edited by me) * - Eg@r4$il - for plugin "Admins are VIPs + grenades + kevlar" (edited by me) * - ZETA [M|E|N] - for plugin "VSVipPrefix" * - xPaw - for code "ScoreBoard "VIP" string" * - ConnorMcLeod for plugin "Bullet Damage" and cstrike_pdatas * - Subb98 for plugin "No fall damage" * - MrBone - for pieces of advice * - Patriot~ua~ - for ideas and testing * - c-s.net.ua members * ***********************************************************************/ #include <amxmodx> #include <amxmisc> #include <hamsandwich> #include <fakemeta> #define PLUGIN_NAME "V.I.P Custom Weapons" #define PLUGIN_VERSION "1.0.0" #define PLUGIN_AUTHOR "Vaqtincha" // macro; %1 - variable being modified, %2 - player id #define CheckFlag(%1,%2) (%1 & (1 << (%2 & 31))) #define SetFlag(%1,%2) (%1 |= (1 << (%2 & 31))) #define ClearFlag(%1,%2) (%1 &= ~(1 << (%2 & 31))) #define SetFlagConnected(%1) g_bConnected |= 1<<(%1 & 31) #define ClearFlagConnected(%1) g_bConnected &= ~( 1<<(%1 & 31)) #define UserConnected(%1) (g_bConnected & 1<<(%1 & 31)) #define cs_get_user_hasprim(%1,%2) (get_pdata_cbase(%1, m_rgpPlayerItems_CBasePlayer[%2])>0) #define fm_get_user_money(%1) get_pdata_int(%1, m_iAccount, XO_PLAYER) #define fm_get_weapon_id(%1) get_pdata_int(%1, m_iId, XO_WEAPON) #define fm_set_weapon_ammo(%1,%2) set_pdata_int(%1, m_iClip, %2, XO_WEAPON) #if AMXX_VERSION_NUM < 183 #define HasShield(%1) (get_pdata_int(%1, m_iUserPrefs, XO_PLAYER) & m_bHasShield) #else #define HasShield(%1) get_pdata_bool(%1, m_bHasShield) #endif #define MAX_PLAYERS 32 #define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers ) #define ITEM_DEAGLE (1<<0) #define ITEM_HE (1<<1) #define ITEM_SMOKE (1<<2) #define ITEM_FLASH (1<<3) #define ITEM_AMMO (1<<4) #define ITEM_ARMOR (1<<5) #define ITEM_DEFUSER (1<<6) new Trie:vipChannels new g_iAlive[MAX_PLAYERS+1] new bool:g_bAccess[MAX_PLAYERS+1] new g_iPlayerPos[MAX_PLAYERS+1] new g_iPlayerCol[MAX_PLAYERS+1] new gbIsUsed, giCounter, g_bConnected, g_iMaxPlayers, target_map new g_iKNFPluginId, g_iDGLPluginId, g_iM4A1PluginId, g_iAK47PluginId, g_iAWPPluginId new g_iDGLGive, g_iM4A1Give, g_iAK47Give, g_iAWPGive new g_iKNFReload, g_iDGLReload, g_iM4A1Reload, g_iAK47Reload, g_iAWPReload new alw_round_eq, alw_round_fm, alw_round_m4ak, alw_round_awp, alw_round_buy new vampire, vampire_max, hp_bonus, hp_bonus_hs, item_flags, delay, damager, droptype new dmgcolors[3], scrtag, prefix, info, remove_limit, openmenu, nofall, recieved new dglcost, m4cost, akcost, awpcost static flagaccess, buyaccess // Offsets new const m_rgpPlayerItems_CBasePlayer[6] = {367, 368, ...} #if AMXX_VERSION_NUM < 183 const m_bHasShield = 1<<24 const m_iUserPrefs = 510 #else const m_bHasShield = 2043 #endif const m_pNext = 42 const m_iClip = 51 const m_iId = 43 const XO_PLAYER = 5 const XO_WEAPON = 4 #if cellbits == 32 const m_iAccount = 115 #else const m_iAccount = 140 #endif const MENUKEYS = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4 |MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0 const KEY_EXIT = 10 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 const SECONDARY_WEAPONS_BIT_SUM = 1<<CSW_P228|1<<CSW_ELITE|1<<CSW_FIVESEVEN|1<<CSW_USP|1<<CSW_GLOCK18|1<<CSW_DEAGLE const NOCLIP_WPN_BS = ((1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4)) // Max BP ammo for weapons new const MAXBPAMMO[31] = { -1, 52, -1, 90, 1, 32, 1, 100, 90, 1, 120, 100, 100, 90, 90, 90, 100, 120, 30, 120, 200, 32, 90, 120, 90, 2, 35, 90, 90, -1, 100 } // Max clip for weapons new const MAXCLIP[CSW_P90+1] = { -1, 13, -1, 10, 1, 7, 1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20, 10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 } // Ammo Type Names for weapons new const AMMOTYPE[][] = { "", "357sig", "", "762nato", "", "buckshot", "", "45acp", "556nato", "", "9mm", "57mm", "45acp", "556nato", "556nato", "556nato", "45acp", "9mm", "338magnum", "9mm", "556natobox","buckshot", "556nato", "9mm", "762nato", "", "50ae", "556nato", "762nato", "", "57mm" } new const Float:g_flCoords[][] = { {0.50, 0.40},{0.56, 0.44},{0.60, 0.50}, {0.56, 0.56},{0.50, 0.60},{0.44, 0.56},{0.40, 0.50},{0.44, 0.44} } new const g_iColors[][] = { {0, 127, 255},/*blue*/{255, 127, 0},/*orange*/ {127, 0, 255},/*purple*/{0, 255, 0},/*green*/{255, 24, 119},/*pink*/ {228, 228, 228},/*gray*/{165, 42, 42},/*brown*/{255, 255, 0}/*yellow*/ } new channels[8][] = { "#Cstrike_Chat_CT","#Cstrike_Chat_T","#Cstrike_Chat_CT_Dead","#Cstrike_Chat_T_Dead", "#Cstrike_Chat_Spec","#Cstrike_Chat_All","#Cstrike_Chat_AllDead","#Cstrike_Chat_AllSpec" } new newChannels[8][] = { "^4(^1Counter-Terrorist^4) [^3V.I.P^4] ^3%s1^1 : ^4%s2", "^4(^1Terrorist^4) [^3V.I.P^4] ^3%s1^1 : ^4%s2", "^1*DEAD*^4(^1Counter-Terrorist^4) [^3V.I.P^4] ^3%s1^1 : ^4%s2", "^1*DEAD*^4(^1Terrorist^4) [^3V.I.P^4] ^3%s1^1 : ^4%s2", "^4(^1Spectator^4) [^3V.I.P^4] ^3%s1^1 : ^4%s2", "^4[^3V.I.P^4] ^3%s1^1 : ^4%s2", "^1*DEAD* ^4[^3V.I.P^4] ^3%s1^1 : ^4%s2", "^1*SPEC* ^4[^3V.I.P^4] ^3%s1^1 : ^4%s2" } public plugin_init() { new mapname[4] get_mapname(mapname, charsmax(mapname)) if(equali(mapname, "de_") || equali(mapname, "cs_")) { target_map = true } register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR) register_cvar("vip_custom_version", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY) register_concmd("vip_custom_reloadcfg", "cmdReloadCfg", ADMIN_CFG) register_dictionary ("vip_custom.txt" ) loadconfig() g_iMaxPlayers = get_maxplayers() RegisterHam(Ham_Spawn, "player", "playerspawn_post", 1) RegisterHam(Ham_Killed, "player", "playerkilled_post", 1) if(nofall) RegisterHam(Ham_TakeDamage, "player", "HamTakeDamagePlayerPre", 0) if(scrtag) register_message( get_user_msgid("ScoreAttrib"), "msgScoreAttrib" ) if(damager) register_event("Damage", "Event_Damage", "b", "2>0", "3=0") if(prefix) { vipChannels = TrieCreate() for (new i = 0; i < 8; i++) { TrieSetString(vipChannels, channels[i], newChannels[i]) } register_message(get_user_msgid("SayText"), "messageSayText") } if(target_map) { // Cmds register_clcmd( "vipmenu", "MenuCommand" ) register_clcmd( "say /vipmenu", "MenuCommand" ) register_clcmd( "say /wm", "MenuCommand" ) // Menu register_menucmd( register_menuid( "WeaponMenu" ),MENUKEYS, "MenuHandlerCustom" ) register_menucmd( register_menuid( "BuyMenu" ),MENUKEYS, "MenuHandler" ) // Events register_event( "HLTV", "Event_NewRound", "a", "1=0", "2=0" ) register_event( "TextMsg", "Event_NewGame", "a", "2=#Game_will_restart_in", "2=#Game_Commencing" ) if(vampire) register_event( "DeathMsg", "Event_DeathMsg", "a") if(remove_limit) register_event( "BarTime", "event_bomb_planting", "be", "1=3") } } public cmdReloadCfg(id, level, cid) { if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED set_task(0.2, "delayed_load") return PLUGIN_HANDLED } public delayed_load() { item_flags = 0 loadconfig() if( g_iKNFPluginId > 0 && g_iKNFReload > 0) { callfunc_begin_i(g_iKNFReload, g_iKNFPluginId) callfunc_end() } if( g_iDGLPluginId > 0 && g_iDGLReload > 0) { callfunc_begin_i(g_iDGLReload, g_iDGLPluginId) callfunc_end() } if(g_iM4A1PluginId > 0 && g_iM4A1Reload > 0) { callfunc_begin_i(g_iM4A1Reload, g_iM4A1PluginId) callfunc_end() } if(g_iAK47PluginId > 0 && g_iAK47Reload > 0) { callfunc_begin_i(g_iAK47Reload, g_iAK47PluginId) callfunc_end() } if(g_iAWPPluginId > 0 && g_iAWPReload > 0) { callfunc_begin_i(g_iAWPReload, g_iAWPPluginId) callfunc_end() } } public loadconfig() { new ConfigFile[64], szMsg[128] // "addons/amxmodx/configs/vip_custom.ini" 37 get_localinfo("amxx_configsdir", ConfigFile, charsmax(ConfigFile)) add(ConfigFile, charsmax(ConfigFile), "/vip_custom.ini") if( !file_exists(ConfigFile) ) { formatex( szMsg, charsmax(szMsg), "%s Config File Not Found!", PLUGIN_NAME ) set_fail_state(szMsg) return } new fp = fopen(ConfigFile, "rt") if( fp ) { new Datas[86], Setting[32], Value[15] while( !feof(fp) ) { fgets(fp, Datas, charsmax(Datas)) trim(Datas) if(!Datas[0] || Datas[0] == ';' || Datas[0] == '#' || Datas[0] == '/' || Datas[0] == '[') { continue } new Sign[3] parse(Datas, Setting, charsmax(Setting), Sign, charsmax(Sign), Value, charsmax(Value)) if( equali(Setting, "flag_access")) { flagaccess = read_flags(Value) }else if( equali(Setting, "buy_access")){ buyaccess = read_flags(Value) }else if( equali(Setting, "give_item_flags")) { if (containi(Value, "p") != -1) { item_flags |= ITEM_DEAGLE } if (containi(Value, "h") != -1) { item_flags |= ITEM_HE } if (containi(Value, "s") != -1) { item_flags |= ITEM_SMOKE } if (containi(Value, "f") != -1) { item_flags |= ITEM_FLASH } if (containi(Value, "a") != -1) { item_flags |= ITEM_AMMO } if (containi(Value, "v") != -1) { item_flags |= ITEM_ARMOR } if (containi(Value, "d") != -1) { item_flags |= ITEM_DEFUSER } }else if( equali(Setting, "allowed_round_equip")){ alw_round_eq = str_to_num(Value) }else if( equali(Setting, "vip_tag")){ scrtag = str_to_num(Value) ? true : false }else if( equali(Setting, "vip_prefix")){ prefix = str_to_num(Value) ? true : false }else if( equali(Setting, "vip_info")){ info = str_to_num(Value) ? true : false }else if( equali(Setting, "drop_type")){ droptype = str_to_num(Value) }else if( equali(Setting, "no_fall_damage")){ nofall = str_to_num(Value) ? true : false }else if( equali(Setting, "remove_limit")){ remove_limit = str_to_num(Value) ? true : false }else if( equali(Setting, "bullet_damage")){ damager = str_to_num(Value) }else if( equali(Setting, "bullet_damage_recieved")){ recieved = str_to_num(Value) ? true : false }else if( equali(Setting, "bullet_damage_color")){ new red[10], green[10], blue[10] parse(Value, red, charsmax(red), green, charsmax(green), blue, charsmax(blue)) dmgcolors[0] = str_to_num(red) dmgcolors[1] = str_to_num(green) dmgcolors[2] = str_to_num(blue) }else if( equali(Setting, "vampire")){ vampire = str_to_num(Value) ? true : false }else if( equali(Setting, "vampire_max_hp")){ vampire_max = str_to_num(Value) }else if( equali(Setting, "vampire_hp")){ hp_bonus = str_to_num(Value) }else if( equali(Setting, "vampire_hp_hs")){ hp_bonus_hs = str_to_num(Value) }else if( equali(Setting, "open_menu")){ openmenu = str_to_num(Value) ? true : false }else if( equali(Setting, "close_delay")){ delay = str_to_num(Value) }else if( equali(Setting, "allowed_round_famas")){ alw_round_fm = str_to_num(Value) }else if( equali(Setting, "allowed_round_m4ak")){ alw_round_m4ak = str_to_num(Value) }else if( equali(Setting, "allowed_round_awp")){ alw_round_awp = str_to_num(Value) }else if( equali(Setting, "allowed_round_buymenu")){ alw_round_buy = str_to_num(Value) }else if( equali(Setting, "deagle_cost")){ dglcost = str_to_num(Value) }else if( equali(Setting, "m4a1_cost")){ m4cost = str_to_num(Value) }else if( equali(Setting, "ak47_cost")){ akcost = str_to_num(Value) }else if( equali(Setting, "awp_cost")){ awpcost = str_to_num(Value) } } formatex( szMsg, charsmax(szMsg), "%s Config Successfully Loaded!", PLUGIN_NAME ) server_print(szMsg) } } public plugin_cfg() { g_iKNFPluginId = is_plugin_loaded("V.I.P Custom KNIFE") if( g_iKNFPluginId > 0 ) { g_iKNFReload = get_func_id("loadconfig", g_iKNFPluginId) } g_iDGLPluginId = is_plugin_loaded("V.I.P Custom DEAGLE") if( g_iDGLPluginId > 0 ) { g_iDGLGive = get_func_id("buyCMD", g_iDGLPluginId) g_iDGLReload = get_func_id("loadconfig", g_iDGLPluginId) } g_iM4A1PluginId = is_plugin_loaded("V.I.P Custom M4A1") if( g_iM4A1PluginId > 0 ) { g_iM4A1Give = get_func_id("buyCMD", g_iM4A1PluginId) g_iM4A1Reload = get_func_id("loadconfig", g_iM4A1PluginId) } g_iAK47PluginId = is_plugin_loaded("V.I.P Custom AK-47") if( g_iAK47PluginId > 0 ) { g_iAK47Give = get_func_id("buyCMD", g_iAK47PluginId) g_iAK47Reload = get_func_id("loadconfig", g_iAK47PluginId) } g_iAWPPluginId = is_plugin_loaded("V.I.P Custom AWP") if( g_iAWPPluginId > 0 ) { g_iAWPGive = get_func_id("buyCMD", g_iAWPPluginId) g_iAWPReload = get_func_id("loadconfig", g_iAWPPluginId) } } public client_putinserver(id) { g_iAlive[id] = 0 g_bAccess[id] = get_user_flags(id) & flagaccess ? true : false if(info) { set_task(1.0, "vip_connected", id) if(target_map) { set_task(30.0, "vip_help", id) } } if(!is_user_hltv(id)) { SetFlagConnected(id) } } public client_disconnect(id) { ClearFlagConnected(id) } public playerspawn_post(id) { g_iAlive[id] = is_user_alive(id) g_bAccess[id] = get_user_flags(id) & flagaccess ? true : false set_task(0.2, "GiveItem", id + 6910) } public playerkilled_post(id, attacker, shouldgib) { g_iAlive[id] = 0 } public Event_NewRound() { gbIsUsed = 0 giCounter++ } public Event_NewGame() { giCounter = 0 } // Vip connected info/help public vip_connected(id) { if(g_bAccess[id]) { new name[32] get_user_name(id, name, 31) ChatColor(0, "%L", LANG_SERVER,"VIP_CONNECTED", name) } } public vip_help(id) { if(g_bAccess[id]) { new name[32] get_user_name(id, name, 31) ChatColor(id, "%L", LANG_SERVER,"VIP_HELP", name) } } // ScoreBoard "VIP" String public msgScoreAttrib(const MsgId, const MsgType, const MsgDest) { static id; id = get_msg_arg_int(1) if(get_msg_arg_int(2) || !(g_bAccess[id])) return set_msg_arg_int(2, ARG_BYTE, (1<<2)) } // [V.I.P] prefix and green chat public messageSayText(msgid, msgdest, id) { new channel[64] get_msg_arg_string(2, channel, charsmax(channel)) if(!TrieGetString(vipChannels, channel, channel, charsmax(channel))) { return } new sender = get_msg_arg_int(1) if(g_bAccess[sender]) { set_msg_arg_string(2, channel) } } public plugin_end() { TrieDestroy(vipChannels) } // Bullet Damage public Event_Damage(iVictim) { if((read_data(4) || read_data(5) || read_data(6))) { static damage; damage = read_data(2) if( recieved && IsPlayer(iVictim) && UserConnected(iVictim)) { if(g_bAccess[iVictim]) { set_hudmessage(255, 0, 0, 0.45, 0.50, 0, 6.0, 3.0, _, _, 3) show_hudmessage(iVictim, "%d", damage) } } new id = get_user_attacker(iVictim) if( IsPlayer(id) && UserConnected(id)) { new iPos = ++g_iPlayerPos[id] if( iPos == sizeof(g_flCoords)) { iPos = g_iPlayerPos[id] = 0 } new iCol = ++g_iPlayerCol[id] if( iCol == sizeof(g_iColors)) { iCol = g_iPlayerCol[id] = 0 } if(g_bAccess[id]) { switch(damager) { case 1:{ set_hudmessage(dmgcolors[0], dmgcolors[1], dmgcolors[2], 0.51, 0.51, 0, 6.0, 3.0, _, _, 3) } case 2:{ set_hudmessage(dmgcolors[0], dmgcolors[1], dmgcolors[2], Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 0, 0.1, 2.5, 0.02, 0.02, -1) } case 3:{ set_hudmessage(g_iColors[iCol][0], g_iColors[iCol][1], g_iColors[iCol][2], Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 0, 0.1, 2.5, 0.02, 0.02, -1) } } show_hudmessage(id, "%d", damage) } } } } // Vampire public Event_DeathMsg() { new KillerId = read_data(1) new VictimId = read_data(2) new HeadShot = read_data(3) if(KillerId == VictimId || !IsPlayer(KillerId) || !g_iAlive[KillerId] || !(g_bAccess[KillerId]) || get_user_team(KillerId) == get_user_team(VictimId)) { return } new KillerHealth = get_user_health(KillerId) new KillerMaxHealth = vampire_max if(KillerHealth < KillerMaxHealth) { new BonusKillerHealth = HeadShot ? hp_bonus_hs : hp_bonus new NewKillerHealth = min(KillerHealth + BonusKillerHealth, KillerMaxHealth) fm_set_user_health(KillerId, NewKillerHealth) set_hudmessage(0, 255, 100, -1.0, 0.15, 0, 1.0, 1.0, 0.1, 0.1, -1) show_hudmessage(KillerId, "Healed +%d hp", NewKillerHealth - KillerHealth) } } // Terrorist planter :D public event_bomb_planting(id) { if(!g_iAlive[id] || !g_bAccess[id]) return set_pev(id, pev_maxspeed, 250.0) } // No fall damage public HamTakeDamagePlayerPre(victim, inflictor, attacker, Float:dmg, dmg_type) { if(g_bAccess[victim]) { if(dmg_type & (1<<5)/* dmg fall */) { return HAM_SUPERCEDE } } return HAM_IGNORED } // Equip/Deagle giving public GiveItem(TaskID) { new id = TaskID - 6910 if( !( g_bAccess[id]) || !g_iAlive[id]) { return } if(item_flags & ITEM_AMMO) { giveammo(id) refill(id) } if(!target_map) { return } if(giCounter >= alw_round_eq) { if(item_flags & ITEM_DEAGLE) { if(user_has_weapon(id,CSW_DEAGLE)) { ExecuteHamB(Ham_GiveAmmo, id, 35, "50ae", 35) }else{ drop_weapons(id, 2) fm_give_item(id,"weapon_deagle") ExecuteHamB(Ham_GiveAmmo, id, 35, "50ae", 35) } } if(item_flags & ITEM_HE) { fm_give_item(id,"weapon_hegrenade") } if(item_flags & ITEM_SMOKE) { fm_give_item(id,"weapon_smokegrenade") } if(item_flags & ITEM_FLASH) { fm_give_item(id,"weapon_flashbang") fm_give_item(id,"weapon_flashbang") } if(item_flags & ITEM_ARMOR) { fm_give_item(id,"item_assaultsuit") fm_set_user_armor(id,100) } if(item_flags & ITEM_DEFUSER) { if(get_user_team(id) == 2) { fm_give_item(id,"item_thighpack") } } } if(openmenu) { if(!cs_get_user_hasprim(id, 1) && giCounter >= alw_round_fm) { MenuCommand(id) } } } // Weapon Menu public MenuCommand(id) { new szMenu[512] // it is maximum allowed menu size new iKeys new iLen = formatex( szMenu, charsmax(szMenu), "\y%L\R%L^t^n^n", LANG_SERVER,"WEAPONS_MENU", LANG_SERVER,"ROUND") new iItemsDisabled if( !( g_bAccess[id]) || !g_iAlive[id] || CheckFlag( gbIsUsed, id )) iItemsDisabled = 1 if( iItemsDisabled || giCounter < alw_round_fm ) { iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\d1.^t%L\R\r%d^t^n", LANG_SERVER,"WEAPON_FAMAS", alw_round_fm) }else{ iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\y1.^t\w%L\R\y%d^t^n", LANG_SERVER,"WEAPON_FAMAS", alw_round_fm) iKeys |= MENU_KEY_1 } if( iItemsDisabled || giCounter < alw_round_m4ak ) { iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\d2.^t%L\R\r%d^t^n", LANG_SERVER, "WEAPON_M4A1", alw_round_m4ak) }else{ iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\y2.^t\w%L\R\y%d^t^n", LANG_SERVER, "WEAPON_M4A1", alw_round_m4ak) iKeys |= MENU_KEY_2 } if( iItemsDisabled || giCounter < alw_round_m4ak ) { iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\d3.^t%L\R\r%d^t^n", LANG_SERVER,"WEAPON_AK-47", alw_round_m4ak) }else{ iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\y3.^t\w%L\R\y%d^t^n", LANG_SERVER,"WEAPON_AK-47", alw_round_m4ak) iKeys |= MENU_KEY_3 } if( iItemsDisabled || giCounter < alw_round_awp ) { iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\d4.^t%L\R\r%d^t^n", LANG_SERVER,"WEAPON_AWP", alw_round_awp) }else{ iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\y4.^t\w%L\R\y%d^t^n", LANG_SERVER,"WEAPON_AWP", alw_round_awp) iKeys |= MENU_KEY_4 } if(!( get_user_flags(id) & buyaccess) || !g_iAlive[id] || giCounter < alw_round_buy) { iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "^n\d5.^t%L^n", LANG_SERVER,"BUY_MENU") }else{ iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "^n\y5.^t\w%L^n", LANG_SERVER,"BUY_MENU") iKeys |= MENU_KEY_5 } formatex( szMenu[iLen], charsmax(szMenu) - iLen, "^n\y0.^t\w%L", LANG_SERVER, "EXIT" ) iKeys |= MENU_KEY_0|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9 show_menu( id, iKeys, szMenu, delay, .title = "WeaponMenu" ) return PLUGIN_HANDLED } // Custom Menu public MenuCommandCustom(id) { new szMenu[512] // it is maximum allowed menu size new iKeys new usermoney = fm_get_user_money(id) new iLen = formatex( szMenu, charsmax(szMenu), "\y%L\R$^t^t%L^t^n^n", LANG_SERVER,"BUY_MENU", LANG_SERVER,"COST") new iItemsDisabled if( !( get_user_flags(id) & buyaccess) || !g_iAlive[id] /*|| CheckFlag( gbIsUsed, id )*/) iItemsDisabled = 1 if( iItemsDisabled || g_iDGLPluginId < 0 ) { iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\r1.^t%L^t^n", LANG_SERVER,"CUSTOM_DEAGLE") }else if( iItemsDisabled || usermoney < dglcost ){ iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\d1.^t%L\R\r%d^t^n", LANG_SERVER,"CUSTOM_DEAGLE", dglcost) }else{ iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\y1.^t\w%L\R\y%d^t^n", LANG_SERVER,"CUSTOM_DEAGLE", dglcost) iKeys |= MENU_KEY_1 } if( iItemsDisabled || g_iM4A1PluginId < 0 ) { iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\r2.^t%L^t^n", LANG_SERVER,"CUSTOM_M4A1") }else if( iItemsDisabled || usermoney < m4cost){ iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\d2.^t%L\R\r%d^t^n", LANG_SERVER,"CUSTOM_M4A1", m4cost) }else{ iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\y2.^t\w%L\R\y%d^t^n", LANG_SERVER,"CUSTOM_M4A1", m4cost) iKeys |= MENU_KEY_2 } if( iItemsDisabled || g_iAK47PluginId < 0 ) { iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\r3.^t%L^t^n", LANG_SERVER, "CUSTOM_AK-47") }else if( iItemsDisabled || usermoney < akcost){ iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\d3.^t%L\R\r%d^t^n", LANG_SERVER, "CUSTOM_AK-47", akcost) }else{ iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\y3.^t\w%L\R\y%d^t^n", LANG_SERVER, "CUSTOM_AK-47", akcost) iKeys |= MENU_KEY_3 } if( iItemsDisabled || g_iAWPPluginId < 0 ) { iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\r4.^t%L^t^n", LANG_SERVER, "CUSTOM_AWP") }else if( iItemsDisabled || usermoney < awpcost){ iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\d4.^t%L\R\r%d^t^n", LANG_SERVER, "CUSTOM_AWP", awpcost) }else{ iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\y4.^t\w%L\R\y%d^t^n", LANG_SERVER, "CUSTOM_AWP", awpcost) iKeys |= MENU_KEY_4 } if( !( g_bAccess[id]) || !g_iAlive[id]) { iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "^n\d5.^t%L^n", LANG_SERVER,"BACK") }else{ iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "^n\y5.^t\w%L^n", LANG_SERVER,"BACK") iKeys |= MENU_KEY_5 } formatex( szMenu[iLen], charsmax(szMenu) - iLen, "^n\y0.^t\w%L", LANG_SERVER, "EXIT" ) iKeys |= MENU_KEY_0|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9 show_menu( id, iKeys, szMenu, delay, .title = "BuyMenu" ) return PLUGIN_HANDLED } // Weapon Menu Func public MenuHandler(id, key) { if(key == KEY_EXIT - 1 || !g_iAlive[id]) return PLUGIN_HANDLED switch(key) { case 0:{ if(user_has_weapon(id,CSW_FAMAS)) { client_print(id, print_center, "%L", LANG_SERVER,"ALREADY_OWN_WEAPON") } else{ drop_weapons(id, 1) fm_give_item(id,"weapon_famas") ExecuteHamB(Ham_GiveAmmo, id, 90, "556nato", 90) SetFlag( gbIsUsed, id ) } } case 1:{ if(user_has_weapon(id,CSW_M4A1)) { client_print(id, print_center, "%L", LANG_SERVER,"ALREADY_OWN_WEAPON") } else{ drop_weapons(id, 1) fm_give_item(id,"weapon_m4a1") ExecuteHamB(Ham_GiveAmmo, id, 90, "556nato", 90) SetFlag( gbIsUsed, id ) } } case 2:{ if(user_has_weapon(id,CSW_AK47)) { client_print(id, print_center, "%L", LANG_SERVER,"ALREADY_OWN_WEAPON") } else{ drop_weapons(id, 1) fm_give_item(id,"weapon_ak47") ExecuteHamB(Ham_GiveAmmo, id, 90, "762nato", 90) SetFlag( gbIsUsed, id ) } } case 3:{ if(user_has_weapon(id,CSW_AWP)) { client_print(id, print_center, "%L", LANG_SERVER,"ALREADY_OWN_WEAPON") } else{ drop_weapons(id, 1) fm_give_item(id,"weapon_awp") ExecuteHamB(Ham_GiveAmmo, id, 30, "338magnum", 30) SetFlag( gbIsUsed, id ) } } case 4:{ MenuCommandCustom(id) } } return PLUGIN_HANDLED } // Custom Menu func public MenuHandlerCustom(id, key) { if(key == KEY_EXIT - 1 || !g_iAlive[id]) return PLUGIN_HANDLED switch(key) { case 0:{ if(g_iDGLPluginId > 0 && g_iDGLGive > 0) { callfunc_begin_i(g_iDGLGive, g_iDGLPluginId) callfunc_push_int(id) callfunc_end() // SetFlag( gbIsUsed, id ) } } case 1:{ if(g_iM4A1PluginId > 0 && g_iM4A1Give > 0) { callfunc_begin_i(g_iM4A1Give, g_iM4A1PluginId) callfunc_push_int(id) callfunc_end() // SetFlag( gbIsUsed, id ) } } case 2:{ if(g_iAK47PluginId > 0 && g_iAK47Give > 0) { callfunc_begin_i(g_iAK47Give, g_iAK47PluginId) callfunc_push_int(id) callfunc_end() // SetFlag( gbIsUsed, id ) } } case 3:{ if(g_iAWPPluginId > 0 && g_iAWPGive > 0) { callfunc_begin_i(g_iAWPGive, g_iAWPPluginId) callfunc_push_int(id) callfunc_end() // SetFlag( gbIsUsed, id ) } } case 4:{ MenuCommand(id) } } return PLUGIN_HANDLED } //================================ STOCKS ==============================// stock giveammo(id) { new weap_ids[32], num_weaps num_weaps = 0 get_user_weapons(id, weap_ids, num_weaps) for (new i = 0; i < num_weaps; i++) { new weap_id = weap_ids[i] new ammo = MAXBPAMMO[weap_id] if(!( NOCLIP_WPN_BS & (1<<weap_id))) { ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weap_id], AMMOTYPE[weap_id], MAXBPAMMO[weap_id], ammo) } } } stock refill(id) { for(new slot = 1; slot<= 2; slot++) { new iWeapon = get_pdata_cbase(id, m_rgpPlayerItems_CBasePlayer[slot]) while( iWeapon > 0 ) { new iId = fm_get_weapon_id(iWeapon) if( !( NOCLIP_WPN_BS & (1<<iId) ) ) { fm_set_weapon_ammo(iWeapon, MAXCLIP[iId]) iWeapon = get_pdata_cbase(iWeapon, m_pNext, XO_WEAPON) } } } } stock drop_weapons(id, dropwhat) { static weapons[32], num, i, weaponid num = 0 get_user_weapons(id, weapons, num) for (i = 0; i < num; i++) { weaponid = weapons[i] if((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM) || HasShield(id)) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM ))) { static wname[32] get_weaponname(weaponid, wname, charsmax(wname)) switch(droptype) { case 0: ham_strip_weapon(id, wname) case 1: engclient_cmd(id, "drop", wname) } } } } stock ham_strip_weapon(id,weapon[]) { if(!equal(weapon,"weapon_",7)) return 0 new wId = get_weaponid(weapon) if(!wId) return 0 new wEnt while((wEnt = engfunc(EngFunc_FindEntityByString, wEnt, "classname", weapon)) && pev(wEnt, pev_owner) != id) {} if(!wEnt) return 0 new iTmp if(get_user_weapon(id, iTmp, iTmp) == wId) ExecuteHamB(Ham_Weapon_RetireWeapon, wEnt) if(!ExecuteHamB(Ham_RemovePlayerItem, id, any:wEnt)) return 0 ExecuteHamB(Ham_Item_Kill, wEnt) set_pev(id, pev_weapons, pev(id, pev_weapons) & ~(1<<wId)) return 1 } stock ChatColor(const id, const input[], any:...) { new count = 1, players[32], i static msg[191] vformat(msg, 190, input, 3) replace_all(msg, 190, "!g", "^4") // Green Color replace_all(msg, 190, "!n", "^1") // Default Color replace_all(msg, 190, "!t", "^3") // Team Color if(id)players[0] = id; else get_players(players, count, "ch") { for(i = 0; i < count; i++) { if(is_user_connected(players[i])) { message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]) write_byte(players[i]) write_string(msg) message_end() } } } } stock fm_set_user_armor(index, armor) { set_pev(index, pev_armorvalue, float(armor)) return 1 } stock fm_set_user_health(index, health) { health > 0 ? set_pev(index, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, index) return 1 } stock fm_give_item(index, const item[]) { if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5)) return 0 new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item)) if (!pev_valid(ent)) return 0 new Float:origin[3] pev(index, pev_origin, origin) set_pev(ent, pev_origin, origin) set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN) dllfunc(DLLFunc_Spawn, ent) new save = pev(ent, pev_solid) dllfunc(DLLFunc_Touch, ent, index) if (pev(ent, pev_solid) != save) return ent engfunc(EngFunc_RemoveEntity, ent) return -1 } Извините если тема не компетентна ) Сам вообще не чего не понимаю ) |
Unknown | ||