Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Wklejka m4ciw573whco dodana przez Kawon, 28.04.2013 14:10
Typ:



1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
204.
205.
206.
207.
208.
209.
210.
211.
212.
213.
214.
215.
216.
217.
218.
219.
220.
221.
222.
223.
224.
225.
226.
227.
228.
229.
230.
231.
232.
233.
234.
235.
236.
237.
238.
239.
240.
241.
242.
243.
244.
245.
246.
247.
248.
249.
250.
251.
252.
253.
254.
255.
256.
257.
258.
259.
260.
261.
262.
263.
264.
265.
266.
267.
268.
269.
270.
271.
272.
273.
274.
275.
276.
277.
278.
279.
280.
281.
282.
283.
284.
285.
286.
287.
288.
289.
290.
291.
292.
293.
294.
295.
296.
297.
298.
299.
300.
301.
302.
303.
304.
305.
306.
307.
308.
309.
310.
311.
312.
313.
314.
315.
316.
317.
318.
319.
320.
321.
322.
323.
324.
325.
326.
327.
328.
329.
330.
331.
332.
333.
334.
335.
336.
337.
338.
339.
340.
341.
342.
343.
344.
345.
346.
347.
348.
349.
350.
351.
352.
353.
354.
355.
356.
357.
358.
359.
360.
361.
362.
363.
364.
365.
366.
367.
368.
369.
370.
371.
372.
373.
374.
375.
376.
377.
378.
379.
380.
381.
382.
383.
384.
385.
386.
387.
388.
389.
390.
391.
392.
393.
394.
395.
396.
397.
398.
399.
400.
401.
402.
403.
404.
405.
406.
407.
408.
409.
410.
411.
412.
413.
414.
415.
#include < amxmodx >
#include < engine >
#include < cstrike >
#include < fun >
#include < fakemeta >
#include < hamsandwich >
 
#pragma semicolon 1
 
// Comment this line if you do not want to have fake player !
// #define FAKE_PLAYER
 
// Bot name
#if defined FAKE_PLAYER
    new const g_szBotName[ ] = "Cs-********.pl";
#endif
 
// Messages prefix
new const g_szPrefix[ ] = "[Cs-********.pl]";
 
// Global Variables
new bool:g_bHauntedHouse, bool:g_bGamerFun, bool:g_bRandromized, bool:g_bStarting, bool:g_bFirstRound;
new bool:g_bEnabled, bool:g_bRestart, bool:g_bConnected[ 33 ];
 
new g_pRemoveBuyZone, g_pHideHuds, g_pLifeSystem, g_pSvRestart, g_pAutoBalance, g_pLimitTeams;
new g_pNoFallDmg, g_pGameName, g_pToggle, g_pBlockSpray, g_pBlockRadio, g_pSemiclip, g_pBlockKill;
 
new g_iMsgHideWeapon, g_iMsgCrosshair, g_iMsgTeamInfo, g_iMsgSayText;
new g_iMaxplayers, g_iHudSync, g_iHudSync2, g_iLastTerr, g_iThinker;
new g_iSemiClip[ 33 ], g_Lifes[ 33 ];
 
#if defined FAKE_PLAYER
    new g_iFakeplayer;
#endif
 
// Macros
#if cellbits == 32
    #define OFFSET_BZ 235
#else
    #define OFFSET_BZ 268
#endif
 
// Colorchat
enum Color {
    NORMAL = 1,
    GREEN,
    RED,
    BLUE
};
 
new TeamName[ ][ ] = {
    "",
    "TERRORIST",
    "CT",
    "SPECTATOR"
};
 
// =======================================================================================
 
public plugin_init( ) {
    new const VERSION[ ] = "3.0.3";
 
    register_plugin( "Deathrun Manager", VERSION, "xPaw" );
 
    g_pToggle        = register_cvar( "deathrun_toggle",     "1" );
    g_pBlockSpray    = register_cvar( "deathrun_spray",      "1" );
    g_pBlockRadio    = register_cvar( "deathrun_radio",      "0" );
    g_pBlockKill     = register_cvar( "deathrun_blockkill",  "1" );
    g_pSemiclip      = register_cvar( "deathrun_semiclip",   "1" );
    g_pLifeSystem    = register_cvar( "deathrun_lifesystem", "0" );
    g_pGameName      = register_cvar( "deathrun_gamename",   "1" );
    g_pNoFallDmg     = register_cvar( "deathrun_terrnfd",    "1" );
    g_pRemoveBuyZone = register_cvar( "deathrun_removebz",   "0" );
 
    // Lets get map name...
    new szMapName[ 64 ];
    get_mapname( szMapName, 63 );
 
    if( contain( szMapName, "deathrun_" ) != -1 ) {
        set_pcvar_num( g_pToggle, 1 );
 
        if( contain( szMapName, "hauntedhouse" ) != -1 )
            g_bHauntedHouse = true;
        else {
            g_bHauntedHouse = false;
 
            if( equal( szMapName, "deathrun_gamerfun" ) )
                g_bGamerFun = true;
            else
                g_bGamerFun = false;
        }
    } else
        set_pcvar_num( g_pToggle, 0 );
 
    g_pSvRestart   = get_cvar_pointer( "sv_restart" );
    g_pAutoBalance = get_cvar_pointer( "mp_autoteambalance" );
    g_pLimitTeams  = get_cvar_pointer( "mp_limitteams" );
 
    register_cvar( "deathrun_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY );
    set_cvar_string( "deathrun_version", VERSION );
 
    // Registering Language file
    register_dictionary( "deathrun.txt" );
 
    // Logging Events
    register_logevent( "EventRoundStart", 2, "1=Round_Start" );
    register_logevent( "EventRandromize", 2, "1=Round_End" );
    register_event( "SendAudio", "EventTerrsWin",   "a", "2&%!MRAD_terwin" );
    register_event( "TextMsg",     "EventRandromize", "a", "2&#Game_w" );
    register_event( "DeathMsg",     "EventDeath",      "a");
    register_event( "ResetHUD",     "EventResetHud",   "be" );
 
    g_bFirstRound    = true;
    g_iMaxplayers    = get_maxplayers( );
    g_iMsgHideWeapon = get_user_msgid( "HideWeapon" );
    g_iMsgCrosshair  = get_user_msgid( "Crosshair" );
    g_iMsgSayText    = get_user_msgid( "SayText" );
    g_iMsgTeamInfo   = get_user_msgid( "TeamInfo" );
 
    g_iHudSync       = CreateHudSyncObj( );
    g_iHudSync2      = CreateHudSyncObj( );
 
    if( get_pcvar_num( g_pToggle ) ) {
        RegisterHam( Ham_TakeDamage, "player", "FwdHamPlayerDamage" );
        RegisterHam( Ham_Spawn,      "player", "FwdHamPlayerSpawn", 1 );
        register_forward( FM_ClientKill,       "FwdClientKill" );
        register_impulse( 201, "FwdImpulse_201" );
 
        if( get_pcvar_num( g_pGameName ) )
            register_forward( FM_GetGameDescription, "FwdGameDesc" );
 
        register_clcmd( "say /lifes", "CmdShowlifes" );
        register_clcmd( "say /lives", "CmdShowlifes" );
 
        register_clcmd( "radio1", "CmdRadio" );
        register_clcmd( "radio2", "CmdRadio" );
        register_clcmd( "radio3", "CmdRadio" );
 
        // Terrorist Check
        g_iThinker= create_entity( "info_target" );
 
        if( is_valid_ent( g_iThinker ) ) {
            entity_set_string( g_iThinker, EV_SZ_classname, "DeathrunThinker" );
            entity_set_float( g_iThinker, EV_FL_nextthink, get_gametime( ) + 20.0 );
 
            g_bRestart = true;
 
            // First think will happen in 20.0, Restart will be done there.
 
            register_think( "DeathrunThinker", "FwdThinker" );
        } else {
            set_task( 15.0, "CheckTerrorists", _, _, _, "b" );
 
            // Lets make restart after 20 seconds from map start.
            set_task( 20.0, "RestartRound" );
        }
 
        if( get_pcvar_num( g_pRemoveBuyZone ) ) {
            register_message( get_user_msgid( "StatusIcon" ), "MsgStatusIcon" ); // BuyZone Icon
 
            // Remove buyzone on map
            remove_entity_name( "info_map_parameters" );
            remove_entity_name( "func_buyzone" );
 
            // Create own entity to block buying
            new iEntity = create_entity( "info_map_parameters" );
 
            DispatchKeyValue( iEntity, "buying", "3" );
            DispatchSpawn( iEntity );
        }
 
        if( get_pcvar_num( g_pSemiclip ) ) {
            register_forward( FM_StartFrame,    "FwdStartFrame", 0 );
            register_forward( FM_AddToFullPack,    "FwdFullPack",   1 );
        }
 
        g_bEnabled = true;
 
    #if defined FAKE_PLAYER
        new iEntity, iCount;
 
        while( ( iEntity = find_ent_by_class( iEntity, "info_player_deathmatch" ) ) > 0 )
            if( iCount++ > 1 )
                break;
 
        if( iCount <= 1 )
            g_iFakeplayer = -1;
 
        set_task( 5.0, "UpdateBot" );
 
        register_message( get_user_msgid( "DeathMsg" ), "MsgDeathMsg" );
    #endif
    } else
        g_bEnabled = false;
}
 
// FAKEPLAYER
///////////////////////////////////////////
#if defined FAKE_PLAYER
    public UpdateBot( ) {
        if( g_iFakeplayer == -1 )
            return;
 
        new id = find_player( "i" );
 
        if( !id ) {
            id = engfunc( EngFunc_CreateFakeClient, g_szBotName );
            if( pev_valid( id ) ) {
                engfunc( EngFunc_FreeEntPrivateData, id );
                dllfunc( MetaFunc_CallGameEntity, "player", id );
                set_user_info( id, "rate", "3500" );
                set_user_info( id, "cl_updaterate", "25" );
                set_user_info( id, "cl_lw", "1" );
                set_user_info( id, "cl_lc", "1" );
                set_user_info( id, "cl_dlmax", "128" );
                set_user_info( id, "cl_righthand", "1" );
                set_user_info( id, "_vgui_menus", "0" );
                set_user_info( id, "_ah", "0" );
                set_user_info( id, "dm", "0" );
                set_user_info( id, "tracker", "0" );
                set_user_info( id, "friends", "0" );
                set_user_info( id, "*bot", "1" );
                set_pev( id, pev_flags, pev( id, pev_flags ) | FL_FAKECLIENT );
                set_pev( id, pev_colormap, id );
 
                new szMsg[ 128 ];
                dllfunc( DLLFunc_ClientConnect, id, g_szBotName, "127.0.0.1", szMsg );
                dllfunc( DLLFunc_ClientPutInServer, id );
 
                cs_set_user_team( id, CS_TEAM_T );
                ExecuteHamB( Ham_CS_RoundRespawn, id );
 
                set_pev( id, pev_effects, pev( id, pev_effects ) | EF_NODRAW );
                set_pev( id, pev_solid, SOLID_NOT );
                dllfunc( DLLFunc_Think, id );
 
                g_iFakeplayer = id;
            }
        }
    }
 
    public MsgDeathMsg( const iMsgId, const iMsgDest, const id ) {
        if( get_msg_arg_int( 2 ) == g_iFakeplayer )
            return PLUGIN_HANDLED;
 
        return PLUGIN_CONTINUE;
    }
#endif
 
// NEW TERRORIST
///////////////////////////////////////////
public EventRandromize( ) {
    if( !g_bEnabled || g_bFirstRound || g_bRandromized )
        return PLUGIN_CONTINUE;
 
    g_bRandromized = true;
 
    new i, iPlayers[ 32 ], iNum, iPlayer;
    get_players( iPlayers, iNum, "c" );
 
    if( iNum <= 1 )
        return PLUGIN_CONTINUE;
 
    for( i = 0; i < iNum; i++ ) {
        iPlayer = iPlayers[ i ];
 
        if( cs_get_user_team( iPlayer ) == CS_TEAM_T )
            cs_set_user_team( iPlayer, CS_TEAM_CT );
    }
 
    new iRandomPlayer, CsTeams:iTeam;
 
    while( ( iRandomPlayer = iPlayers[ random_num( 0, iNum - 1 ) ] ) == g_iLastTerr ) { }
 
    g_iLastTerr = iRandomPlayer;
 
    iTeam = cs_get_user_team( iRandomPlayer );
 
    if( iTeam == CS_TEAM_T || iTeam == CS_TEAM_CT ) {
        cs_set_user_team(iRandomPlayer, CS_TEAM_T);
 
        new szName[ 32 ];
        get_user_name( iRandomPlayer, szName, 31 );
 
        for( i = 0; i < iNum; i++ )
            ColorChat(iPlayers[ i ], RED, "%s^4 %L", g_szPrefix, iPlayers[ i ], "DR_NOW_TERR", szName);
 
        if( !g_bRestart && is_valid_ent( g_iThinker ) )
            entity_set_float( g_iThinker, EV_FL_nextthink, get_gametime( ) + 15.0 );
    } else {
        g_bRandromized = false;
        EventRandromize( );
    }
 
    return PLUGIN_CONTINUE;
}
 
// NEW ROUND
///////////////////////////////////////////
public EventRoundStart( ) {
    if( !g_bEnabled )
        return PLUGIN_CONTINUE;
 
    g_bRandromized    = false;
    g_bStarting    = false;
 
    new i, iPlayers[ 32 ], iNum, iRealPlayers, CsTeams:iTeam;
    get_players( iPlayers, iNum, "c" );
 
    if( iNum <= 1 )
        return PLUGIN_CONTINUE;
 
    for( i = 0; i < iNum; i++ ) {
        iTeam = cs_get_user_team( iPlayers[ i ] );
 
        if( iTeam == CS_TEAM_T || iTeam == CS_TEAM_CT )
            iRealPlayers++;
    }
 
    if( iRealPlayers <= 1 ) {
        set_hudmessage( 0, 128, 0, -1.0, 0.1, 0, 4.0, 4.0, 0.5, 0.5, 4 );
 
        for( i = 0; i < iNum; i++ )
            ShowSyncHudMsg( iPlayers[ i ], g_iHudSync, "%L", iPlayers[ i ], "DR_NOT_ENOUGH" );
 
        return PLUGIN_CONTINUE;
    }
 
    set_pcvar_num( g_pAutoBalance, 0 );
    set_pcvar_num( g_pLimitTeams, 0 );
 
    if( g_bFirstRound ) {
        set_hudmessage( 0, 128, 0, -1.0, 0.1, 0, 4.0, 4.0, 0.5, 0.5, 4 );
 
        for( i = 0; i < iNum; i++ ) {
            ShowSyncHudMsg( iPlayers[ i ], g_iHudSync, "%L", iPlayers[ i ], "DR_STARTING" );
 
            ColorChat( iPlayers[ i ], RED, "%s^1 %L", g_szPrefix, iPlayers[ i ], "DR_STARTING_CC" );
        }
 
        if( is_valid_ent( g_iThinker ) ) {
            g_bRestart = true;
 
            entity_set_float( g_iThinker, EV_FL_nextthink, get_gametime( ) + 9.0 );
        } else
            set_task( 9.0, "RestartRound" );
 
        g_bStarting = true;
        g_bFirstRound = false;
    }
 
    return PLUGIN_CONTINUE;
}
 
// CHECK TERRORIST
///////////////////////////////////////////
public FwdThinker( iEntity ) {
    if( g_bRestart ) {
        g_bRestart = false;
 
        RestartRound( );
    } else
        CheckTerrorists( );
 
    entity_set_float( iEntity, EV_FL_nextthink, get_gametime( ) + 15.0 );
}
 
public CheckTerrorists( ) {
    if( !g_bEnabled || g_bFirstRound || g_bStarting )
        return PLUGIN_CONTINUE;
 
    new i, iPlayers[ 32 ], iTerrors, iNum, iRealPlayers, CsTeams:iTeam;
    get_players( iPlayers, iNum, "c" );
 
    if( iNum <= 1 )
        return PLUGIN_CONTINUE;
 
    for( i = 0; i < iNum; i++ ) {
        iTeam = cs_get_user_team( iPlayers[ i ] );
 
        if( iTeam == CS_TEAM_T )
            iTerrors++;
 
        if( iTeam == CS_TEAM_T || iTeam == CS_TEAM_CT )
            iRealPlayers++;
    }
 
    if( iRealPlayers <= 1 ) {
        set_hudmessage( 0, 128, 0, -1.0, 0.1, 0, 4.0, 4.0, 0.5, 0.5, 4 );
 
        for( i = 0; i < iNum; i++ )
            ShowSyncHudMsg( iPlayers[ i ], g_iHudSync, "%L", iPlayers[ i ], "DR_NOT_ENOUGH" );
 
        return PLUGIN_CONTINUE;
    }
 
    if( iTerrors == 0 ) {
        for( i = 0; i < iNum; i++ ) {
            ColorChat(iPlayers[ i ], RED, "%s^1 %L", g_szPrefix, iPlayers[ i ], "DR_NO_DETECT");
 
            if( is_user_alive( iPlayers[ i ] ) && cs_get_user_team( iPlayers[ i ] ) == CS_TEAM_CT )
                user_silentkill( iPlayers[ i ] );
        }
 
        set_task( 0.5, "EventRandromize" );
    }
 
    return PLUGIN_CONTINUE;
}
 
// LIFE SYSTEM
///////////////////////////////////////////
public EventTerrsWin( ) {
    if( !g_bEnabled || g_bFirstRound )
        return PLUGIN_CONTINUE;

Dodanych wklejek: 11179
Powered By (Pav32) Pastebin © 2011