War3Mod ITEM_HELM\CHARGES |
Здравствуйте, гость Вход | Регистрация
Наши новости:
|
+
) или ссылку на плагин который вызывает у вас вопросы.
|
|
War3Mod ITEM_HELM\CHARGES |
FixX
|
6.9.2011, 14:37
Сообщение
|
|
|
ничего не понятно)
исходник весь выложи а не огрызок этот |
|
|
|
Byaka
|
6.9.2011, 14:49
Сообщение
|
|
|
war3ft.sma
war3ft.sma [code=]/* AMX Mod X * Warcraft 3 Frozen Throne * * by Geesu * http://www.war3ft.com * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, the author gives permission to * link the code of this program with the Half-Life Game Engine ("HL * Engine") and Modified Game Libraries ("MODs") developed by Valve, * L.L.C ("Valve"). You must obey the GNU General Public License in all * respects for all of the code used other than the HL Engine and MODs * from Valve. If you modify this file, you may extend this exception * to your version of the file, but you are not obligated to do so. If * you do not wish to do so, delete this exception statement from your * version. */ #pragma tabsize 0 //#pragma semicolon 1 new const WC3NAME[] = "Warcraft 3 Frozen Throne"; new const WC3AUTHOR[] = "Geesu, Avanderik & YamiKaitou"; new const WC3VERSION[] = "3.0 RC13"; new const WC3DATE[] = __DATE__; // Let AMX X know that we NEED these modules (as of amx x 1.75) #pragma reqclass xstats #pragma reqlib engine #pragma reqlib fun #pragma reqlib fakemeta #pragma reqlib cstrike #pragma reqlib dodfun #pragma loadlib sqlite #pragma loadlib mysql #include <amxmodx> #include <amxmisc> #include <engine> #include <fun> #include <fakemeta> #include <cstrike> #include <dodfun> #include <dodx> #include <dbi> #include <sqlx> #include <hamsandwich> // Header files that contain function declarations and variables #include "war3ft/constants.inl" #include "war3ft/db/db_common.h" #include "war3ft/db/db_mysqlx.h" #include "war3ft/db/db_sqlite.h" #include "war3ft/items.h" #include "war3ft/dod_h.inl" #include "war3ft/XP.h" #include "war3ft/war3ft.h" #include "war3ft/cstrike.h" #include "war3ft/menus.h" #include "war3ft/shared.h" #include "war3ft/ultimates.h" // Source Code #include "war3ft/cvar.inl" #include "war3ft/race_undead.inl" // Undead Scourge - 1 #include "war3ft/race_human.inl" // Human Alliance - 2 #include "war3ft/race_orc.inl" // Orcish Horde - 3 #include "war3ft/race_elf.inl" // Night Elf - 4 #include "war3ft/race_blood.inl" // Blood Mage - 5 #include "war3ft/race_shadow.inl" // Shadow Hunter - 6 #include "war3ft/race_warden.inl" // Warden - 7 #include "war3ft/race_crypt.inl" // Crypt Lord - 8 #include "war3ft/race_chameleon.inl" // Chameleon - 9 #include "war3ft/forwards.inl" #include "war3ft/effects.inl" #include "war3ft/XP.inl" #include "war3ft/db/db_mysqlx.inl" #include "war3ft/db/db_sqlite.inl" #include "war3ft/db/db_common.inl" #include "war3ft/war3ft.inl" #include "war3ft/events.inl" #include "war3ft/clientCommands.inl" #include "war3ft/items.inl" #include "war3ft/stocks.inl" #include "war3ft/shared.inl" #include "war3ft/menus.inl" #include "war3ft/motd.inl" #include "war3ft/language.inl" #include "war3ft/admin.inl" #include "war3ft/ultimates.inl" #include "war3ft/util.inl" #include "war3ft/skill_manager.inl" #include "war3ft/cstrike.inl" #include "war3ft/dod.inl" public plugin_init() { register_plugin( WC3NAME, WC3VERSION, WC3AUTHOR ); WC3_DetermineGame(); gmsgDeathMsg = get_user_msgid( "DeathMsg" ); gmsgScreenFade = get_user_msgid( "ScreenFade" ); gmsgScreenShake = get_user_msgid( "ScreenShake" ); gmsgScoreInfo = get_user_msgid( "ScoreInfo" ); register_concmd( "playerskills" , "CMD_Handler" , -1 ); register_clcmd( "debug" , "CMD_Handler" , -1 ); register_clcmd( "levitation" , "CMD_Handler" , -1 ); register_clcmd( "war3menu" , "CMD_Handler" , -1 ); register_clcmd( "changerace" , "CMD_Handler" , -1 ); register_clcmd( "selectskill" , "CMD_Handler" , -1 ); register_clcmd( "skillsinfo" , "CMD_Handler" , -1 ); register_clcmd( "resetskills" , "CMD_Handler" , -1 ); register_clcmd( "resetxp" , "CMD_Handler" , -1 ); register_clcmd( "itemsinfo" , "CMD_Handler" , -1 ); register_clcmd( "itemsinfo2" , "CMD_Handler" , -1 ); register_clcmd( "shopmenu" , "CMD_Handler" , -1 ); register_clcmd( "shopmenu2" , "CMD_Handler" , -1 ); register_clcmd( "ability" , "CMD_Handler" , -1 ); register_clcmd( "ankh" , "CMD_Handler" , -1 ); register_clcmd( "amulet" , "CMD_Handler" , -1 ); register_clcmd( "boots" , "CMD_Handler" , -1 ); register_clcmd( "claws" , "CMD_Handler" , -1 ); register_clcmd( "cloak" , "CMD_Handler" , -1 ); register_clcmd( "chameleon" , "CMD_Handler" , -1 ); register_clcmd( "frost" , "CMD_Handler" , -1 ); register_clcmd( "gloves" , "CMD_Handler" , -1 ); register_clcmd( "health" , "CMD_Handler" , -1 ); register_clcmd( "helm" , "CMD_Handler" , -1 ); register_clcmd( "mask" , "CMD_Handler" , -1 ); register_clcmd( "mole" , "CMD_Handler" , -1 ); register_clcmd( "necklace" , "CMD_Handler" , -1 ); register_clcmd( "rings" , "CMD_Handler" , -1 ); register_clcmd( "socks" , "CMD_Handler" , -1 ); register_clcmd( "scroll" , "CMD_Handler" , -1 ); register_clcmd( "tome" , "CMD_Handler" , -1 ); register_clcmd( "level" , "CMD_Handler" , -1 ); register_clcmd( "say" , "cmd_Say" , -1 ); register_clcmd( "say_team" , "cmd_Say" , -1 ); register_clcmd( "war3help" , "CMD_Handler" , -1 ); register_clcmd( "ultimate" , "cmd_Ultimate" , -1 ); register_clcmd( "fullupdate" , "cmd_fullupdate" , -1 ); register_clcmd( "drop" , "on_Drop" , -1 ); register_clcmd( "jointeam" , "cmd_Jointeam" , -1 ); // Admin Commands register_concmd( "wc3_givexp" , "ADMIN_Handler" , -1 , " -- Gives XP to players" ); register_concmd( "wc3_setlevel" , "ADMIN_Handler" , -1 , " -- Sets a player's level" ); register_concmd( "wc3_giveitem" , "ADMIN_Handler" , -1 , " -- Gives an item to a player" ); register_concmd( "wc3_enable" , "ADMIN_Handler" , -1 , " -- Enables war3ft" ); register_concmd( "wc3_disable" , "ADMIN_Handler" , -1 , " -- Disables war3ft" ); // Depreciated Admin Commands register_concmd( "amx_givexp" , "ADMIN_Handler" , -1 , " -- Gives XP to players" ); // Server Admin Commands (used by external plugins) register_srvcmd( "amx_takexp" , "ADMIN_ServerHandler" ); register_srvcmd( "changexp" , "ADMIN_ServerHandler" ); // Register forwards (from fakemeta) register_forward( FM_TraceLine , "TRIGGER_TraceLine" ); register_event( "DeathMsg" , "on_DeathMsg" , "a" ); register_event( "CurWeapon" , "on_CurWeapon" , "be" , "1=1" ); register_event( "HideWeapon" , "on_CurWeapon" , "b" ); // register_event( "ResetHUD" , "on_ResetHud" , "b" ); register_event( "TextMsg" , "on_GameRestart" , "a" , "2&#Game_will_restart_in" ); register_event( "HLTV" , "EVENT_NewRound" , "a" , "1=0" , "2=0" ); register_dictionary( "war3FT.txt"); RegisterHam( Ham_TakeDamage, "player", "EVENT_TakeDamage" ); RegisterHam( Ham_Spawn, "player", "EVENT_Spawn", 1); // Game Specific Initialization if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO ) { gmsgBarTime = get_user_msgid( "BarTime" ); gmsgStatusText = get_user_msgid( "StatusText" ); gmsgStatusIcon = get_user_msgid( "StatusIcon" ); register_logevent( "on_PlayerAction" , 3 , "1=triggered" ); register_logevent( "on_FreezeTimeComplete" , 2 , "0=World triggered" , "1=Round_Start" ); register_logevent( "on_EndRound" , 2 , "0=World triggered" , "1=Round_End" ); register_event( "SendAudio" , "on_TerroristWin" , "a" , "2=%!MRAD_terwin" ); register_event( "SendAudio" , "on_CTWin" , "a" , "2=%!MRAD_ctwin" ); register_event( "ArmorType" , "on_ArmorType" , "be" ); register_event( "Battery" , "on_Battery" , "be" ); register_event( "WeapPickup" , "on_WeapPickup" , "b" ); register_event( "StatusValue" , "on_ShowStatus" , "be" , "1=2" ,"2!0" ); register_event( "StatusValue" , "on_HideStatus" , "be" , "1=1" ,"2=0" ); register_event( "SetFOV" , "on_Zoom" , "be" ); register_event( "BarTime" , "on_BombPlanting" , "be" , "1=3" ); register_event( "BarTime" , "on_BombStopPlanting" , "b" , "1=0" ); // Old Style register_menucmd( register_menuid( "BuyItem" ) , (1<<3) , "cmd_hegren" ); // VGUI register_menucmd( -34 , (1<<3) , "cmd_hegren" ); // Steam register_clcmd( "hegren" , "cmd_hegren" ); // Old style menu (now its jointeam client command) register_menucmd( register_menuid( "Team_Select" , 1 ) , (1<<0)|(1<<1)|(1<<4) , "cmd_Teamselect" ); // Condition Zero if ( g_MOD == GAME_CZERO ) { register_event("TextMsg", "on_GameRestart", "a", "2&#Game_Commencing") } // Counter-Strike else { register_event("TextMsg", "on_GameRestart", "a", "2&#Game_C") } } else if ( g_MOD == GAME_DOD ) { gmsgHudText = get_user_msgid( "HudText" ); register_statsfwd( XMF_SCORE ); register_statsfwd( XMF_DAMAGE ); register_event( "RoundState" , "EVENT_DOD_EndRound" , "a" , "1=3" , "1=4" ); } // Plugin initialization procedures WC3_Init(); register_concmd( "test", "test" ); register_concmd( "test2", "test2" ); } public test2(id) { /*WC3_Log( true, "[MYSQLX] Attempting to re-establish connection to MySQL server" ); // Close the connection MYSQLX_Close(); // Re-open the connection MYSQLX_Init();*/ new players[32], num, i; get_players( players, num ); for ( i = 0; i < num; i++ ) { static s_Classname[ 8 ]; pev ( i, pev_classname, s_Classname, charsmax ( s_Classname ) ); server_print( "%d: %s", i, s_Classname ); } } public test(id) { new players[32], num, i, szName[32]; get_players( players, num ); for ( i = 0; i < num; i++ ) { get_user_name( players[i], szName, 31 ); WC3_Log( true, "**** %s ****", szName ); SM_DebugPrint( players[i] ); WC3_Log( true, " %s ", szName ); } } public plugin_end() { new szCurMap[32]; get_mapname( szCurMap, 31 ); WC3_Log( false, "** Map '%s' ended", szCurMap ); if ( !WC3_Check() ) { return; } if ( !get_pcvar_num( CVAR_wc3_save_xp ) ) { return; } FWD_Destroy(); DB_SaveAll( false ); DB_Prune(); DB_Close(); return; } public plugin_precache() { WC3_Precache(); } public client_putinserver( id ) { if ( !WC3_Check() ) { return; } // Check for steam ID pending static szPlayerID[32]; get_user_authid( id, szPlayerID, 31 ); // Then the player doesn't have a steam id, lets make them reconnect if ( equal(szPlayerID, "STEAM_ID_PENDING") ) { client_cmd( id, "reconnect" ); } // Get the user's ID! DB_FetchUniqueID( id ); p_data_b[id][PB_ISCONNECTED] = true; if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO ) { // Check user's cvar if the user isn't a bot and if we're not running a 64-bit server if ( !is_user_bot( id ) && !is_amd64_server() ) { query_client_cvar( id, "cl_minmodels", "_CS_CheckMinModelsValue" ); } if ( g_MOD == GAME_CZERO ) { // Only want to run this if: mod is CZ (zbot not supported), client is a bot, // these are CZ bots (bot_quota), and the ham has not been registed yet. if ( (pev(id, pev_flags) & FL_FAKECLIENT) && get_pcvar_num(CVAR_bot_quota) > 0 && !g_bCZBotRegisterHam ) { // Delay for private data to initialize set_task( 0.1, "CZ_BotHookHam", id ) } } } // Start showing the user their money else if ( g_MOD == GAME_DOD ) { p_data[id][P_MONEY] = get_pcvar_num( CVAR_wc3_dod_start_money ); static parm[3]; parm[0] = id; parm[1] = 0; _DOD_showMoney( parm ); } return; } public client_connect( id ) { if ( !WC3_Check() ) { return; } // Initialize this player WC3_PlayerInit( id ); client_cmd( id, "hud_centerid 0" ); p_data[id][P_RESPAWNBY] = 0; p_data[id][P_SPECMODE] = 0; p_data_b[id][PB_ISBURNING] = false; p_data_b[id][PB_JUSTJOINED] = true; p_data_b[id][PB_CAN_RENDER] = true; p_data_b[id][PB_HAS_SPAWNED] = false; p_data_b[id][PB_SKINSWITCHED] = false; // User should have no items on connect... g_iShopMenuItems[id][0] = -1; g_iShopMenuItems[id][1] = -1; // Automatically set their XP if it's enabled if ( get_pcvar_num( CVAR_wc3_xp_auto_average ) && !get_pcvar_num( CVAR_wc3_save_xp ) ) { new iTotalXP; new iNum, i; for( i = 1; i <= MAXPLAYERS; i++ ) { if ( p_data[i][P_XP] > 0 ) { iNum++; iTotalXP += p_data[i][P_XP]; } } if ( iNum > 0 && iTotalXP > 0 ) { p_data[id][P_XP] = iTotalXP/iNum; } } if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO ) { p_data[id][P_HECOUNT] = 0; p_data[id][P_FLASHCOUNT] = 0; } else if ( g_MOD == GAME_DOD ) { p_data[id][P_MONEY] = 0; } // Reset the "cheat" variables new j; for ( j = 0; j < MAX_RACES; j++ ) { g_bGivenLevel10[id][j] = false; } CS_GetIcon( id ); return; } public client_disconnect( id ) { if ( !WC3_Check() ) { return; } // Update the user's timestamps for each race if we're saving XP DB_UpdateTimestamp( id ); // Remove the money task when a user disconnects if ( g_MOD == GAME_DOD ) { task_exists( TASK_MONEYLOOP + id ) ? remove_task( TASK_MONEYLOOP + id ) : 0; } p_data[id][P_SPECMODE] = 0; p_data_b[id][PB_ISBURNING] = false; p_data_b[id][PB_DIEDLASTROUND] = false; p_data_b[id][PB_JUSTJOINED] = false; p_data_b[id][PB_ISCONNECTED] = false; bIgnoreArmorSet[id] = false; // Reset xp assist for ( new i = 0; i < MAXPLAYERS; i++ ) { g_iDamageDealt[id][i] = 0; } // Save the user's XP if we have XP to save if ( get_pcvar_num( CVAR_wc3_save_xp ) && !is_user_bot(id) && p_data[id][P_RACE] && p_data[id][P_XP] ) { DB_SaveXP( id, true ); } if ( get_pcvar_num( CVAR_wc3_psychostats ) ) { static szWeapon[64]; static szTeam[16], szName[32], szAuthid[32]; new iWeap, iUserid = get_user_userid( id ); if ( is_user_connected(id) ) { get_user_team( id, szTeam, 15 ); } get_user_name( id, szName, 31 ); get_user_authid( id, szAuthid, 31 ); for ( iWeap = CSW_WAR3_MIN; iWeap <=CSW_WAR3_MAX; iWeap++ ) { format( szWeapon, 63, "" ); switch( iWeap ) { case CSW_LIGHTNING: LANG_GetSkillName( ULTIMATE_CHAINLIGHTNING , LANG_SERVER, szWeapon , 63, 20 ); case CSW_SUICIDE: LANG_GetSkillName( ULTIMATE_SUICIDE , LANG_SERVER, szWeapon , 63, 21 ); case CSW_IMMOLATE: LANG_GetSkillName( ULTIMATE_IMMOLATE , LANG_SERVER, szWeapon , 63, 22 ); case CSW_LOCUSTS: LANG_GetSkillName( ULTIMATE_LOCUSTSWARM , LANG_SERVER, szWeapon , 63, 23 ); case CSW_SERPENTWARD: LANG_GetSkillName( SKILL_SERPENTWARD , LANG_SERVER, szWeapon , 63, 24 ); case CSW_SHADOW: LANG_GetSkillName( SKILL_SHADOWSTRIKE , LANG_SERVER, szWeapon , 63, 25 ); case CSW_THORNS: LANG_GetSkillName( SKILL_THORNS , LANG_SERVER, szWeapon , 63, 26 ); case CSW_CARAPACE: LANG_GetSkillName( SKILL_SPIKEDCARAPACE , LANG_SERVER, szWeapon , 63, 27 ); case CSW_CARRION: LANG_GetSkillName( SKILL_CARRIONBEETLES , LANG_SERVER, szWeapon , 63, 28 ); case CSW_ORB: LANG_GetSkillName( PASS_ORB , LANG_SERVER, szWeapon , 63, 29 ); case CSW_CONCOCTION: LANG_GetSkillName( PASS_UNSTABLECONCOCTION , LANG_SERVER, szWeapon , 63, 30 ); } replace( szWeapon, 63, " ", "_" ); new WEAPON = iWeap - CSW_WAR3_MIN; if ( iStatsShots[id][WEAPON] || iStatsHits[id][WEAPON] || iStatsKills[id][WEAPON] || iStatsHS[id][WEAPON] || iStatsTKS[id][WEAPON] || iStatsDamage[id][WEAPON] || iStatsDeaths[id][WEAPON] || iStatsHead[id][WEAPON] || iStatsChest[id][WEAPON] || iStatsStomach[id][WEAPON] || iStatsLeftArm[id][WEAPON] || iStatsRightArm[id][WEAPON] || iStatsLeftLeg[id][WEAPON] || iStatsRightLeg[id][WEAPON] ) { // Counter-Strike/Condition Zero log format is different than the DOD if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO ) { log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^")", szName, iUserid, szAuthid, szTeam, szWeapon, iStatsShots[id][WEAPON], iStatsHits[id][WEAPON], iStatsKills[id][WEAPON], iStatsHS[id][WEAPON], iStatsTKS[id][WEAPON], iStatsDamage[id][WEAPON], iStatsDeaths[id][WEAPON] ); } // Day of Defeat log format else if ( g_MOD == GAME_DOD ) { log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^") (score ^"%d^")", szName, iUserid, szAuthid, szTeam, szWeapon, iStatsShots[id][WEAPON], iStatsHits[id][WEAPON], iStatsKills[id][WEAPON], iStatsHS[id][WEAPON], iStatsTKS[id][WEAPON], iStatsDamage[id][WEAPON], iStatsDeaths[id][WEAPON], 0 ); } log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats2^" (weapon ^"%s^") (head ^"%d^") (chest ^"%d^") (stomach ^"%d^") (leftarm ^"%d^") (rightarm ^"%d^") (leftleg ^"%d^") (rightleg ^"%d^")", szName, iUserid, szAuthid, szTeam, szWeapon, iStatsHead[id][WEAPON], iStatsChest[id][WEAPON], iStatsStomach[id][WEAPON], iStatsLeftArm[id][WEAPON], iStatsRightArm[id][WEAPON], iStatsLeftLeg[id][WEAPON], iStatsRightLeg[id][WEAPON] ); iStatsShots[id][WEAPON] = 0; iStatsHits[id][WEAPON] = 0; iStatsKills[id][WEAPON] = 0; iStatsHS[id][WEAPON] = 0; iStatsTKS[id][WEAPON] = 0; iStatsDamage[id][WEAPON] = 0; iStatsDeaths[id][WEAPON] = 0; iStatsHead[id][WEAPON] = 0; iStatsChest[id][WEAPON] = 0; iStatsStomach[id][WEAPON] = 0; iStatsLeftArm[id][WEAPON] = 0; iStatsRightArm[id][WEAPON] = 0; iStatsLeftLeg[id][WEAPON] = 0; iStatsRightLeg[id][WEAPON] = 0; } } } } public client_PreThink( id ) { if ( !WC3_Check() ) { return; } if ( p_data_b[id][PB_ISCONNECTED] ) { if ( is_user_alive( id ) ) { // Counter-Strike or Condition Zero if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO ) { // This is used so we can't hear the undead's footsteps at level 3 if ( SM_GetSkillLevel( id, SKILL_UNHOLYAURA ) > 0 && !p_data_b[id][PB_STUNNED] && !p_data_b[id][PB_SLOWED] ) { new Float:vel[3]; entity_get_vector( id, EV_VEC_velocity, vel ); // When this is true, the user is walking... lets hope :P if ( vector_length( vel ) < 180.0 ) { entity_set_int( id, EV_INT_flTimeStepSound, 999 ); } // Otherwise if we just set it on the previous tick we need to set it back else if ( entity_get_int(id, EV_INT_flTimeStepSound) > 500 ) { entity_set_int( id, EV_INT_flTimeStepSound, 200 ); } } } // Day of Defeat else if ( g_MOD == GAME_DOD ) { // Set the user's speed SHARED_SetSpeed( id ); static iSkillLevel; iSkillLevel = SM_GetSkillLevel( id, SKILL_UNHOLYAURA ); // Give the user more stamina if ( iSkillLevel > 0 ) { if ( entity_get_float( id, EV_FL_fuser4 ) < p_unholy_dod[iSkillLevel-1] ) { entity_set_float( id, EV_FL_fuser4, p_unholy_dod[iSkillLevel-1] ); } } // Give the user more stamina if ( ITEM_Has( id, ITEM_BOOTS ) > ITEM_NONE && entity_get_float( id, EV_FL_fuser4 ) < DOD_BOOT_SPEED ) { entity_set_float( id, EV_FL_fuser4, DOD_BOOT_SPEED ); } } // Amulet of the Cat if ( ITEM_Has( id, ITEM_AMULET ) > ITEM_NONE ) { entity_set_int( id, EV_INT_flTimeStepSound, 999 ); } } // User is dead else { // Check to see if spectated player has changed new iTarget = entity_get_int( id, EV_INT_iuser2 ); new Float:fTime = halflife_time(); // Then we are looking at a new player or the last hud message has disappeared if ( g_iSpectatingID[id] != iTarget || g_fLastSpecDisplay[id] <= fTime ) { // We have a valid target!! if ( SHARED_ValidPlayer( iTarget ) && iTarget != id ) { WC3_ShowSpecInfo( id, iTarget ); g_fLastSpecDisplay[id] = fTime + SPEC_HOLDTIME; } g_iSpectatingID[id] = iTarget; } } } return; } public plugin_natives() { set_module_filter( "module_filter" ); set_native_filter( "native_filter" ); set_error_filter( "error_filter" ); } public error_filter( error_code, bool:debugging, message[] ) { new szBuffer[256]; dbg_fmt_error( szBuffer, 255 ); log_amx( "[ERROR] '%s' '%d' '%d' '%s'", message, error_code, debugging, szBuffer ); //L 12/27/2006 - 16:48:08: [war3ft.amxx] [ERROR] '[CSTRIKE] Invalid player 5' '10' '1' 'Run time error 10: native error (native "cs_set_user_money")' // We want to ignore invalid player messages that are generated by cstrike! - they're annoying + don't actually matter all that much... /*if ( error_code == AMX_ERR_NATIVE ) { if ( containi( message, "" ) ) { } }*/ } public module_filter( const module[] ) { WC3_DetermineGame(); // We don't need the cstrike module when we're DOD if ( g_MOD == GAME_DOD && equal( module, "cstrike" ) ) { return PLUGIN_HANDLED; } // And we don't need any dod modules when we're in CS/CZ! else if ( ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO ) && equal( module, "dodfun" ) ) { return PLUGIN_HANDLED; } // We don't need to display a message, we'll display it later if we need to (when the DB is set up if XP Saving is on) else if ( equal( module, "dbi" ) || equal( module, "sqlx" ) ) { return PLUGIN_HANDLED; } // Dammit plugin can't load now :/ - technically we should never get here unless the module doesn't exist in the modules folder else { WC3_Log( true, "Please enable the '%s' module in your modules.ini file", module ); return PLUGIN_CONTINUE; } return PLUGIN_HANDLED; } public native_filter( const name[], index, trap ) { if ( !trap ) { return PLUGIN_HANDLED; } return PLUGIN_CONTINUE; } [/code] items.h items.h Код * Item Defines /**/ // Item Values #define DOD_BOOT_SPEED 45.0 // Item Charge Defines #define NECKLACE_CHARGES 99 #define HELM_CHARGES 99 #define CHARGE_DISPOSE 1 #define RING_INCREMENT 1 // Item Variable Defines #define MAX_SHOPMENU_ITEMS 18 #define MAX_PLAYER_ITEMS 2 #define MAX_PAGE_ITEMS 9 #define ITEM_SLOT_ONE 0 #define ITEM_SLOT_TWO 1 #define ITEM_SLOT_FULL 2 #define ITEM_NONE -1 #define ITEM_ANKH 0 #define ITEM_BOOTS 1 #define ITEM_CLAWS 2 #define ITEM_CLOAK 3 #define ITEM_MASK 4 #define ITEM_NECKLACE 5 #define ITEM_FROST 6 #define ITEM_HEALTH 7 #define ITEM_TOME 8 #define ITEM_SCROLL 9 #define ITEM_PROTECTANT 10 #define ITEM_HELM 11 #define ITEM_AMULET 12 #define ITEM_SOCK 13 #define ITEM_GLOVES 14 #define ITEM_RING 15 #define ITEM_CHAMELEON 16 #define ITEM_MOLE 17 #define MAX_ITEMS_PAGE 9 // Item Variables new g_iShopMenuItems[33][MAX_PLAYER_ITEMS]; // Holds the player\'s current items new g_iFutureItem[33]; // Holds the item that the player wants to buy new g_iTotalRings[33]; // Holds the number of rings the player has new g_iNecklaceCharges[33]; // Holds the number of charges left in the player\'s necklace new g_iHelmCharges[33]; // Holds the number of charges left in the player\'s helm new bool:g_bPlayerBoughtAnkh[33]; // Set to true when a user buys an ankh new bool:g_bPlayerBoughtMole[33]; // Set to true when a user buys a mole new g_iGloveTimer[33]; // Keeps track of how much time is left to give a user a grenade new ITEM_COST[MAX_SHOPMENU_ITEMS]; // Holds the price of an item #define ITEM_CHARGEABLE 1 #define ITEM_USEONBUY 2 #define ITEM_BUYWHENDEAD 4 #define ITEM_NEXTROUNDUSE 8 new g_iFlag[MAX_SHOPMENU_ITEMS] = {0}; // Stores information about items #define ITEM_COST_RATIO 1 items.inl items.inl Код /* * Item Functions */ // Item Setup Functions ITEM_Init() { ITEM_COST[ITEM_ANKH] = 1500; // Ankh of Reincarnation ITEM_COST[ITEM_BOOTS] = 2500; // Boots of Speed ITEM_COST[ITEM_CLAWS] = 1000; // Claws of Attack ITEM_COST[ITEM_CLOAK] = 800; // Cloak of Shadows ITEM_COST[ITEM_MASK] = 2000; // Mask of Death ITEM_COST[ITEM_NECKLACE] = 800; // Necklace of Immunity ITEM_COST[ITEM_FROST] = 2000; // Orb of Frost ITEM_COST[ITEM_HEALTH] = 1000; // Periapt of Health ITEM_COST[ITEM_TOME] = 3000; // Tome of Experience ITEM_COST[ITEM_SCROLL] = 7500; // Scroll of Respawning ITEM_COST[ITEM_PROTECTANT] = 1500; // Mole Protectant ITEM_COST[ITEM_HELM] = 1500; // Helm of Excellence ITEM_COST[ITEM_AMULET] = 1500; // Amulet of the Cat ITEM_COST[ITEM_SOCK] = 1500; // Sock of the Feather ITEM_COST[ITEM_GLOVES] = 1750; // Flaming Gloves of Warmth ITEM_COST[ITEM_RING] = 1000; // Ring of Regeneration + 1 ITEM_COST[ITEM_CHAMELEON] = 9000; // Chameleon ITEM_COST[ITEM_MOLE] = 16000; // Mole // Item costs are a little different for DOD if ( g_MOD == GAME_DOD ) { ITEM_COST[ITEM_SCROLL] = 800; } // Items are chargeable g_iFlag[ITEM_NECKLACE] |= ITEM_CHARGEABLE; g_iFlag[ITEM_HELM] |= ITEM_CHARGEABLE; g_iFlag[ITEM_RING] |= ITEM_CHARGEABLE; // Items should be used when bought g_iFlag[ITEM_TOME] |= ITEM_USEONBUY; // Items CAN be bought when dead g_iFlag[ITEM_ANKH] |= ITEM_BUYWHENDEAD; g_iFlag[ITEM_SCROLL] |= ITEM_BUYWHENDEAD; g_iFlag[ITEM_MOLE] |= ITEM_BUYWHENDEAD; g_iFlag[ITEM_TOME] |= ITEM_BUYWHENDEAD; // Items are used when the next round starts... g_iFlag[ITEM_ANKH] |= ITEM_NEXTROUNDUSE; g_iFlag[ITEM_MOLE] |= ITEM_NEXTROUNDUSE; } // We created this to allow for different prices of items at different levels ITEM_Cost( id, iItem ) { // How much should ratio increase per level? new Float:fInc = ( 1.0 - ITEM_COST_RATIO ) / float( MAX_LEVELS ); // Cost * ratio (ITEM_COST_RATIO to 1.0 dependent on level) new Float:fRatio = (float( p_data[id][P_LEVEL] ) * fInc) + ITEM_COST_RATIO; return ( p_data[id][P_RACE] != RACE_NONE ) ? floatround( float( ITEM_COST[iItem] ) * fRatio ) : ITEM_COST[iItem]; } public ITEM_CanBuy( id, iItem ) { // User doesn\'t have the money if ( SHARED_GetUserMoney( id ) < ITEM_Cost( id, iItem ) ) { client_print( id, print_center, \"%L\", id, \"INSUFFICIENT_FUNDS\" ); return false; } // User already owns the item and it\'s not a chargeable item! else if ( ITEM_Has( id, iItem ) > ITEM_NONE && !ITEM_CheckFlag( iItem, ITEM_CHARGEABLE ) ) { client_print( id, print_center, \"%L\", id, \"ALREADY_OWN_THAT_ITEM\" ); return false; } // Make sure these items can be bought if the user is dead else if ( !is_user_alive( id ) && !ITEM_CheckFlag( iItem, ITEM_BUYWHENDEAD ) ) { client_print( id, print_center, \"%L\", id, \"NOT_PURCHASE_WHEN_DEAD\" ); return false; } // User has necklace + blink, they don\'t need a necklace else if ( iItem == ITEM_NECKLACE && p_data_b[id][PB_WARDENBLINK] ) { client_print( id, print_center, \"You are already immune to ultimates through one of your skills!\" ); return false; } // User doesn\'t need an ankh if they\'re going to reincarnate else if ( iItem == ITEM_ANKH && SM_GetSkillLevel( id, SKILL_REINCARNATION ) == 3 && !p_data[id][P_CHANGERACE] && p_data[id][P_RACE] != RACE_CHAMELEON ) { client_print( id, print_center, \"You will already reincarnate your weapons through one of your skills!\" ); return false; } // User has purchased the maximum allowed rings else if ( g_iTotalRings[id] >= 5 && iItem == ITEM_RING ) { client_print( id, print_center, \"%L\", id, \"NOT_PURCHASE_MORE_THAN_FIVE_RINGS\" ); return false; } // User has purchased gloves when they\'re disabled on this map else if ( iItem == ITEM_GLOVES && g_bGlovesDisabled ) { client_print( id, print_chat, \"Gloves are disabled on this map!\" ); return false; } // User is already going to reincarnate weapons because they bought an ankh earlier (probably lost it when died) else if ( ( iItem == ITEM_ANKH && g_bPlayerBoughtAnkh[id] ) || ( iItem == ITEM_MOLE && g_bPlayerBoughtMole[id] ) ) { client_print( id, print_center, \"%L\", id, \"ALREADY_OWN_THAT_ITEM\" ); return false; } return true; } public ITEM_Buy( id, iItem ) { // If the user can buy this item... if ( ITEM_CanBuy( id, iItem ) ) { // User\'s items are full if ( ITEM_GetSlot( id ) == ITEM_SLOT_FULL && !ITEM_CheckFlag( iItem, ITEM_USEONBUY ) ) { // We only care about items being full if this item isn\'t a use on buy if ( !ITEM_CheckFlag( iItem, ITEM_USEONBUY ) ) { new bool:bShowReplaceMenu = false; // One time use... if ( !ITEM_CheckFlag( iItem, ITEM_CHARGEABLE ) ) { //client_print( id, print_chat, \"[DEBUG] Item is not chargeable\" ); bShowReplaceMenu = true; } // We also need to replace it if the item is chargeable but they don\'t own that item if ( ITEM_Has( id, iItem ) == ITEM_NONE && ITEM_CheckFlag( iItem, ITEM_CHARGEABLE ) ) { //client_print( id, print_chat, \"[DEBUG] Doesn\'t have item and new item is chargeable\" ); bShowReplaceMenu = true; } if ( bShowReplaceMenu ) { g_iFutureItem[id] = iItem; MENU_ReplaceItem( id ); return; } } } // We\'re clear! // Remove user\'s money new iNewMoney = SHARED_GetUserMoney( id ) - ITEM_Cost( id, iItem ); SHARED_SetUserMoney( id, iNewMoney ); ITEM_GiveItem( id, iItem ); } return; } // Item Buy Functions bool:ITEM_MenuCanBuyCheck( id ) { // Duh how can they buy if they\'re dead! if ( !p_data_b[id][PB_ISCONNECTED] ) { return false; } new isPlayerAlive = is_user_alive( id ); if ( !get_pcvar_num( CVAR_wc3_buy_dead ) && !isPlayerAlive ) { client_print( id, print_center, \"%L\", id, \"NOT_BUY_ITEMS_WHEN_DEAD\" ); return false; } else if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO ) { new isPlayerInBuyZone = cs_get_user_buyzone( id ) if ( get_pcvar_num( CVAR_wc3_buy_time ) && !g_buyTime ) { client_print( id, print_center, \"%L\", id, \"SECONDS_HAVE_PASSED_CANT_BUY\", ( get_cvar_float( \"mp_buytime\" ) * 60.0 ) ); return false; } else if ( get_pcvar_num( CVAR_wc3_buy_zone ) && !isPlayerInBuyZone && isPlayerAlive ) { client_print( id, print_center, \"%L\", id, \"MUST_BE_IN_BUYZONE\" ); return false; } } return true; } // Item Preset Function ITEM_GiveItem( id, iItem ) { // This item we should use instantly if ( ITEM_CheckFlag( iItem, ITEM_USEONBUY ) ) { if ( iItem == ITEM_TOME ) { ITEM_Tome( id ); return; } } // They are just adding some charges else { // Actually set our item variable if ( is_user_alive( id ) ) { ITEM_Equip( id, iItem ); } // Display message to the user regarding the item they just purchased ITEM_DisplayMessage( id, iItem ); // Give bonuses ITEM_GiveBonuses( id, iItem ); // Play purchase sound emit_sound( id, CHAN_STATIC, g_szSounds[SOUND_PICKUPITEM], 1.0, ATTN_NORM, 0, PITCH_NORM ); } WC3_ShowBar( id ); return; } ITEM_DisplayMessage( id, iItem ) { // Display a message regarding the item they just purchased switch ( iItem ) { case ITEM_ANKH: { (g_MOD == GAME_DOD) ? client_print( id, print_chat,\"%s %L\", g_MODclient, id, \"DOD_INFO_SHOPMENU_1\" ) : 0; (g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO) ? client_print( id, print_chat,\"%s %L\", g_MODclient, id, \"INFO_SHOPMENU_1\" ) : 0; } case ITEM_BOOTS: { if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO ) { client_print( id, print_chat,\"%s %L\", g_MODclient, id, \"INFO_SHOPMENU_2\", ( ( get_pcvar_float( CVAR_wc3_boots ) ) * 100.00 ) ); } else if ( g_MOD == GAME_DOD ) { client_print( id, print_chat,\"%s %L\", g_MODclient, id, \"DOD_INFO_SHOPMENU_2\" ); } } case ITEM_CLAWS: { client_print( id, print_chat,\"%s %L\", g_MODclient, id, \"INFO_SHOPMENU_3\", get_pcvar_num( CVAR_wc3_claw ) ); } case ITEM_CLOAK: { new Float:fInvis = 100.0 * ( float( get_pcvar_num( CVAR_wc3_cloak ) ) / 255.0 ); client_print(id, print_chat,\"%s %L\", g_MODclient, id, \"INFO_SHOPMENU_4\", fInvis ); } case ITEM_MASK: { new Float:fMask = ( 100.0 * get_pcvar_float( CVAR_wc3_mask ) ); client_print(id, print_chat,\"%s %L\", g_MODclient, id, \"INFO_SHOPMENU_5\", fMask ); } case ITEM_NECKLACE: { client_print( id, print_chat, \"%s %L\", g_MODclient, id, \"INFO_SHOPMENU_6\", NECKLACE_CHARGES ); } case ITEM_FROST: { new Float:fFrost = 100.0 * ( get_pcvar_float( CVAR_wc3_frost ) / 260.0 ); client_print(id, print_chat,\"%s %L\", g_MODclient, id, \"INFO_SHOPMENU_7\", fFrost ); } case ITEM_HEALTH: { client_print(id, print_chat,\"%s %L\", g_MODclient, id, \"INFO_SHOPMENU_8\", get_pcvar_num( CVAR_wc3_health ) ); } case ITEM_SCROLL: { if ( is_user_alive( id ) ) { client_print( id, print_chat, \"%s %L\", g_MODclient, id, \"INFO_SHOPMENU2_1\" ); } else { client_print( id, print_chat, \"%s %L\", g_MODclient, id, \"INFO_SHOPMENU2_1_DEAD\" ); } } case ITEM_PROTECTANT: { client_print( id, print_chat, \"%s %L\", g_MODclient, id, \"INFO_SHOPMENU2_2\" ); } case ITEM_HELM: { client_print( id, print_chat, \"%s %L\", g_MODclient, id, \"INFO_SHOPMENU2_3\", HELM_CHARGES ); } case ITEM_AMULET: { client_print( id, print_chat, \"%s %L\", g_MODclient, id, \"INFO_SHOPMENU2_4\" ); } case ITEM_SOCK: { client_print( id, print_chat, \"%s %L\", g_MODclient, id, \"INFO_SHOPMENU2_5\" ); } case ITEM_GLOVES: { client_print( id, print_chat, \"%s %L\", g_MODclient, id, \"INFO_SHOPMENU2_6\", get_pcvar_num( CVAR_wc3_glove_timer ) ); } case ITEM_RING: { client_print( id, print_chat, \"%s %L\", g_MODclient, id, \"INFO_SHOPMENU2_7\" ); } case ITEM_CHAMELEON: { client_print( id, print_chat, \"%s %L\", g_MODclient, id, \"INFO_SHOPMENU2_8\" ); } case ITEM_MOLE: { client_print( id, print_chat, \"%s %L\", g_MODclient, id, \"INFO_SHOPMENU2_9\" ); } } } // Give the user bonuses for their items (except charges) ITEM_GiveAllBonuses( id ) { // Loop through all item slots for ( new i = ITEM_SLOT_ONE; i <= ITEM_SLOT_TWO; i++ ) { // Do we have a valid item here? if ( g_iShopMenuItems[id][i] != ITEM_NONE ) { // Don\'t want to give the user more charges for free do we? // And we don\'t want to give the bonuses if this is a next round use item (i.e. if we do then mole for infinity - that doesn\'t seem nice) if ( !ITEM_CheckFlag( g_iShopMenuItems[id][i], ITEM_CHARGEABLE ) && !ITEM_CheckFlag( g_iShopMenuItems[id][i], ITEM_NEXTROUNDUSE ) ) { ITEM_GiveBonuses( id, g_iShopMenuItems[id][i] ); } } } } // Give our players their bonus! ITEM_GiveBonuses( id, iItem ) { // Display a message regarding the item they just purchased switch ( iItem ) { case ITEM_ANKH: { g_bPlayerBoughtAnkh[id] = true; } case ITEM_BOOTS: { SHARED_SetSpeed( id ); } case ITEM_CLOAK: { SHARED_INVIS_Set( id ); } case ITEM_NECKLACE: { g_iNecklaceCharges[id] += NECKLACE_CHARGES; } case ITEM_HEALTH: { new iHealth = get_pcvar_num( CVAR_wc3_health ); iHealth += get_user_health( id ); set_user_health( id, iHealth ); } case ITEM_SCROLL: { if ( !is_user_alive( id ) ) { ITEM_Scroll( id ); } } case ITEM_HELM: { g_iHelmCharges[id] += HELM_CHARGES; } case ITEM_SOCK: { SHARED_SetGravity( id ); } case ITEM_GLOVES: { ITEM_Gloves( id ); } case ITEM_RING: { g_iTotalRings[id] += RING_INCREMENT; if ( !task_exists( TASK_ITEM_RING + id ) ) { _ITEM_Ring( id ); } } case ITEM_CHAMELEON: { SHARED_ChangeSkin( id, SKIN_SWITCH ); } case ITEM_MOLE: { g_bPlayerBoughtMole[id] = true; } } } // Item Equip Function ITEM_Equip( id, iItem ) { new iItemSlot = ITEM_GetSlot( id ); // Items are not full if ( iItemSlot != ITEM_SLOT_FULL ) { new iOldItem = g_iShopMenuItems[id][iItemSlot]; if ( iItem == iOldItem || ITEM_Has( id, iItem ) > ITEM_NONE ) { // Might hit this if we added charges - we want to update the user\'s HUD WC3_ShowBar( id ); return; } // Remove the user\'s old item if necessary else if ( g_iShopMenuItems[id][iItemSlot] > ITEM_NONE ) { ITEM_Remove( id, iItemSlot ); } // Set their new item g_iShopMenuItems[id][iItemSlot] = iItem; } WC3_ShowBar( id ); return; } // Item Remove Functions ITEM_RemoveID( id, iItem ) { new iItemSlot = ITEM_Has( id, iItem ); if ( iItemSlot > ITEM_NONE ) { ITEM_Remove( id, iItemSlot ); } return; } ITEM_Remove( id, iItemSlot, bResetAnkhMole = true ) { new iItem = g_iShopMenuItems[id][iItemSlot]; g_iShopMenuItems[id][iItemSlot] = ITEM_NONE; switch( iItem ) { case ITEM_ANKH: { if ( bResetAnkhMole ) { g_bPlayerBoughtAnkh[id] = false; } } case ITEM_BOOTS: { SHARED_SetSpeed( id ); } case ITEM_CLOAK: { SHARED_INVIS_Set( id ); } case ITEM_NECKLACE: { g_iNecklaceCharges[id] = 0; } case ITEM_HEALTH: { new iNewHealth = get_user_health( id ) - get_pcvar_num( CVAR_wc3_health ); // Lets not kill the user, give them 1 health iNewHealth = ( ( iNewHealth <= 0 ) ? 1 : iNewHealth ); set_user_health( id, iNewHealth ); } case ITEM_HELM: { g_iHelmCharges[id] = 0; } case ITEM_SOCK: { SHARED_SetGravity( id ); } case ITEM_GLOVES: { if ( task_exists( TASK_ITEM_GLOVES + id ) ) { remove_task( TASK_ITEM_GLOVES + id ); } } case ITEM_RING: { if ( task_exists( TASK_ITEM_RING + id ) ) { remove_task( TASK_ITEM_RING + id ); } // Set the number of rings to 0 g_iTotalRings[id] = 0; } case ITEM_CHAMELEON: { SHARED_ChangeSkin( id, SKIN_RESET ); } case ITEM_MOLE: { if ( bResetAnkhMole ) { g_bPlayerBoughtMole[id] = false; } } } WC3_ShowBar( id ); return; } ITEM_RemoveCharge( id, iItem ) { if ( ITEM_Has( id, iItem ) > ITEM_NONE ) { switch ( iItem ) { case ITEM_NECKLACE: { g_iNecklaceCharges[id] -= CHARGE_DISPOSE; if ( g_iNecklaceCharges[id] <= 0 ) { ITEM_RemoveID( id, iItem ); } } case ITEM_HELM: { g_iHelmCharges[id] -= CHARGE_DISPOSE; if ( g_iHelmCharges[id] <= 0 ) { ITEM_RemoveID( id, iItem ); } } case ITEM_RING: { g_iTotalRings[id] -= CHARGE_DISPOSE; if ( g_iTotalRings[id] <= 0 ) { ITEM_RemoveID( id, iItem ); } } } } WC3_ShowBar( id ); return; } // Item Get Functions ITEM_GetSlot( id ) { if ( g_iShopMenuItems[id][ITEM_SLOT_ONE] > ITEM_NONE && g_iShopMenuItems[id][ITEM_SLOT_TWO] > ITEM_NONE ) return ITEM_SLOT_FULL; else if ( g_iShopMenuItems[id][ITEM_SLOT_ONE] > ITEM_NONE ) return ITEM_SLOT_TWO; return ITEM_SLOT_ONE; } ITEM_Has( id, iItem ) { if ( g_iShopMenuItems[id][ITEM_SLOT_ONE] == iItem ) return ITEM_SLOT_ONE; else if ( g_iShopMenuItems[id][ITEM_SLOT_TWO] == iItem ) return ITEM_SLOT_TWO; return ITEM_NONE; } // Item Death Function ITEM_UserDied( id ) { // The user just died, remove all items if ( g_iShopMenuItems[id][ITEM_SLOT_ONE] > ITEM_NONE ) { ITEM_Remove( id, ITEM_SLOT_ONE, false ); } if ( g_iShopMenuItems[id][ITEM_SLOT_TWO] > ITEM_NONE ) { ITEM_Remove( id, ITEM_SLOT_TWO, false ); } } // Item Specific Functions ITEM_Offensive( iAttacker, iVictim, iWeapon, iDamage, iHitPlace ) { // Claws of Attack if ( ITEM_Has( iAttacker, ITEM_CLAWS ) > ITEM_NONE ) { WC3_Damage( iVictim, iAttacker, get_pcvar_num( CVAR_wc3_claw ), iWeapon, iHitPlace ); SHARED_Glow( iAttacker, (2 * get_pcvar_num( CVAR_wc3_claw ) ), 0, 0, 0 ); Create_ScreenFade( iVictim, (1<<10), (1<<10), (1<<12), 255, 0, 0, g_GlowLevel[iVictim][0] ); } // Mask of Death if ( ITEM_Has( iAttacker, ITEM_MASK ) > ITEM_NONE && p_data_b[iAttacker][PB_ISCONNECTED]) { new iHealth = get_user_health( iAttacker ); new iBonusHealth = floatround( float( iDamage ) * get_pcvar_float( CVAR_wc3_mask ) ); new iVampiricBonus = p_data_b[iAttacker][PB_HEXED] ? 0 : SM_GetSkillLevel( iAttacker, SKILL_VAMPIRICAURA ); // Then the user already gets a bonus, lets lower the total amount the user is going to get if ( iVampiricBonus > 0 ) { iBonusHealth /= iVampiricBonus; } // User needs to be set to max health if ( iHealth + iBonusHealth > get_user_maxhealth( iAttacker ) ) { set_user_health( iAttacker, get_user_maxhealth( iAttacker ) ); } // Give them bonus else { set_user_health( iAttacker, iHealth + iBonusHealth ); } SHARED_Glow( iAttacker, 0, iBonusHealth, 0, 0 ); Create_ScreenFade( iAttacker, (1<<10), (1<<10), (1<<12), 0, 255, 0, g_GlowLevel[iAttacker][1] ); } // Orb of Frost if ( ITEM_Has( iAttacker, ITEM_FROST ) > ITEM_NONE ) { // Only slow them if they aren\'t slowed/stunned already if ( !SHARED_IsPlayerSlowed( iVictim ) ) { p_data_b[iVictim][PB_SLOWED] = true; SHARED_SetSpeed( iVictim ); set_task( 1.0, \"SHARED_ResetMaxSpeed\", TASK_RESETSPEED + iVictim ); SHARED_Glow( iAttacker, 0, 0, 0, 100 ); Create_ScreenFade( iVictim, (1<<10), (1<<10), (1<<12), 255, 255, 255, g_GlowLevel[iVictim][3] ); } } } ITEM_Tome( id ) { new iXp = get_pcvar_num( CVAR_wc3_tome ) + XP_GivenByLevel( p_data[id][P_LEVEL] ); if ( g_MOD == GAME_DOD ) { iXp *= 2; } new iBonusXP = XP_Give( id, iXp ); if ( iBonusXP != 0 ) { client_print( id, print_chat, \"%s %L\", g_MODclient, id, \"INFO_SHOPMENU_9\", iBonusXP ); } emit_sound( id, CHAN_STATIC, \"warcraft3/Tomes.wav\", 1.0, ATTN_NORM, 0, PITCH_NORM ); return; } ITEM_Gloves( id ) { if ( !WC3_Check() ) { return; } if ( !SHARED_HasGrenade( id ) ) { g_iGloveTimer[id] = 0; _ITEM_Glove_Give( id ); } return; } ITEM_Glove_Begin( id ) { // Then lets start a timer to give them a grenade! g_iGloveTimer[id] = get_pcvar_num( CVAR_wc3_glove_timer ); WC3_StatusText( id, TXT_TIMER, \"%d second(s) until your next grenade\", g_iGloveTimer[id] ); g_iGloveTimer[id]--; set_task( 1.0, \"_ITEM_Glove_Give\", TASK_ITEM_GLOVES + id ); } public _ITEM_Glove_Give( id ) { if ( !WC3_Check() ) { return; } if ( id >= TASK_ITEM_GLOVES ) { id -= TASK_ITEM_GLOVES; } if ( !p_data_b[id][PB_ISCONNECTED] || !is_user_alive( id ) ) { return; } // Only need to save once! - this is b/c I\'m not sure when the loss of a grenade is updated - and I wanted SHARED_HasGrenade to work @ all times! if ( g_iGloveTimer[id] == get_pcvar_num( CVAR_wc3_glove_timer ) - 1 ) { SHARED_SaveWeapons( id ); } // If somehow they already got a grenade - stop this! /*new bool:bHasGrenade = false; if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO ) { if ( cs_get_user_bpammo( id, CSW_HEGRENADE ) > 0 ) { bHasGrenade = true; } } // Lets not check in DOD b/c I *believe* you can have 2 grenades with a certain class else if ( g_MOD == GAME_DOD ) { if ( dod_get_user_ammo( id, DODW_HANDGRENADE ) > 0 || dod_get_user_ammo( id, DODW_STICKGRENADE ) > 0 ) { bHasGrenade = true; } }*/ // Lets do CS/CZ only if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO ) { // Already have a grenade!! if ( SHARED_HasGrenade( id ) ) { g_iGloveTimer[id] = 0; return; } } if ( g_iGloveTimer[id] > 0 ) { WC3_StatusText( id, TXT_TIMER, \"%d second(s) until your next grenade\", g_iGloveTimer[id] ); g_iGloveTimer[id]--; set_task( 1.0, \"_ITEM_Glove_Give\", TASK_ITEM_GLOVES + id ); return; } // Counter-Strike or Condition Zero grenade if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO ) { give_item( id, \"weapon_hegrenade\" ); } // Day of Defeat else if ( g_MOD == GAME_DOD ) { if ( get_user_team( id ) == ALLIES ) { give_item( id, \"weapon_handgrenade\" ); } else { give_item( id, \"weapon_stickgrenade\" ); } } // Display a message to the user WC3_StatusText( id, TXT_TIMER, \"%L\", id, \"ENJOY_A_GRENADE\" ) return; } ITEM_BuyRings( id ) { new iItemSlot = ITEM_GetSlot( id ); // Items are full if ( iItemSlot == ITEM_SLOT_FULL && ITEM_Has( id, ITEM_RING ) == ITEM_NONE ) { g_iFutureItem[id] = -3; MENU_ReplaceItem( id ); return; } new iMoney; new iAdditionalRings = 0; while ( g_iTotalRings[id] + iAdditionalRings < 5 ) { iMoney = SHARED_GetUserMoney( id ); if ( iMoney < ITEM_Cost( id, ITEM_RING ) ) { break; } iAdditionalRings++; new iNewMoney = iMoney - ITEM_Cost( id, ITEM_RING ); SHARED_SetUserMoney( id, iNewMoney, 1 ); } // Then we need to give them some rings! if ( iAdditionalRings > 0 ) { // Subtract 1 b/c ITEM_GiveItem will add one g_iTotalRings[id] += ( ( iAdditionalRings * RING_INCREMENT ) - ( RING_INCREMENT ) ); ITEM_GiveItem( id, ITEM_RING ); } return; } public _ITEM_Ring( id ) { if ( !WC3_Check() ) { return; } if ( id >= TASK_ITEM_RING ) { id -= TASK_ITEM_RING; } if ( !p_data_b[id][PB_ISCONNECTED] || ITEM_Has( id, ITEM_RING ) == ITEM_NONE ) { return; } new iBonusHealth = g_iTotalRings[id]; while ( iBonusHealth > 0 ) { new iHealth = get_user_health( id ) + 1; if ( iHealth <= get_user_maxhealth( id ) ) { set_user_health( id, iHealth ); } iBonusHealth--; } set_task( 2.0, \"_ITEM_Ring\", TASK_ITEM_RING + id ); return; } ITEM_Scroll( id ) { // Make sure the user isn\'t about to respawn when we do these checks if ( !p_data[id][P_RESPAWNBY] ) { p_data[id][P_RESPAWNBY] = RESPAWN_ITEM; set_task( SPAWN_DELAY, \"_SHARED_Spawn\", TASK_SPAWN + id ); } } ITEM_CheckFlag( iItemID, iFlag ) { if ( g_iFlag[iItemID] & iFlag ) { return true; } return false; } // Format the item for WC3_ShowBar ITEM_Format( id, iItem, szItemString[], iLen ) { new szItemName[32]; LANG_GetItemName( iItem, id, szItemName, 31, true ); // Special options if ( iItem == ITEM_NECKLACE ) { formatex( szItemString, iLen, \"%s[%d]\", szItemName, g_iNecklaceCharges[id] ); } else if ( iItem == ITEM_HELM ) { formatex( szItemString, iLen, \"%s[%d]\", szItemName, g_iHelmCharges[id] ); } else if ( iItem == ITEM_RING ) { formatex( szItemString, iLen, \"%s[%d]\", szItemName, g_iTotalRings[id] ); } // All other cases else { copy( szItemString, iLen, szItemName ); } }
Отредактировал: Byaka, - 6.9.2011, 15:07
|
|
|
|
![]() ![]() |