AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   I am confused. (https://forums.alliedmods.net/showthread.php?t=184643)

kileedyg 05-07-2012 09:43

I am confused.
 
#8

Exolent[jNr] 05-07-2012 09:49

Re: Crashing server on swap teams...
 
Add a delay when switching teams, or use this to change teams.

Exolent[jNr] 05-07-2012 10:55

Re: Crashing server on swap teams...
 
Quote:

Originally Posted by kileedyg (Post 1704176)
PHP Code:

SwapTeams( )
{
    for( new 
1<= g_iMaxPlayersi++ )
    {
        if( 
is_user_connected) )
        {
            switch( 
get_user_team) )
            {
                case 
CS_TEAM_T:
                {
                    
cs_set_team_idiTEAM_CT );
                }
                    
                case 
CS_TEAM_CT:
                {
                    
cs_set_team_idiTEAM_TERRORIST );
                }
            }
        }
    }


is this correct?

You should use cs_set_team().

As for the rest, copy/pasting code into a plugin is really bad. You should understand what you are doing instead of piecing bits and pieces together of what you want.

Exolent[jNr] 05-07-2012 11:12

Re: Crashing server on swap teams...
 
Don't cross-post about other threads for help.

Exolent[jNr] 05-07-2012 13:05

Re: Crashing server on swap teams...
 
Quote:

Originally Posted by Exolent[jNr] (Post 1704148)
Add a delay when switching teams

Such as switching 5 players every 0.5 seconds.

Exolent[jNr] 05-07-2012 15:08

Re: Crashing server on swap teams...
 
No, I said you have to swap at intervals, such as swapping 5 players, wait 0.5 seconds, swap 5 players, ... etc.

Exolent[jNr] 05-07-2012 15:26

Re: Crashing server on swap teams...
 
PHP Code:

SwapTeams( )
{
    const 
GROUP 5// at a time
    
const Float:INTERVAL 0.5// delay between groups
    
    
new switcheddata];
    
    for( new 
1<= g_iMaxPlayersi++ )
    {
        if( 
is_user_connected) )
        {
            
data] = get_user_team);
            
            if( 
TEAM_T <= data] <= TEAM_CT )
            {
                
data] = data];
                
                if( 
switched++ < GROUP )
                {
                    
TaskSwitchdata);
                }
                else
                {
                    
set_taskINTERVAL * ( switched GROUP ), "TaskSwitch"idatasizeofdata ) );
                }
            }
        }
    }
}

public 
TaskSwitchdata[ ], id )
{
    if( 
is_user_connectedid ) )
    {
        
cs_set_teamiddata] );
    }



kileedyg 05-10-2012 09:59

Re: Crashing server on swap teams...
 
points for survive working,teamswap crashing,the ct stuck on countdown (eight),and it doesen't give weapons on round start for t even if ct stuck,compiler showing 0 errors, im confused


PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
#include <fun>
#include <cs_team_changer>

#define MAXPLAYERS 32

enum _:iTeams
{
    
TERRORIST,
    
CT
}

enum
{
    
TEAM_UNASSIGNED 0,    // (0)
    
TEAM_TERRORIST,        // (1)
    
TEAM_CT,            // (2)
    
TEAM_SPECTATOR        // (3)
};

enum NadeTypes
{
    
NADE_HE,
    
NADE_FL,
    
NADE_SM
};

new const 
g_szNadeNamesNadeTypes ][ ] =
{
    
"HE Grenade",
    
"Flashbang",
    
"Smoke Grenade"
};

new const 
g_iNadeIdsNadeTypes ] =
{
    
CSW_HEGRENADE,
    
CSW_FLASHBANG,
    
CSW_SMOKEGRENADE
};

new const 
g_iNadeLimitNadeTypes ] =
{
    
1,
    
2,
    
1
};

new const 
g_szNadeWeaponNamesNadeTypes ][ ] =
{
    
"weapon_hegrenade",
    
"weapon_flashbang",
    
"weapon_smokegrenade"
};

enum NadeInfo
{
    
NADE_COUNT,
    
NADE_CHANCE
};

enum ArmorInfo
{
    
ARMOR_VALUE,
    
CsArmorType:ARMOR_TYPE
};

new const 
g_szTeamToCvarCsTeams ][ ] =
{
    
"",
    
"hider",
    
"seeker",
    
""
};

new const 
g_szNadeTypeToCvarNadeTypes ][ ] =
{
    
"grenade",
    
"flash",
    
"smoke"
};

new const 
g_szNadeInfoToCvarNadeInfo ][ ] =
{
    
"count",
    
"chance"
};

new const 
g_szArmorInfoToCvarArmorInfo ][ ] =
{
    
"value",
    
"type"
};

new 
g_iNadeInfoCsTeams ][ NadeTypes ][ NadeInfo ] =
{
    
// Spectator
    
{
        
// HE
        
{
            
0,    // Count
            
0    // Chance
        
},
        
// Flash
        
{
            
0,    // Count
            
0    // Chance
        
},
        
// Smoke
        
{
            
0,    // Count
            
0    // Chance
        
}
    },
    
// Hider
    
{
        
// HE
        
{
            
1,    // Count
            
100    // Chance
        
},
        
// Flash
        
{
            
2,    // Count
            
100    // Chance
        
},
        
// Smoke
        
{
            
1,    // Count
            
100    // Chance
        
}
    },
    
// Seeker
    
{
        
// HE
        
{
            
0,    // Count
            
0    // Chance
        
},
        
// Flash
        
{
            
0,    // Count
            
0    // Chance
        
},
        
// Smoke
        
{
            
0,    // Count
            
0    // Chance
        
}
    },
    
// Spectator
    
{
        
// HE
        
{
            
0,    // Count
            
0    // Chance
        
},
        
// Flash
        
{
            
0,    // Count
            
0    // Chance
        
},
        
// Smoke
        
{
            
0,    // Count
            
0    // Chance
        
}
    }
};

new 
g_iArmorInfoCsTeams ][ ArmorInfo ] =
{
    
// Spectator
    
{
        
// Value
        
0,
        
// Type
        
CS_ARMOR_NONE
    
},
    
// Hider
    
{
        
// Value
        
100,
        
// Type
        
CS_ARMOR_VESTHELM
    
},
    
// Seeker
    
{
        
// Value
        
100,
        
// Type
        
CS_ARMOR_VESTHELM
    
},
    
// Spectator
    
{
        
// Value
        
0,
        
// Type
        
CS_ARMOR_NONE
    
}
};
enum ( += 1000 )
{
    
TASK_ID_BLANK 0,
    
TASK_ID_GIVEWEAPONS

};


new 
bool:g_bWeaponsGiven;
new 
pCvar_NadeInfoCsTeams ][ NadeTypes ][ NadeInfo ];
new 
pCvar_ArmorInfoCsTeams ][ ArmorInfo ];
new 
g_iHiderSurviveFrags 1;
new 
g_iMsgId_ScoreInfo;
new 
pCvar_HiderSurviveFrags;












const 
TASK_TIMER 23019;
const 
OFFSET_PRIMARYWEAPON 116


new const 
g_szDoor[] = "secret";
new const 
g_szDoorRotating[] = "secret";
new const 
g_szBreakable[] = "secret";
new const 
tlaimejo[] = "secret" 
new const ctlaimejo[] = "secret" 
new const roundpradzia[] = "secret" 





new g_pTimer;
new 
g_pSound;
new 
g_pGameName;
new 
g_pFadeColor;
new 
g_pSwitch;
new 
g_pSlash;
new 
g_pRemoveBreakables;
new 
g_pRemoveDoors;
new 
g_pPickup;
new 
g_pNoFlash;
new 
g_pFootSteps;
new 
g_pBlockKill;
new 
g_pNoSlowDown;

new 
Trie:g_tEntities;

new 
g_iTimer;
new 
g_iMaxPlayers;
new 
g_iMsgScreenFade;
new 
g_iRegisterSpawn;
new 
g_iRoundsLost;
new 
g_iSlash;
new 
g_iFadeColor];

new 
bool:g_bStarted;
new 
bool:g_bAllowSlash;
new 
bool:g_bNoFlash;
new 
bool:g_bTimerSounds;
new 
bool:g_bNoSlowDown;

new 
CsTeams:g_iSemiclipTeam33 ];
new 
bool:g_bSemiclipSolid33 ];
new 
bool:g_bSemiclipRestore33 ];


new 
pCvar_Enable;
new 
pCvar_AlphaPercent;

/* Cached cvar variables + their default values */

new g_iEnable 1// 0 = disabled, 1 = per team, 2 = everyone , semiclip

new Float:g_fAlphaPercent 50.0// percentage of transparency of players

const fPainShock 108

new g_pCvarPainShockFree



RegisterCvars
( )
{
    new 
szValue32 ];
    
    
num_to_strg_iEnableszValue31 );
    
pCvar_Enable register_cvar"hns_semiclip_enable"szValue );
    
    
float_to_strg_fAlphaPercentszValue31 );
    
pCvar_AlphaPercent register_cvar"hns_semiclip_alpha"szValue );
    
    
    
    
    
    
    
num_to_strg_iHiderSurviveFragsszValue31 );
    
pCvar_HiderSurviveFrags register_cvar"hns_hider_survive_frags"szValue );
    
    new 
NadeTypes:iNadeTypeNadeInfo:iNadeInfoszCvar64 ];
    for( new 
CsTeams:iTeam CS_TEAM_TiTeam <= CS_TEAM_CTiTeam++ )
    {
        for( 
iNadeType NadeTypes:0iNadeType NadeTypesiNadeType++ )
        {
            for( 
iNadeInfo NadeInfo:0iNadeInfo NadeInfoiNadeInfo++ )
            {
                
formatexszCvar63"hns_%s_%s_%s"g_szTeamToCvariTeam ], g_szNadeTypeToCvariNadeType ], g_szNadeInfoToCvariNadeInfo ] );
                
num_to_strg_iNadeInfoiTeam ][ iNadeType ][ iNadeInfo ], szValue31 );
                
                
pCvar_NadeInfoiTeam ][ iNadeType ][ iNadeInfo ] = register_cvarszCvarszValue );
            }
        }
    }
    
    new 
ArmorInfo:iArmorInfo;
    for( new 
CsTeams:iTeam CS_TEAM_TiTeam <= CS_TEAM_CTiTeam++ )
    {
        for( 
iArmorInfo ArmorInfo:0iArmorInfo ArmorInfoiArmorInfo++ )
        {
            
formatexszCvar63"hns_%s_armor_%s"g_szTeamToCvariTeam ], g_szArmorInfoToCvariArmorInfo ] );
            
num_to_strg_iArmorInfoiTeam ][ iArmorInfo ], szValue31 );
            
            
pCvar_ArmorInfoiTeam ][ iArmorInfo ] = register_cvarszCvarszValue );
        }
    }
}

CacheCvars( )
{
    
g_iEnable get_pcvar_numpCvar_Enable );
    
g_fAlphaPercent get_pcvar_floatpCvar_AlphaPercent );
    
    static 
CsTeams:iTeamNadeTypes:iNadeTypeNadeInfo:iNadeInfoArmorInfo:iArmorInfo;
    for( 
iTeam CS_TEAM_TiTeam <= CS_TEAM_CTiTeam++ )
    {
        for( 
iNadeType NadeTypes:0iNadeType NadeTypesiNadeType++ )
        {
            for( 
iNadeInfo NadeInfo:0iNadeInfo NadeInfoiNadeInfo++ )
            {
                
g_iNadeInfoiTeam ][ iNadeType ][ iNadeInfo ] = get_pcvar_numpCvar_NadeInfoiTeam ][ iNadeType ][ iNadeInfo ] );
            }
        }
        
        for( 
iArmorInfo ArmorInfo:0iArmorInfo ArmorInfoiArmorInfo++ )
        {
            
g_iArmorInfoiTeam ][ iArmorInfo ] = get_pcvar_numpCvar_ArmorInfoiTeam ][ iArmorInfo ] );
        }
    }
    
    
    

}

public 
plugin_precache( )
{
    
precache_generic(tlaimejo
    
precache_generic(ctlaimejo
    
precache_generic(roundpradzia)
    new 
iEnt create_entity"info_map_parameters" );
    
DispatchKeyValueiEnt"buying""3" );
    
DispatchSpawniEnt );
    
    
iEnt create_entity"hostage_entity" );
    
entity_set_originiEntFloat:{ 0.00.0, -55000.0 } );
    
entity_set_sizeiEntFloat:{ -1.0, -1.0, -1.0 }, Float:{ 1.01.01.0 } );
    
DispatchSpawniEnt );
    
    new const 
szEntities[][] =
    {
        
"func_hostage_rescue"
        
"info_hostage_rescue"
        
"func_bomb_target"
        
"info_bomb_target"
        
"hostage_entity",
        
"info_vip_start"
        
"func_vip_safetyzone"
        
"func_escapezone",
        
"func_buyzone",
        
"armoury_entity"
    
}
    
    
g_tEntities TrieCreate( );
    
    for( new 
0sizeof szEntitiesi++ )
    {
        
TrieSetCellg_tEntitiesszEntities], );
    }
    
    
g_pRemoveDoors register_cvar"hns_removedoors""0" );
    
g_pRemoveBreakables register_cvar"hns_removebreakables""0" );
    
g_iRegisterSpawn register_forwardFM_Spawn"FwdSpawnPost");
}

public 
Message_StatusIcon(iMsgIdiMsgDestid

    static 
szIcon[8]; 
    
get_msg_arg_string(2szIconcharsmax(szIcon)); 
    if( 
equal(szIcon"buyzone") )
    { 
        if( 
get_msg_arg_int(1) ) 
        { 
            
set_pdata_int(id235get_pdata_int(id235) & ~(1<<0));
            return 
PLUGIN_HANDLED
        } 
    } 
     
    return 
PLUGIN_CONTINUE
}  

public 
plugin_init( )
{
    
register_dictionary("hns.txt")
    
register_plugin"hns . lt""v1""jon,connor,exolent,vycka" );    
    
//g_item_id = wc_add(WC_TEAMS_T, 100, true);
    
g_pTimer =  register_cvar"hns_timer""8" );
    
g_pGameName register_cvar"hns_gamename""hns . lt" );
    
g_pSound register_cvar"hns_sound""1" );
    
g_pSwitch register_cvar"hns_switch""0" );
    
g_pSlash register_cvar"hns_slash""0" );
    
g_pFadeColor register_cvar"hns_fadecolor""0 0 0 150" );
    
g_pFootSteps register_cvar"hns_footsteps""1" ); // 0 rooftops
    
g_pPickup register_cvar"hns_pickup""0" );
    
g_pNoFlash register_cvar"hns_noflash""1" );
    
g_pBlockKill register_cvar"hns_blockkill""1" );
    
g_pNoSlowDown register_cvar"hns_noslowdown""0" );
    
g_pCvarPainShockFree register_cvar("hns_painshockfree""1"// , FCVAR_SERVER
    
    
g_iMaxPlayers get_maxplayers( );
    
g_iMsgScreenFade get_user_msgid"ScreenFade" );
    
    
register_event"HLTV""EventNewRound""a""1=0""2=0" );
    
//register_event( "SendAudio", "EventTerroristsWin", "a", "2=%!MRAD_terwin" );
    //register_event( "SendAudio", "EventCTsWin", "a", "2=%!MRAD_ctwin" );
    
    
register_logevent"EventRoundStart"2"1=Round_Start" );
    
register_logevent"EventRoundEnd"2"1=Round_End" );
    
    
set_msg_blockget_user_msgid"HostagePos" ), BLOCK_SET );
    
register_messageg_iMsgScreenFade"MsgScreenFade" );
    
register_messageget_user_msgid"TextMsg" ), "MsgTextMsg" );
    
register_message(get_user_msgid("StatusIcon"), "Message_StatusIcon");
    
    
RegisterHamHam_Spawn"player""FwdPlayerSpawnPost");
    
RegisterHamHam_Killed"player""FwdPlayerKilled" );
    
RegisterHamHam_Touch"weaponbox""FwdTouchWeapon" );
    
RegisterHamHam_Item_Deploy"weapon_knife""FwdKnifeDeployPost");
    
RegisterHamHam_Weapon_PrimaryAttack"weapon_knife""FwdKnifePrimaryAttack" );
    
RegisterHamHam_Weapon_SecondaryAttack"weapon_knife""FwdKnifeSecondaryAttack" );
    
RegisterHam(Ham_TakeDamage"player""Player_TakeDamage"1)
    
    
unregister_forwardFM_Spawng_iRegisterSpawn);
    
register_forwardFM_GetGameDescription"FwdGameDescription" );
    
register_forwardFM_ClientKill"FwdClientKill" );
    
register_forwardFM_AddToFullPack"FwdAddToFullPack");
    
register_forward(FM_SetModel"fwdSetModel"1)
    
    
    
    
server_cmd"sv_restart 1" );
    
    
RegisterCvars( );
    
    
g_iMaxPlayers get_maxplayers( );
}
public 
client_connect(id)
{
    
}
public 
plugin_end( )
{
    
TrieDestroyg_tEntities );
}

public 
EventNewRound()
{
    
CacheCvars( );
    
remove_taskTASK_TIMER );
    
    new 
szColor20 ], szRed], szGreen], szBlue], szAlpha];
    
get_pcvar_stringg_pFadeColorszColor19 );
    
parseszColorszRed4szGreen4szBlue4szAlpha);
    
    
g_iFadeColor] = str_to_numszRed );
    
g_iFadeColor] = str_to_numszGreen );
    
g_iFadeColor] = str_to_numszBlue );
    
g_iFadeColor] = str_to_numszAlpha );
    
g_bNoFlash bool:get_pcvar_numg_pNoFlash );
    
g_bNoSlowDown bool:get_pcvar_numg_pNoSlowDown );
    
g_bTimerSounds bool:get_pcvar_numg_pSound );
    
g_iSlash get_pcvar_numg_pSlash );
    
g_iHiderSurviveFrags get_pcvar_numpCvar_HiderSurviveFrags );
    
    if( 
GetPlayers( ) )
    {
        
g_bStarted true;
        
g_iTimer get_pcvar_numg_pTimer );
    }
}

public 
EventRoundStart()
{
    if( 
g_bStarted )
    {
        
TaskTimer( );
    }
}


public 
EventRoundEnd( ) {
    if( !
GetPlayers( ) || !g_bStarted ) {
    return 
PLUGIN_CONTINUE;
    }
    if( !
TerroristAlive( ) ) {
    
SwapTeams( );
    
g_bAllowSlash false;
    
g_iRoundsLost 0;
    
client_cmd(0"spk ^"%s^""ctlaimejo
    
set_hudmessage50150220, -1.00.7510.05.00.10.1);
    
show_hudmessage0"%L "LANG_PLAYER"CT_NUGALEJO" );
    }
    else if( 
g_iRoundsLost >= get_pcvar_numg_pSwitch ) > ) {
    
SwapTeams( );
    
g_bAllowSlash false;
    
g_iRoundsLost 0;
    }
    else {    
    
client_cmd(0"spk ^"%s^""tlaimejo
    
set_hudmessage15055, -1.00.7510.05.00.10.2);
    
show_hudmessage0"%L"LANG_PLAYER"T_NUGALEJO" );    
    }
    if( 
g_iHiderSurviveFrags )
    {
        static 
iiFrags;
        for( 
1<= g_iMaxPlayersi++ )
        {
            if( 
is_user_alive) && cs_get_user_team) == CS_TEAM_T )
            {
                
iFrags get_user_frags) + g_iHiderSurviveFrags;
                
                
set_user_fragsiiFrags );
                
                
UTIL_ScoreInfoiiFragscs_get_user_deaths), CS_TEAM_T );
                
                
client_printi,print_chat"You earned %i frag%s for surviving the round!"g_iHiderSurviveFragsg_iHiderSurviveFrags == "" "s" );
            }
        }
    }
    return 
PLUGIN_CONTINUE;
}


public 
MsgScreenFadeiIdiDestiClient )
{
    if( 
get_msg_arg_int) == 255 
    
&& get_msg_arg_int) == 255 
    
&& get_msg_arg_int) == 255 )
    {
        switch( 
cs_get_user_teamiClient ) )
        {
            case 
CS_TEAM_T:
            {
                if( 
g_bNoFlash )
                {
                    return 
PLUGIN_HANDLED;
                }
            }
            
            case 
CS_TEAM_CT:
            {
                if( 
g_iTimer )
                {
                    return 
PLUGIN_HANDLED;
                }
            }
        }
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
MsgTextMsg( )
{
    static 
szMsg32 ];
    
get_msg_arg_string2szMsg31 );
    
    switch( 
szMsg] )
    {
        case 
'C''T''H'
        {
            return 
PLUGIN_HANDLED;
        }
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
client_PreThinkiClient ) {
    if( 
g_bNoSlowDown && is_user_aliveiClient ) ) {
    
entity_set_floatiClientEV_FL_fuser20.0 );
    }
    if( 
g_iEnable ) {
    static 
iLastThinki;    
    if( 
iClient iLastThink ) {
    for( 
1<= g_iMaxPlayersi++ ) {
    if( 
is_user_alive) ) {
    
g_iSemiclipTeam] = cs_get_user_team);
    
g_bSemiclipSolid] = bool:( entity_get_intiEV_INT_solid ) == SOLID_SLIDEBOX );
    }
    else {
    
g_bSemiclipSolid] = false;
    }
    }
    }    
    
iLastThink iClient;
    if( 
g_bSemiclipSolidiClient ] ) {
    for( 
1<= g_iMaxPlayersi++ ) {
    if( 
!= iClient
    
&& g_bSemiclipSolid]
    && !
g_bSemiclipRestore]
    && ( 
g_iSemiclipTeamiClient ] == g_iSemiclipTeam] || g_iEnable == ) ) {
    
entity_set_intiEV_INT_solidSOLID_NOT );
    
g_bSemiclipRestore] = true;
    }
    }
    }
    }
}

public 
FwdPlayerSpawnPostiClient )
{
    if( !
is_user_aliveiClient ) )
    {
        return 
HAM_IGNORED;
    }
    
    
    new 
CsTeams:iTeam;
    
iTeam cs_get_user_teamiClient );
    
    
cs_reset_user_modeliClient );
    
set_user_footstepsiClientget_pcvar_numg_pFootSteps ) == _:iTeam );
    
strip_user_weaponsiClient );
    
set_pdata_intiClientOFFSET_PRIMARYWEAPON
    
give_itemiClient"weapon_knife" );
    if( 
iTeam == CS_TEAM_T  ) {
    static 
iParams];
    
iParams] = _:iTeam;
    if( 
g_bWeaponsGiven ) {
    
set_task0.6"TaskGiveWeapons"iClient TASK_ID_GIVEWEAPONSiParams);
    }
    }
    
    return 
HAM_IGNORED;
}

public 
FwdPlayerKillediClient )
{
    switch( 
cs_get_user_teamiClient ) )
    {
        case 
CS_TEAM_T:
        {
            if( 
g_bStarted )
            {
                new 
iPlayersMAXPLAYERS ], iNum;
                
get_playersiPlayersiNum"ae""TERRORIST" );
                
                if( 
iNum == )
                {
                    
                }
            }
        }
        
        case 
CS_TEAM_CT:
        {
            if( 
g_iTimer )
            {
                
entity_set_intiClientEV_INT_flagsentity_get_intiClientEV_INT_flags ) & ~FL_FROZEN );
                
                
UTIL_ScreenFadeiClient);
            }
        }
    }
}

public 
FwdTouchWeaponiEntiClient // pickup weap
{
    if( ( 
<= iClient <= g_iMaxPlayers ) && !get_pcvar_numg_pPickup ) )
    {
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;
}

public 
FwdKnifePrimaryAttackiEnt 
{
    new 
iClient entity_get_edictiEntEV_ENT_owner )
    
    if( !
iClient )
    {
        return 
HAM_IGNORED;
    }
    
    switch( 
cs_get_user_teamiClient ) )
    {
        case 
CS_TEAM_T:
        {
            return 
HAM_SUPERCEDE;
        }
        
        case 
CS_TEAM_CT:
        {
            if( !
g_bAllowSlash )
            {
                
ExecuteHamBHam_Weapon_SecondaryAttackiEnt );
                
                return 
HAM_SUPERCEDE;
            }
        }
    }
    
    return 
HAM_IGNORED;
}

public 
FwdKnifeSecondaryAttackiEnt )
{
    new 
iClient entity_get_edictiEntEV_ENT_owner )
    
    if( !
iClient )
    {
        return 
HAM_IGNORED;
    }
    
    if( 
cs_get_user_teamiClient ) == CS_TEAM_T )
    {
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;
}

public 
FwdKnifeDeployPostiEnt )
{
    new 
iClient entity_get_edictiEntEV_ENT_owner )
    
    if( !
iClient )
    {
        return 
HAM_IGNORED;
    }
    
    if( 
cs_get_user_teamiClient ) == CS_TEAM_T )
    {
        
// entity_set_string( iClient, EV_SZ_viewmodel, "" );
        
entity_set_stringiClientEV_SZ_weaponmodel"" );
    }
    
    return 
HAM_IGNORED;
}

public 
FwdGameDescription( )
{
    static 
szGameName32 ];
    
get_pcvar_stringg_pGameNameszGameName31 );
    
    if( 
szGameName] )
    {
        
forward_returnFMV_STRINGszGameName );
        
        return 
FMRES_SUPERCEDE;
    }
    
    return 
FMRES_IGNORED;
}

public 
FwdSpawnPostiEnt )
{
    if( !
is_valid_entiEnt ) )
    {
        return 
FMRES_IGNORED;
    }
    
    static 
szClass32 ];
    
entity_get_stringiEntEV_SZ_classnameszClass31 );
    
    if( 
TrieKeyExistsg_tEntitiesszClass ) )
    {
        
remove_entityiEnt );
    }
    
    else if( 
get_pcvar_numg_pRemoveBreakables 
    && 
equalszClassg_szBreakable 
    && 
entity_get_floatiEntEV_FL_takedamage ) )
    {
        
remove_entityiEnt );
    }
    
    else if( 
get_pcvar_numg_pRemoveDoors ) )
    {
        if( 
equalszClassg_szDoor ) || equalszClassg_szDoorRotating ) ) 
        {
            
remove_entityiEnt );
        }    
    }
    
    return 
FMRES_IGNORED;
}

public 
FwdClientKillidiClient ) {
    if( 
is_user_connected(id) && is_user_alive(id) && get_pcvar_numg_pBlockKill ) ) {
    
console_printid"%L"LANG_PLAYER,"SAVIZUDYBEKONSOLE")
    
set_hudmessage111111140, -1.00.7010.16.10.00.2)
    
show_hudmessageid"%L"LANG_PLAYER"SAVIZUDYBE")    
    return 
FMRES_SUPERCEDE;
    }
    
    return 
FMRES_IGNORED;
}


public 
TaskTimer( )
{
    if( 
g_iTimer )
    {
        for( new 
1<= g_iMaxPlayersi++ )
        {
            if( 
is_user_connected) && !is_user_alive) )
            {
                continue;
            }
            
            if( 
cs_get_user_team) == CS_TEAM_CT )
            {
                
entity_set_intiEV_INT_flagsentity_get_intiEV_INT_flags ) | FL_FROZEN );
                
                
UTIL_ScreenFade);
            }
            
            if( 
g_bTimerSounds )
            {
                static 
szSound20 ];
                
num_to_wordg_iTimerszSound19 );
                
client_cmdi"spk fvox/%s"szSound );
            }
        }
        
        
set_hudmessage111111140, -1.00.7511.01.10.00.0);
        
show_hudmessage0"%i"g_iTimer );
        
        
g_iTimer--;
        
set_task1.0"TaskTimer"TASK_TIMER );
    }
    
    else
    {
        new 
CsTeams:iTeam;
        
        for( new 
1<= g_iMaxPlayersi++ )
        {
            if( !
is_user_alive) )
            {
                continue;
            }
            
            
iTeam cs_get_user_team);
            
            if( 
iTeam == CS_TEAM_T )
            {
                continue;
            }
            
            else if( 
iTeam == CS_TEAM_CT )
            {
                
entity_set_intiEV_INT_flagsentity_get_intiEV_INT_flags ) & ~FL_FROZEN );
                
                
UTIL_ScreenFadei);
            }
            static 
iParams];
            
iParams] = _:iTeam;
            
TaskGiveWeaponsiParamsTASK_ID_GIVEWEAPONS );
            
client_cmd(0"spk ^"%s^""roundpradzia
            
g_bWeaponsGiven true;
        }

        
        if( 
g_iRoundsLost == g_iSlash )
        {
        
g_bAllowSlash true;
        
set_hudmessage111111111, -1.00.7510.02.01.00.0);
        
show_hudmessage0"%i %L"g_iSlashLANG_PLAYER"SLASH" );
        }

        
set_hudmessage111111111, -1.00.7510.04.01.00.0);
        
show_hudmessage0"%L"LANG_PLAYER"STARTAS" );
    }
}


public 
TaskGiveWeaponsiParams[ ], iTaskId )
{
    static 
CsTeams:iTeamclient;
    
    
iTeam CsTeams:iParams];
    
client iTaskId TASK_ID_GIVEWEAPONS;
    
    static 
NadeTypes:iNadeiLimitiGiveMaxiChanceiTriesiGiven;
    
    for( 
iNade NadeTypes:0iNade NadeTypesiNade++ )
    {
        
iLimit g_iNadeLimitiNade ];
        
iGiveMax g_iNadeInfoiTeam ][ iNade ][ NADE_COUNT ];
        
iChance g_iNadeInfoiTeam ][ iNade ][ NADE_CHANCE ];
        
iGiven 0;
        
        for( 
iTries 0iTries iGiveMaxiTries++ )
        {
            if( 
iChance == 100 || random_num1100 ) <= iChance )
            {
                
iGiven++;
            }
        }
        
        if( 
iGiven )
        {
            for( 
iTries 0iTries iGiveniTries++ )
            {
                if( 
iTries iLimit )
                {
                    
give_itemclientg_szNadeWeaponNamesiNade ] );
                }
                else
                {
                    
cs_set_user_bpammoclientg_iNadeIdsiNade ], iGiven );
                    
                    break;
                }
            }
            
            if( 
iChance != 100 )
            {
                
client_printclient,print_chat"You received %i of %i %s%s! (%i%% chance per)",\
                    
iGiven,\
                    
iGiveMax,\
                    
g_szNadeNamesiNade ],\
                    
iGiveMax == "" "s",\
                    
iChance
                    
);
            }
        }
    }
    
    
cs_set_user_armorclientg_iArmorInfoiTeam ][ ARMOR_VALUE ], g_iArmorInfoiTeam ][ ARMOR_TYPE ] );
}


SwapTeams( )
{
    const 
GROUP 5// at a time
    
const Float:INTERVAL 0.5// delay between groups
    
    
new switcheddata];
    
    for( new 
1<= g_iMaxPlayersi++ )
    {
        if( 
is_user_connected) )
        {
            
data] = get_user_team);
            
            if( 
TEAM_TERRORIST <= data] <= TEAM_CT )
            {
                
data] = data];
                
                if( 
switched++ < GROUP )
                {
                    
TaskSwitchdata);
                }
                else
                {
                    
set_taskINTERVAL * ( switched GROUP ), "TaskSwitch"idatasizeofdata ) );
                }
            }
        }
    }
}

public 
TaskSwitchdata[ ], id )
{
    if( 
is_user_connectedid ) )
    {
        
cs_set_teamiddata] );
    }
}

UTIL_ScreenFade( const iClientiFade )
{
    
message_beginMSG_ONEg_iMsgScreenFade_iClient )
    
write_short7500 iFade );
    
write_short7500 iFade );
    
write_short0x0000 );
    
write_byteg_iFadeColor] );
    
write_byteg_iFadeColor] );
    
write_byteg_iFadeColor] );
    
write_byteg_iFadeColor] );
    
message_end();
}

bool:TerroristAlive( )
{
    for( new 
1<= g_iMaxPlayersi++ )
    {
        if( 
is_user_alive) && cs_get_user_team) == CS_TEAM_T )
        {
            return 
true;
        }
    }
    
    return 
false;
}

bool:GetPlayers( )
{    
    new 
iTerroristsiCTs;
    
    for( new 
1<= g_iMaxPlayersi++ )
    {
        if( !
is_user_connected) )
        {
            continue;
        }
        
        switch( 
cs_get_user_team) )
        {
            case 
CS_TEAM_T:
            {
                
iTerrorists++;
            }
            
            case 
CS_TEAM_CT:
            {
                
iCTs++;
            }
        }
        
        if( 
iTerrorists && iCTs )
        {
            return 
true;
        }
    }
    
    return 
false;
}

public 
client_PostThinkclient )
{
    static 
i;
    for( 
1<= g_iMaxPlayersi++ )
    {
        if( 
g_bSemiclipRestore] )
        {
            
entity_set_intiEV_INT_solidSOLID_SLIDEBOX );
            
g_bSemiclipRestore] = false;
        }
    }
}

public 
FwdAddToFullPackeseiEntityiHostiHostFlagsiPlayerpSet )
{
    if( 
iPlayer && g_iEnable )
    {
        if( ( 
g_iEnable == || g_iSemiclipTeamiHost ] == g_iSemiclipTeamiEntity ] )
        && 
g_bSemiclipSolidiHost ] && g_bSemiclipSolidiEntity ] )
        {
            
set_esesES_SolidSOLID_NOT );
            
            if( 
0.0 <= g_fAlphaPercent 100.0
            
&& g_iSemiclipTeamiHost ] == g_iSemiclipTeamiEntity ] )
            {
                
set_esesES_RenderModekRenderTransAlpha );
                
set_esesES_RenderAmt255.0 g_fAlphaPercent 100.0 );
            }
        }
    }
}
public 
Player_TakeDamage(id)
{
    if( 
get_pcvar_num(g_pCvarPainShockFree) )
    {
        
set_pdata_float(idfPainShock1.05)
    }
}
UTIL_ScoreInfo( const client, const iFrags, const iDeaths, const CsTeams:iTeam )
{
    
message_beginMSG_BROADCASTg_iMsgId_ScoreInfo );
    
write_byteclient );
    
write_shortiFrags );
    
write_shortiDeaths );
    
write_short);
    
write_short_:iTeam );
    
message_end( );



wickedd 05-10-2012 10:42

Re: I am confused.
 
Why did you delete your post?

kileedyg 05-10-2012 11:07

Re: I am confused.
 
Quote:

Originally Posted by wickedd (Post 1706189)
Why did you delete your post?


Becouse i don't want to yell with doublepost,also i fixed and added some more code


All times are GMT -4. The time now is 00:28.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.