Правила форума Гаранты форума
Размещение рекламы AMX-X компилятор

Здравствуйте, гость Вход | Регистрация

Наши новости:

14-дек
24-апр
10-апр
11-апр

> Правила форума

Раздел для общения на любые темы, для которых не нашлось места в остальных разделах. Если Вашу тему можно отнести по смыслу к другому разделу, лучше создайте её там, иначе Вас накажут.

В данном форуме немного понижены требования к Общим правилам форума, а именно:
1. Информативность темы
2. Отходить от первоначального смысла темы

!
В разделе запрещено создавать темы связанные с раскруткой игровых серверов

Помогите решить проблемку.

Статус пользователя Danger1
сообщение 19.8.2012, 17:56
Сообщение #1
Стаж: 13 лет

Сообщений: 43
Благодарностей: 1
Полезность: 19

Серв упал, выдав такую ошибку
Код
L 08/19/2012 - 14:28:33: [FUN] Invalid player 5
L 08/19/2012 - 14:28:33: [AMXX] Displaying debug trace (plugin "war3ft.amxx")
L 08/19/2012 - 14:28:33: [AMXX] Run time error 10: native error (native "log_amx")
L 08/19/2012 - 14:28:33: [AMXX]    [0] race_shadow.inl::SH_SkillsOffensive (line 522)
L 08/19/2012 - 14:28:33: [AMXX]    [1] events.inl::client_damage (line 108)
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
Статус пользователя Vitaliy
сообщение 19.8.2012, 18:36
Сообщение #2


Стаж: 14 лет

Сообщений: 2431
Благодарностей: 526
Полезность: 609

Меценат Меценат

исходник кинь под спойлер
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Danger1
сообщение 19.8.2012, 19:16
Сообщение #3
Стаж: 13 лет

Сообщений: 43
Благодарностей: 1
Полезность: 19

Скрытый текст
/* 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;
}
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя terskiys
сообщение 19.8.2012, 21:01
Сообщение #4


Стаж: 14 лет

Сообщений: 460
Благодарностей: 104
Полезность: 199

Нахрена war3ft.sma?
Кидай race_shadow.inl и events.inl
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Danger1
сообщение 19.8.2012, 22:58
Сообщение #5
Стаж: 13 лет

Сообщений: 43
Благодарностей: 1
Полезность: 19

Цитата(samaraserv @ 19.8.2012, 22:01) *
Нахрена war3ft.sma?
Кидай race_shadow.inl и events.inl

Скрытый текст
/*
* Race: Shadow Hunter Functions
*/

#define SH_HEX_LENGTH 5.0 // Length that hex lasts in seconds
#define SH_HEX_SPEED 175.0 // Speed hexed player will move at
#define SH_HEALING_WAVE_RANGE 750 // Range to heal teammates

#define SH_BIGBADVOODOO_DURATION 2

#define SH_CONCOCTION_DAMAGE 15 // Damage done by Unstable Concoction
#define SH_CONCOCTION_RADIUS 300

new g_SH_SerpentGiven[33];
new bool:bWardBombCheck = false;

// ****************************************
// Shadow Hunter's Healing Wave
// ****************************************


// Helper function to start the healing process
public SH_HealingWave( id )
{
if ( !task_exists( id + TASK_WAVE ) )
{
_SH_HealingWave( id );
}
}

// We don't need to ever actually "turn this off" since this task will take care of itself
public _SH_HealingWave( id )
{

if ( id >= TASK_WAVE )
{
id -= TASK_WAVE;
}

// User is no longer connected :/
if ( !p_data_b[id][PB_ISCONNECTED] )
{
return;
}

static iSkillLevel;
iSkillLevel = SM_GetSkillLevel( id, SKILL_HEALINGWAVE );

// User doesn't have this skill, so lets return
// - Also return if this was called twice
if ( iSkillLevel <= 0 )
{
return;
}

// Continue healing...
if ( is_user_alive( id ) )
{
set_task( p_heal[iSkillLevel-1], "_SH_HealingWave", TASK_WAVE + id );
}

// Prevent healing if this player is hexed
if ( p_data_b[id][PB_HEXED] )
{
return;
}


new players[32], numberofplayers, targetid, targetorigin[3], origin[3];
new iTeam = get_user_team( id );

get_user_origin( id, origin );
get_players( players, numberofplayers, "a" );

// Loop through each player and check to see if one is close enough to be healed
for ( new i = 0; i < numberofplayers; i++ )
{
targetid = players[i];

// User is on the caster's team
if ( p_data_b[targetid][PB_ISCONNECTED] && get_user_team( targetid ) == iTeam )
{
get_user_origin( targetid, targetorigin );

// User is close enough
if ( get_distance(origin, targetorigin) < SH_HEALING_WAVE_RANGE )
{
get_user_origin( targetid, origin )

// User needs health
if ( get_user_health( targetid ) + 1 <= get_user_maxhealth( targetid ) )
{
set_user_health( targetid, get_user_health( targetid ) + 1 );

Create_TE_IMPLOSION( origin, 100, 8, 1 );
}
}
}
}

return;
}


// ****************************************
// Shadow Hunter's Hex
// ****************************************

public _SH_RemoveHex( id )
{
id -= TASK_HEX;

if( !p_data_b[id][PB_ISCONNECTED] )
{
return PLUGIN_HANDLED;
}

p_data_b[id][PB_CAN_RENDER] = true;
p_data_b[id][PB_HEXED] = false;

if ( is_user_alive( id ) )
{
// Reset the user's speed
SHARED_ResetMaxSpeed( id );

// Reset the user's gravity
SHARED_SetGravity( id );

// Reset the user's rendering
SHARED_INVIS_Set( id );

// Reset the user's devotion aura
HU_DevotionAura( id );

emit_sound( id, CHAN_STATIC, g_szSounds[SOUND_HEX], 1.0, ATTN_NORM, 0, PITCH_NORM );
}

return PLUGIN_HANDLED;
}


// ****************************************
// Shadow Hunter's Serpent Ward
// ****************************************

SH_SerpentWard( id )
{
static iSkillLevel;

iSkillLevel = SM_GetSkillLevel( id, SKILL_SERPENTWARD );

// User should have some!
if ( iSkillLevel > 0 )
{

// Then we can give the user a serpent ward!
while ( g_SH_SerpentGiven[id] < p_serpent[iSkillLevel-1] )
{
// Increase the available serpent wards
p_data[id][P_SERPENTCOUNT]++;

// Increase the total we have given the user!
g_SH_SerpentGiven[id]++;

//client_print( id, print_chat, "[DEBUG] Total wards increased to %d (total given so far: %d)", p_data[id][P_SERPENTCOUNT], g_SH_SerpentGiven[id] );
}
}

// User should not have any!
else
{
// Remove all available serpents!
p_data[id][P_SERPENTCOUNT] = 0;

// We don't need to remove any of the wards b/c the task knows to check the skill level
}
}

public SH_PlaceSerpentWard( id )
{

// User is hexed, can't use any skills
if ( p_data_b[id][PB_HEXED] )
{
WC3_StatusText( id, 0, "%L", id, "HEX_NO_ABILITY" );
}

// User is alive we can place a ward!
else if ( is_user_alive( id ) && SM_GetSkillLevel( id, SKILL_SERPENTWARD ) > 0 && p_data[id][P_SERPENTCOUNT] > 0 )
{

// Serpent Ward
if ( SH_CanPlaceWard( id ) )
{
new parm[5], origin[3]

get_user_origin( id, origin );
parm[0] = origin[0];
parm[1] = origin[1];
parm[2] = origin[2];
parm[3] = id;
parm[4] = get_user_team( id );

_SH_DrawSerpentWard( parm );
p_data[id][P_SERPENTCOUNT]--;

WC3_StatusText( id, 0, "%L", id, "SERPENT_WARD", p_data[id][P_SERPENTCOUNT] );
}
else
{
WC3_StatusText( id, 0, "You cannot place a serpent ward here" );
}
}
}

// Called when the bomb is planted
SH_BombPlanted()
{
bWardBombCheck = true;

set_task( 1.0, "_SH_ResetBombCheck", 0 );
}


public _SH_ResetBombCheck()
{
bWardBombCheck = false;
}

public _SH_DrawSerpentWard( parm[5] )
{

if ( !WC3_Check() )
{
return;
}

new id = parm[3];

// User is no longer connected, stop drawing wards
if( !p_data_b[id][PB_ISCONNECTED] )
{
return;
}

// User is no longer alive, don't draw wards
if ( !is_user_alive( id ) )
{
p_data[id][P_SERPENTCOUNT]++;
return;
}

// User doesn't have this skill anymore! Remove the ward!
if ( SM_GetSkillLevel( id, SKILL_SERPENTWARD ) <= 0 )
{
return;
}

// Don't allow the ward to be by a hostage or the bom
if ( bWardBombCheck )
{
if ( !SH_CheckWard( parm ) )
{
client_print( id, print_chat, "%s Serpent ward removed, you can't have them near bombs or hostages!", g_MODclient );

return;
}
}

new origin[3], start[3], end[3], red, blue, green
origin[0]=parm[0]
origin[1]=parm[1]
origin[2]=parm[2]

// Set up the top of the ward
start[0] = origin[0]
start[1] = origin[1]
start[2] = origin[2] + 600

// Set up the bottom of the ward
end[0] = origin[0]
end[1] = origin[1]
end[2] = origin[2] - 600

// Set up colors based on what game/team
if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO )
{
if ( parm[4] == TS )
{
red = 255;
blue = 0;
green = 0;
}
else
{
red = 0;
blue = 255;
green = 0;
}
}

else if ( g_MOD == GAME_DOD )
{
if ( parm[4] == AXIS )
{
red = 255;
blue = 63;
green = 63;
}
else
{
red = 76;
blue = 102;
green = 76;
}
}

// Draw the serpent ward
Create_TE_BEAMPOINTS( start, end, g_iSprites[SPR_LIGHTNING], 1, 5, 2, 500, 20, red, green, blue, 100, 100 );

// Now lets check and see if any players are near that need to be damaged
new players[32], numberofplayers;
new targetid, targetorigin[3];

get_players( players, numberofplayers, "a" );

for ( new i = 0; i < numberofplayers; i++ )
{
targetid = players[i];

if ( parm[4] != get_user_team( targetid ) )
{
get_user_origin( targetid, targetorigin );

if ( get_distance( origin, targetorigin ) < 85 )
{

// Damage the user
WC3_Damage( targetid, id, 10, CSW_SERPENTWARD, -1 );

// Make the sound when they're attacked
client_cmd( targetid, "speak ambience/thunder_clap.wav" );

// Create screen fade on the owners screen
Create_ScreenFade( id, (1<<10), (1<<10), (1<<12), red, green, blue, 64 );
Create_ScreenFade( targetid, (1<<10), (1<<10), (1<<12), red, green, blue, 126 );
}
}
}

set_task( 0.5, "_SH_DrawSerpentWard", TASK_LIGHT + id, parm, 5 );

return;
}

bool:SH_CanPlaceWard( id )
{
new vPlayerOrigin[3];
get_user_origin( id, vPlayerOrigin );

// Make sure the user isn't trying to place a ward near a hostage
if ( SHARED_NearObjective( vPlayerOrigin ) == OBJENT_HOSTAGE )
{
return false;
}

// Make sure the user isn't trying to place a ward near the bomb
new Float:vEntOrigin[3];
new vEntityOrigin[3];

new iEnt = find_ent_by_model( -1, "grenade", "models/w_c4.mdl" )

if ( iEnt && is_valid_ent( iEnt ) )
{

entity_get_vector( iEnt, EV_VEC_origin, vEntOrigin )

vEntityOrigin[0] = floatround( vEntOrigin[0] );
vEntityOrigin[1] = floatround( vEntOrigin[1] );
vEntityOrigin[2] = floatround( vEntOrigin[2] );

if ( get_distance( vPlayerOrigin, vEntityOrigin ) < 250 )
{
return false;
}
}

return true;
}

bool:SH_CheckWard( parm[5] )
{
new vPlayerOrigin[3];

vPlayerOrigin[0] = parm[0];
vPlayerOrigin[1] = parm[1];
vPlayerOrigin[2] = parm[2];

new Float:vEntOrigin[3];
new vEntityOrigin[3];

new iEnt = find_ent_by_model( -1, "grenade", "models/w_c4.mdl" );

if ( iEnt && is_valid_ent( iEnt ) )
{
entity_get_vector( iEnt, EV_VEC_origin, vEntOrigin )

vEntityOrigin[0] = floatround( vEntOrigin[0] );
vEntityOrigin[1] = floatround( vEntOrigin[1] );
vEntityOrigin[2] = floatround( vEntOrigin[2] );

if ( get_distance( vPlayerOrigin, vEntityOrigin ) < 250 )
{
return false;
}
}

return true;
}

// ****************************************
// Shadow Hunter's Big Bad Voodoo
// ****************************************

public SH_Ult_BigBadVoodoo( id )
{
if ( !p_data_b[id][PB_ISCONNECTED] )
{
return;
}

p_data_b[id][PB_GODMODE] = true;

p_data_b[id][PB_CAN_RENDER] = false;

ULT_ResetCooldown( id, get_pcvar_num( CVAR_wc3_ult_cooldown ) + SH_BIGBADVOODOO_DURATION, false );

ULT_Icon( id, ICON_FLASH );

if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO )
{
Create_BarTime( id, SH_BIGBADVOODOO_DURATION, 0 );
}

emit_sound( id, CHAN_STATIC, g_szSounds[SOUND_VOODOO], 1.0, ATTN_NORM, 0, PITCH_NORM );

set_user_rendering( id, kRenderFxGlowShell, 255, 245, 50, kRenderNormal, 16 );

new vOrigin[3];
get_user_origin( id, vOrigin );
vOrigin[2] += 75;

Create_TE_ELIGHT( id, vOrigin, 100, 255, 245, 200, SH_BIGBADVOODOO_DURATION, 0 );

set_task( float( SH_BIGBADVOODOO_DURATION ), "SH_Ult_Remove", TASK_RESETGOD + id );

return;
}

public SH_Ult_Remove( id )
{
if ( id >= TASK_RESETGOD )
{
id -= TASK_RESETGOD;
}

if ( !p_data_b[id][PB_ISCONNECTED] )
{
return;
}

p_data_b[id][PB_CAN_RENDER] = true;

p_data_b[id][PB_GODMODE] = false;

ULT_Icon( id, ICON_HIDE );

SHARED_INVIS_Set( id );

return;
}

SH_SkillsOffensive( iAttacker, iVictim )
{

static iSkillLevel;

// Hex
iSkillLevel = SM_GetSkillLevel( iAttacker, SKILL_HEX );

if ( iSkillLevel > 0 )
{
if ( random_float( 0.0, 1.0 ) <= p_hex[iSkillLevel-1] )
{

// We need to identify the victim as slowed + hexed
p_data_b[iVictim][PB_HEXED] = true
p_data_b[iVictim][PB_SLOWED] = true;

// Slow the user's speed
SHARED_SetSpeed( iVictim );

// Set the user's gravity
SHARED_SetGravity( iVictim );

// Set the user's rendering
SHARED_INVIS_Set( iVictim );

// Remove user's devotion aura
new iHealth = get_user_health( iVictim );
if ( iHealth - g_HU_DevotionAuraGiven[iVictim] < 0 )
{
if (is_user_alive(iVictim))
set_user_health( iVictim, 1 );
}
else
{
set_user_health( iVictim, iHealth - g_HU_DevotionAuraGiven[iVictim] );
}
g_HU_DevotionAuraGiven[iVictim] = 0;

// Create the "remove hex" task
set_task( SH_HEX_LENGTH ,"_SH_RemoveHex", TASK_HEX + iVictim );

// Play the hex sound
emit_sound( iVictim, CHAN_STATIC, g_szSounds[SOUND_HEX], 1.0, ATTN_NORM, 0, PITCH_NORM );

// Make the user glow!
SHARED_Glow( iVictim, 150, 150, 150, 0 );

// Lets create a screen fade
Create_ScreenFade( iVictim, (1<<10), (1<<10), (1<<12), 255, 255, 255, 75 )
}
}
}

SH_SkillsDefensive( iAttacker, iVictim )
{
static iSkillLevel;

// Unstable Concoction
iSkillLevel = SM_GetSkillLevel( iVictim, PASS_UNSTABLECONCOCTION );
if ( iSkillLevel > 0 )
{
// Check to see if we should "concoction"
if ( random_float( 0.0, 1.0 ) <= p_concoction[iSkillLevel] )
{
new vOrigin[3], vInitOrigin[3], vAxisOrigin[3], i;

// Get origin of victim
get_user_origin( iVictim, vOrigin );

// Play sound on attacker
emit_sound( iAttacker, CHAN_STATIC, g_szSounds[SOUND_CONCOCTION_CAST], 1.0, ATTN_NORM, 0, PITCH_NORM );

// Set up the origins for the effect
vInitOrigin[0] = vOrigin[0];
vInitOrigin[1] = vOrigin[1];
vInitOrigin[2] = vOrigin[2] - 16;

vAxisOrigin[0] = vOrigin[0];
vAxisOrigin[1] = vOrigin[1];
vAxisOrigin[2] = vOrigin[2] + SH_CONCOCTION_RADIUS;

// Display the effect on the attacker
for ( i = 0; i < 200; i += 25 )
{
Create_TE_BEAMCYLINDER( vOrigin, vInitOrigin, vAxisOrigin, g_iSprites[SPR_SHOCKWAVE], 0, 0, 9, 20, 0, 188, 220, 255, 255, 0 );

vInitOrigin[2] += 25;
}

new team = get_user_team( iVictim );
new players[32], numberofplayers, vTargetOrigin[3];
get_players(players, numberofplayers, "a");


// Loop through all players and see if anyone nearby needs to be damaged
for( i = 0; i < numberofplayers; i++ )
{

// Then we have a target on the other team!!
if ( get_user_team( players[i] ) != team )
{
get_user_origin( players[i], vTargetOrigin );

// Make sure they are close enough
if ( get_distance( vOrigin, vTargetOrigin ) <= SH_CONCOCTION_RADIUS )
{
// Damage
WC3_Damage( players[i], iVictim, SH_CONCOCTION_DAMAGE, CSW_CONCOCTION, 0 );

// Let the victim know he hit someone
emit_sound( iVictim, CHAN_STATIC, g_szSounds[SOUND_CONCOCTION_HIT], 1.0, ATTN_NORM, 0, PITCH_NORM );
}
}
}
}

else if ( get_pcvar_num( CVAR_wc3_psychostats ) )
{
new WEAPON = CSW_CONCOCTION - CSW_WAR3_MIN;

iStatsShots[iVictim][WEAPON]++;
}
}
}

// This function is called to reset the ability of an attacker to attack a user running big bad voodoo
public _SH_ResetBigBadAttacker( id )
{

if ( !WC3_Check() )
{
return;
}

if ( id >= TASK_BIGBADATTACKER )
{
id -= TASK_BIGBADATTACKER;
}

if ( !p_data_b[id][PB_ISCONNECTED] )
{
return;
}

p_data_b[id][PB_BIGBAD_ATTACKER] = false;

client_print( id, print_chat, "%s You can no longer damage players with Big Bad Voodoo activated", g_MODclient );
}

Скрытый текст

// Forwards from the CSX module and DODX module
public grenade_throw( index, greindex, wId )
{

if ( !WC3_Check() )
{
return;
}

// If user isn't alive do nothing!
if ( !is_user_alive( index ) )
{
return;
}

// User has gloves! Do we need to give them another grenade?
if ( ITEM_Has( index, ITEM_GLOVES ) > ITEM_NONE )
{
ITEM_Glove_Begin( index );
}

static iSkillLevel;
iSkillLevel = SM_GetSkillLevel( index, SKILL_CRITICALGRENADE );

// Make sure the user has the skill and we actually have a grenade index
if ( greindex && iSkillLevel > 0 )
{

// Then Critical Grenades are allowed
if ( OR_CriticalGrenadeAllowed( index ) )
{

// Then draw it!
if ( SHARED_IsGrenade( wId ) )
{
new iWidth = 3 * iSkillLevel;

Create_TE_BEAMFOLLOW( greindex, g_iSprites[SPR_TRAIL], 20, iWidth, 255, 32, 32, 196 );
}
}
}
return;
}

// HamSandwich implementation
public EVENT_TakeDamage( iVictim, inflictor, iAttacker, Float:f_Damage, damagetype )
{

static s_Classname[ 8 ];
pev ( inflictor, pev_classname, s_Classname, charsmax ( s_Classname ) );


new s_PlayerName[32], s_PlayerName2[32];

get_user_name( iVictim, s_PlayerName, 31 );
get_user_name( iAttacker, s_PlayerName2, 31 );

//server_print( "%s:%d attack's %s:%d for %0.0f damage with %s:%d", s_PlayerName2, iAttacker, s_PlayerName, iVictim, f_Damage, s_Classname, inflictor );


/* client_print( iAttacker, print_chat, "Damage: %f0.0, Victim: %d, Inflictor: %d (%s)", iDamage, iVictim, inflictor, s_Classname );
client_print( iVictim, print_chat, "Damage: %f0.0, iAttacker: %d, Inflictor: %d (%s)", iDamage, iAttacker, inflictor, s_Classname );


server_print( "Attacker: %d, Damage: %f0.0, Victim: %d, Inflictor: %d (%s)", iAttacker, iDamage, iVictim, inflictor, s_Classname );
*/
//return HAM_SUPERCEDE


return HAM_IGNORED;
}

public client_damage( iAttacker, iVictim, iDamage, iWeapon, iHitPlace, TA )
{

if ( !WC3_Check() )
{
return;
}

// If they damage themself we don't care now do we ?
if ( iVictim == iAttacker )
{
return;
}

g_iDamageDealt[iAttacker][iVictim] += iDamage;

// Bot should "auto" cast his/her ultimate on random
if ( SHARED_ValidPlayer( iAttacker ) && is_user_bot( iAttacker ) && random_num( 0, 100 ) <= ( BOT_CAST_ULT_CHANCE * 100 ) )
{
// Check for an actual ultimate is done in this function, why do it twice?
cmd_Ultimate( iAttacker );
}


// We need to make sure that we have a valid attacker and the user isn't hexed
if ( SHARED_ValidPlayer( iAttacker ) && !p_data_b[iAttacker][PB_HEXED] )
{

// Run the offensive spells
UD_SkillsOffensive( iAttacker, iDamage );
HU_SkillsOffensive( iAttacker, iVictim );
OR_SkillsOffensive( iAttacker, iVictim, iWeapon, iDamage, iHitPlace );
NE_SkillsOffensive( iAttacker, iVictim, iWeapon, iDamage, iHitPlace );
BM_SkillsOffensive( iAttacker, iVictim, iDamage );
SH_SkillsOffensive( iAttacker, iVictim );
WA_SkillsOffensive( iAttacker, iVictim, iHitPlace );
CL_SkillsOffensive( iAttacker, iVictim, iHitPlace );
}

// Make sure we can run the defensive skills
if ( SHARED_ValidPlayer( iAttacker ) && !p_data_b[iVictim][PB_HEXED] )
{
//UD_SkillsDefensive( iAttacker, iVictim, iWeapon, iDamage, iHitPlace );
//HU_SkillsDefensive( iAttacker, iVictim, iWeapon, iDamage, iHitPlace );
//OR_SkillsDefensive( iAttacker, iVictim, iWeapon, iDamage, iHitPlace );
NE_SkillsDefensive( iAttacker, iVictim, iDamage, iHitPlace );
BM_SkillsDefensive( iAttacker, iVictim, iDamage );
SH_SkillsDefensive( iAttacker, iVictim );
//WA_SkillsDefensive( iAttacker, iVictim, iWeapon, iDamage, iHitPlace );
CL_SkillsDefensive( iAttacker, iVictim, iDamage, iHitPlace );
}

// Item abilities
if ( SHARED_ValidPlayer( iAttacker ) )
{
ITEM_Offensive( iAttacker, iVictim, iWeapon, iDamage, iHitPlace );
}

return;
}

// All we want to check is if the user was killed by the bomb
public client_death( iAttacker, iVictim, iWeapon, hitplace, TK )
{
// Counter-Strike and Condition Zero Checks
if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO )
{

// Check out who the inflictor was
new iInflictor = entity_get_edict( iVictim, EV_ENT_dmg_inflictor );

// Check to see if the death was from the bomb
if ( !SHARED_ValidPlayer( iInflictor ) && iWeapon != CSW_HEGRENADE && iInflictor )
{

if ( is_valid_ent ( iInflictor ) )
{
new szClassName[64];
entity_get_string( iInflictor, EV_SZ_classname, szClassName, 63 );

// Check the classname of our inflictor
if ( equali( szClassName, "grenade" ) || equali( szClassName, "env_explosion" ) )
{
iWeapon = CSW_C4;
iAttacker = 0;

// Well if this isn't set, shouldn't it be?
if ( !p_data_b[iVictim][PB_DIEDLASTROUND] )
{
on_Death( iVictim, iAttacker, iWeapon, 0 );
}
//client_print( iVictim, print_chat, "[DEBUG] You were just killed by the bomb (%s) Alive? %d", szClassName, is_user_alive( iVictim ) );
}
}
}
}
}

public on_Death( iVictim, iAttacker, iWeaponID, iHeadshot )
{

if ( !WC3_Check() )
{
return;
}

// Counter-Strike and Condition Zero Checks
if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO )
{
// For some reason the damage passed by explosions is not actually correct (perhaps armor adjustments weren't done yet), so lets check
if ( is_user_alive( iVictim ) && iWeaponID == CSW_C4 )
{
return;
}

// Check for NightVision
p_data_b[iVictim][PB_NIGHTVISION] = (cs_get_user_nvg( iVictim )) ? true : false;

// Check if a user had a shield on death
p_data_b[iVictim][PB_SHIELD] = (cs_get_user_shield( iVictim )) ? true : false;

// See if the user has a defuse kit
p_data_b[iVictim][PB_DEFUSE] = (cs_get_user_defuse( iVictim )) ? true : false;

// Save the number of flash grenades the user has
p_data[iVictim][P_FLASHCOUNT] = cs_get_user_bpammo( iVictim, CSW_FLASHBANG );

// Check to see if weapons were silenced on death
new iWeaponUSPEnt = find_ent_by_owner( -1, "weapon_usp", iVictim );
new iWeaponM4A1Ent = find_ent_by_owner( -1, "weapon_m4a1", iVictim );

if ( is_valid_ent( iWeaponUSPEnt ) )
{
p_data_b[iVictim][PB_USP_SILENCED] = cs_get_weapon_silen( iWeaponUSPEnt ) ? true : false;
}

if ( is_valid_ent( iWeaponM4A1Ent ) )
{
p_data_b[iVictim][PB_M4A1_SILENCED] = cs_get_weapon_silen( iWeaponM4A1Ent ) ? true : false;
}


// Check to see if weapons were in burst mode on death
new iWeaponGlock18Ent = find_ent_by_owner( -1, "weapon_glock18", iVictim );
new iWeaponFamasEnt = find_ent_by_owner( -1, "weapon_famas", iVictim );

if ( is_valid_ent( iWeaponGlock18Ent ) )
{
p_data_b[iVictim][PB_GLOCK_BURST] = cs_get_weapon_burst( iWeaponGlock18Ent ) ? true : false;
}

if ( is_valid_ent( iWeaponFamasEnt ) )
{
p_data_b[iVictim][PB_FAMAS_BURST] = cs_get_weapon_burst( iWeaponFamasEnt ) ? true : false;
}
}

// Day of Defeat Checks
else if ( g_MOD == GAME_DOD )
{

// Save the user's origin for reincarnation
get_user_origin( iVictim, iReincarnation[iVictim] );
}

WC3_Death( iVictim, iAttacker, iWeaponID, iHeadshot );

return;
}

// Hook for CS/CZ
public on_DeathMsg()
{

if ( !WC3_Check() )
{
return;
}

new iAttacker = read_data( 1 );
new iVictim = read_data( 2 );
new iHeadshot = read_data( 3 );
new iWeaponID;
get_user_attacker( iVictim, iWeaponID );

on_Death( iVictim, iAttacker, iWeaponID, iHeadshot );

return;
}

new g_iLastCurWeapon[33];
public on_CurWeapon( id )
{
// read_data(1) = isActive?
// read_data(2) = weapon index
// read_data(3) = ammo

if ( !WC3_Check() )
{
return;
}

new iCurWeapon = read_data( 2 );

// Then a weapon strip was triggered - we don't want to save now do we?
if ( iCurWeapon == 0 && read_data( 1 ) == 0 && read_data( 3 ) == 0 )
{
return;
}

// Record the last time a shot was fired
fLastShotFired[id] = halflife_time();

// Save the user's weapons
SHARED_SaveWeapons( id );

// Set the fuse for the weapon in DOD
if ( g_MOD == GAME_DOD )
{

// Critical Grenade
if ( SM_GetSkillLevel( id, SKILL_CRITICALGRENADE ) > 0 && SHARED_HasGrenade( id ) )
{
dod_set_fuse( id, FUSE_SET, 2.0, FT_NEW );
}
}

// We only need to run these functions if the user's weapon has changed since our last function call!
if ( g_iLastCurWeapon[id] != iCurWeapon && SHARED_ValidPlayer( id ) )
{
// Check to see if we should set the player's invisibility
SHARED_INVIS_Set( id );

// Set the user's speed
SHARED_SetSpeed( id );
}

g_iLastCurWeapon[id] = iCurWeapon;

return;
}

public on_Drop( id )
{
if ( !WC3_Check() )
{
return;
}

SHARED_SaveWeapons( id );

return;
}

// HamSandwich implementation
public EVENT_Spawn( id )
{

if ( !WC3_Check() )
{
return HAM_HANDLED;
}

// ResetHUD can be called when the user is not alive, lets ignore those calls
if ( !is_user_alive( id ) )
{
return HAM_HANDLED;
}

// Store the player's team!
g_iPlayerTeam[id] = get_user_team( id );

// Prespawn call
// - Purpose is to have a spawn call that happens before everything else!
WC3_PreSpawn( id );

if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO )
{

// This is the first time the user has spawned this round
if ( !p_data_b[id][PB_HAS_SPAWNED] )
{
EVENT_PlayerInitialSpawn( id );

p_data_b[id][PB_HAS_SPAWNED] = true;
}
}

// Start a new session under the following conditions:
// - Day of Defeat - need a new session per spawn!
// - CSDM - rounds never end!!!
if ( g_MOD == GAME_DOD || ( CVAR_csdm_active > 0 && get_pcvar_num( CVAR_csdm_active ) == 1 ) )
{
WC3_NewSession( id );
}

// Should be called at the end of each spawn
WC3_PostSpawn( id );

return HAM_HANDLED;
}

// Function called EVERYTIME a user spawns!
public on_ResetHud( id )
{

if ( !WC3_Check() )
{
return PLUGIN_CONTINUE;
}

// ResetHUD can be called when the user is not alive, lets ignore those calls
if ( !is_user_alive( id ) )
{
return PLUGIN_CONTINUE;
}

// Store the player's team!
g_iPlayerTeam[id] = get_user_team( id );

// We're forcibly respawning the player - so lets just return
if ( bIgnorePlayerSpawning[id] )
{
return PLUGIN_CONTINUE;
}

// Prespawn call
// - Purpose is to have a spawn call that happens before everything else!
WC3_PreSpawn( id );

if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO )
{

// This is the first time the user has spawned this round
if ( !p_data_b[id][PB_HAS_SPAWNED] )
{
EVENT_PlayerInitialSpawn( id );

p_data_b[id][PB_HAS_SPAWNED] = true;
}
}

// Start a new session under the following conditions:
// - Day of Defeat - need a new session per spawn!
// - CSDM - rounds never end!!!
if ( g_MOD == GAME_DOD || ( CVAR_csdm_active > 0 && get_pcvar_num( CVAR_csdm_active ) == 1 ) )
{
WC3_NewSession( id );
}

// Should be called at the end of each spawn
WC3_PostSpawn( id );

return PLUGIN_CONTINUE;
}

// Function is called when the user is spawned at the START of each round - only WC3_PreSpawn is called first
// TRIGGERED BY: ResetHUD
public EVENT_PlayerInitialSpawn( id )
{


// Display the cheat message ONLY if they just joined!
if ( p_data_b[id][PB_JUSTJOINED] && get_pcvar_num( CVAR_wc3_cheats ) )
{
client_print( id, print_chat, "%s WC3 Cheats are enabled on this server! Try typing /level10", g_MODclient );

p_data_b[id][PB_JUSTJOINED] = false;
}

// Display the new Chameleon skills for the round
if ( p_data[id][P_RACE] == 9 && get_pcvar_num( CVAR_wc3_cham_random ) )
{
WC3_ShowRaceInfo( id );
}

WC3_NewSession( id );

return;
}

// Function is called ONCE at the start of a new round BEFORE user's spawn
public EVENT_NewRound()
{
if ( !WC3_Check() )
{
return;
}

// Reset the global ultimate delay
g_iUltimateDelay = get_pcvar_num( CVAR_wc3_ult_delay );

// User's have not spawned yet, so lets do some pre-spawn things
new players[32], numplayers, i;
get_players( players, numplayers );
for ( i = 0; i < numplayers; i++ )
{
WC3_BeforeSpawn( players[i] );
}

// Reset which spawn points are reserved....
_SHARED_SpawnReset();

// If someone restarted the game, then lets reset war3
if ( g_GameRestarting )
{
WC3_ResetGame();
}

// Randomize Chameleon if we need to
CHAM_Randomize();

// We need to determine when the buytime is up
if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO )
{
if ( get_pcvar_num( CVAR_wc3_buy_time ) )
{
// Remove our buytime task if it exists (from a previous round)
( task_exists( TASK_BUYTIME ) ) ? remove_task( TASK_BUYTIME ) : 0;

g_buyTime = true;

set_task( get_cvar_float("mp_buytime") * 60.0, "_CS_BuyTimeOver", TASK_BUYTIME );
}

g_freezeTime = true;
}

g_EndRound = false;
}

// Called when a user looks somewhere
public TRIGGER_TraceLine( Float:v1[3], Float:v2[3], noMonsters, pentToSkip )
{
if ( !WC3_Check() )
{
return FMRES_IGNORED;
}

new iAttacker = pentToSkip;
new iVictim = get_tr(TR_pHit);
new iHitZone = (1 << get_tr(TR_iHitgroup));

// Make sure we have a valid victim
if ( SHARED_ValidPlayer( iVictim ) && p_data_b[iVictim][PB_ISCONNECTED] )
{
// We need to have a valid player!
if ( SHARED_ValidPlayer( iAttacker ) )
{
// This is a check for ultimates that need to "search" for a target
if ( p_data_b[iAttacker][PB_ISSEARCHING] )
{

// Now lets make sure the person he's looking at is in view and isn't on the same team
if ( get_user_team( iAttacker ) != get_user_team( iVictim ) ) //&& UTIL_EntInView( iAttacker, iVictim ) )
{

// Check to see if the user should block this ultimate!
if ( !g_EndRound && ULT_CanUserBlockUlt( iVictim ) )
{
ULT_RemoveCharge( iVictim, 0 );
ULT_Blocked( iAttacker );
}

// Then the user's ult should work!
else
{
// Well we do have a target so lets execute the user's ultimate!!
if ( SM_GetSkillLevel( iAttacker, ULTIMATE_CHAINLIGHTNING ) > 0 )
{
OR_ULT_ChainLightning( iAttacker, iVictim, iHitZone );
}
else if ( SM_GetSkillLevel( iAttacker, ULTIMATE_ENTANGLE ) > 0 )
{
NE_ULT_Entangle( iAttacker, iVictim );
}
else if ( SM_GetSkillLevel( iAttacker, ULTIMATE_IMMOLATE ) > 0 )
{
BM_ULT_Immolate( iAttacker, iVictim );
}
}

// No longer searching since we found a target
p_data_b[iAttacker][PB_ISSEARCHING] = false;

// Set up the user's ultimate delay
ULT_ResetCooldown( iAttacker, get_pcvar_num( CVAR_wc3_ult_cooldown ) );
}
}

// This is a nice check for Helm of Excellence
if ( ITEM_Has( iVictim, ITEM_HELM ) > ITEM_NONE )
{
// Friendly fire is off! - This means same team shouldn't remove a charge!
if ( !get_pcvar_num( CVAR_mp_friendlyfire ) )
{
if ( g_iPlayerTeam[iAttacker] == g_iPlayerTeam[iVictim] )
{
return FMRES_IGNORED;
}
}

// If its a headshot then we want to block it
if ( iHitZone & (1 << 1) )
{
set_tr( TR_flFraction, 1.0 );

// Make sure we have a valid attacker!
if ( SHARED_ValidPlayer( iAttacker ) )
{
// Do the check to see if we should flash the screen orange
new Float:fTime = halflife_time();
new Float:fDifference = fTime - fLastShotFired[iAttacker];

if ( fDifference < 0.1 && fDifference > 0.0 )
{
Create_ScreenFade( iVictim, (1<<10), (1<<10), (1<<12), 0, 0, 255, 150 );

// Lets remove a charge from the helm!
ITEM_RemoveCharge( iVictim, ITEM_HELM );
}
}

return FMRES_SUPERCEDE;
}
}

// Check to see if this user has night elf's evasion
if ( SM_GetSkillLevel( iVictim, SKILL_EVASION ) > 0 )
{
// Do the check to see if we should "evade" this shot
new Float:fTime = halflife_time();
new Float:fDifference = fTime - fLastShotFired[iAttacker];

if ( SHARED_ValidPlayer( iAttacker ) && fDifference < 0.1 && fDifference > 0.0 )
{

// Friendly fire is off! - This means we shouldn't evade since no damage will be done!
if ( !get_pcvar_num( CVAR_mp_friendlyfire ) )
{
if ( g_iPlayerTeam[iAttacker] == g_iPlayerTeam[iVictim] )
{
return FMRES_IGNORED;
}
}

// Then we should evade this shot!
if ( NE_Evasion( iVictim, iHitZone ) )
{
set_tr( TR_flFraction, 1.0 );

WC3_StatusText( iVictim, TXT_SKILL, "You have evaded a shot!" );

return FMRES_SUPERCEDE;
}
}
}

// Mole protectant
if ( p_data_b[iAttacker][PB_MOLE] && ITEM_Has( iVictim, ITEM_PROTECTANT ) > ITEM_NONE )
{
new Float:fTime = halflife_time();

if ( fTime - fLastShotFired[iAttacker] < 0.1 )
{
client_print( iVictim, print_chat, "%s %L", g_MODclient, iVictim, "SHOT_DEFLECTED" );

set_tr( TR_flFraction, 1.0 );

return FMRES_SUPERCEDE;
}
}

// Check for Big Bad Voodoo's ultimate!
if ( p_data_b[iVictim][PB_GODMODE] )
{

new bool:bBlockDamage = true;

// Do we allow this person to be attacked by this player?
if ( p_data_b[iAttacker][PB_BIGBAD_ATTACKER] )
{
bBlockDamage = false;
}

// Check to see if immunity is available for the attacker
else if ( ULT_CanUserBlockUlt( iAttacker ) )
{
// Remove charge and display message to attacker
ULT_RemoveCharge( iAttacker, 1 );

// Display message about user's ultimate being blocked!
ULT_Blocked( iVictim );

// This user can attack someone with big bad voodoo!
p_data_b[iAttacker][PB_BIGBAD_ATTACKER] = true;

// Reset the attacker dmg
set_task( get_pcvar_float( CVAR_wc3_ult_cooldown ), "_SH_ResetBigBadAttacker", TASK_BIGBADATTACKER + iAttacker );
}

// Block the damage!
if ( bBlockDamage )
{
set_tr( TR_flFraction, 1.0 );

return FMRES_SUPERCEDE;
}
}
}
}

return FMRES_IGNORED;
}
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Danger1
сообщение 21.8.2012, 21:07
Сообщение #6
Стаж: 13 лет

Сообщений: 43
Благодарностей: 1
Полезность: 19

так кто паможет?
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
  Тема закрытаНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: