|
BANNED
Join Date: Dec 2008
Location: Lithuania
|

05-10-2012
, 09:59
Re: Crashing server on swap teams...
|
#4
|
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_szNadeNames[ NadeTypes ][ ] = { "HE Grenade", "Flashbang", "Smoke Grenade" };
new const g_iNadeIds[ NadeTypes ] = { CSW_HEGRENADE, CSW_FLASHBANG, CSW_SMOKEGRENADE };
new const g_iNadeLimit[ NadeTypes ] = { 1, 2, 1 };
new const g_szNadeWeaponNames[ NadeTypes ][ ] = { "weapon_hegrenade", "weapon_flashbang", "weapon_smokegrenade" };
enum NadeInfo { NADE_COUNT, NADE_CHANCE };
enum ArmorInfo { ARMOR_VALUE, CsArmorType:ARMOR_TYPE };
new const g_szTeamToCvar[ CsTeams ][ ] = { "", "hider", "seeker", "" };
new const g_szNadeTypeToCvar[ NadeTypes ][ ] = { "grenade", "flash", "smoke" };
new const g_szNadeInfoToCvar[ NadeInfo ][ ] = { "count", "chance" };
new const g_szArmorInfoToCvar[ ArmorInfo ][ ] = { "value", "type" };
new g_iNadeInfo[ CsTeams ][ 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_iArmorInfo[ CsTeams ][ 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_NadeInfo[ CsTeams ][ NadeTypes ][ NadeInfo ]; new pCvar_ArmorInfo[ CsTeams ][ 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[ 4 ];
new bool:g_bStarted; new bool:g_bAllowSlash; new bool:g_bNoFlash; new bool:g_bTimerSounds; new bool:g_bNoSlowDown;
new CsTeams:g_iSemiclipTeam[ 33 ]; new bool:g_bSemiclipSolid[ 33 ]; new bool:g_bSemiclipRestore[ 33 ];
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 szValue[ 32 ]; num_to_str( g_iEnable, szValue, 31 ); pCvar_Enable = register_cvar( "hns_semiclip_enable", szValue ); float_to_str( g_fAlphaPercent, szValue, 31 ); pCvar_AlphaPercent = register_cvar( "hns_semiclip_alpha", szValue ); num_to_str( g_iHiderSurviveFrags, szValue, 31 ); pCvar_HiderSurviveFrags = register_cvar( "hns_hider_survive_frags", szValue ); new NadeTypes:iNadeType, NadeInfo:iNadeInfo, szCvar[ 64 ]; for( new CsTeams:iTeam = CS_TEAM_T; iTeam <= CS_TEAM_CT; iTeam++ ) { for( iNadeType = NadeTypes:0; iNadeType < NadeTypes; iNadeType++ ) { for( iNadeInfo = NadeInfo:0; iNadeInfo < NadeInfo; iNadeInfo++ ) { formatex( szCvar, 63, "hns_%s_%s_%s", g_szTeamToCvar[ iTeam ], g_szNadeTypeToCvar[ iNadeType ], g_szNadeInfoToCvar[ iNadeInfo ] ); num_to_str( g_iNadeInfo[ iTeam ][ iNadeType ][ iNadeInfo ], szValue, 31 ); pCvar_NadeInfo[ iTeam ][ iNadeType ][ iNadeInfo ] = register_cvar( szCvar, szValue ); } } } new ArmorInfo:iArmorInfo; for( new CsTeams:iTeam = CS_TEAM_T; iTeam <= CS_TEAM_CT; iTeam++ ) { for( iArmorInfo = ArmorInfo:0; iArmorInfo < ArmorInfo; iArmorInfo++ ) { formatex( szCvar, 63, "hns_%s_armor_%s", g_szTeamToCvar[ iTeam ], g_szArmorInfoToCvar[ iArmorInfo ] ); num_to_str( g_iArmorInfo[ iTeam ][ iArmorInfo ], szValue, 31 ); pCvar_ArmorInfo[ iTeam ][ iArmorInfo ] = register_cvar( szCvar, szValue ); } } }
CacheCvars( ) { g_iEnable = get_pcvar_num( pCvar_Enable ); g_fAlphaPercent = get_pcvar_float( pCvar_AlphaPercent ); static CsTeams:iTeam, NadeTypes:iNadeType, NadeInfo:iNadeInfo, ArmorInfo:iArmorInfo; for( iTeam = CS_TEAM_T; iTeam <= CS_TEAM_CT; iTeam++ ) { for( iNadeType = NadeTypes:0; iNadeType < NadeTypes; iNadeType++ ) { for( iNadeInfo = NadeInfo:0; iNadeInfo < NadeInfo; iNadeInfo++ ) { g_iNadeInfo[ iTeam ][ iNadeType ][ iNadeInfo ] = get_pcvar_num( pCvar_NadeInfo[ iTeam ][ iNadeType ][ iNadeInfo ] ); } } for( iArmorInfo = ArmorInfo:0; iArmorInfo < ArmorInfo; iArmorInfo++ ) { g_iArmorInfo[ iTeam ][ iArmorInfo ] = get_pcvar_num( pCvar_ArmorInfo[ iTeam ][ iArmorInfo ] ); } }
}
public plugin_precache( ) { precache_generic(tlaimejo) precache_generic(ctlaimejo) precache_generic(roundpradzia) new iEnt = create_entity( "info_map_parameters" ); DispatchKeyValue( iEnt, "buying", "3" ); DispatchSpawn( iEnt ); iEnt = create_entity( "hostage_entity" ); entity_set_origin( iEnt, Float:{ 0.0, 0.0, -55000.0 } ); entity_set_size( iEnt, Float:{ -1.0, -1.0, -1.0 }, Float:{ 1.0, 1.0, 1.0 } ); DispatchSpawn( iEnt ); 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 i = 0; i < sizeof szEntities; i++ ) { TrieSetCell( g_tEntities, szEntities[ i ], i ); } g_pRemoveDoors = register_cvar( "hns_removedoors", "0" ); g_pRemoveBreakables = register_cvar( "hns_removebreakables", "0" ); g_iRegisterSpawn = register_forward( FM_Spawn, "FwdSpawnPost", 1 ); }
public Message_StatusIcon(iMsgId, iMsgDest, id) { static szIcon[8]; get_msg_arg_string(2, szIcon, charsmax(szIcon)); if( equal(szIcon, "buyzone") ) { if( get_msg_arg_int(1) ) { set_pdata_int(id, 235, get_pdata_int(id, 235) & ~(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_block( get_user_msgid( "HostagePos" ), BLOCK_SET ); register_message( g_iMsgScreenFade, "MsgScreenFade" ); register_message( get_user_msgid( "TextMsg" ), "MsgTextMsg" ); register_message(get_user_msgid("StatusIcon"), "Message_StatusIcon"); RegisterHam( Ham_Spawn, "player", "FwdPlayerSpawnPost", 1 ); RegisterHam( Ham_Killed, "player", "FwdPlayerKilled" ); RegisterHam( Ham_Touch, "weaponbox", "FwdTouchWeapon" ); RegisterHam( Ham_Item_Deploy, "weapon_knife", "FwdKnifeDeployPost", 1 ); RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_knife", "FwdKnifePrimaryAttack" ); RegisterHam( Ham_Weapon_SecondaryAttack, "weapon_knife", "FwdKnifeSecondaryAttack" ); RegisterHam(Ham_TakeDamage, "player", "Player_TakeDamage", 1) unregister_forward( FM_Spawn, g_iRegisterSpawn, 1 ); register_forward( FM_GetGameDescription, "FwdGameDescription" ); register_forward( FM_ClientKill, "FwdClientKill" ); register_forward( FM_AddToFullPack, "FwdAddToFullPack", 1 ); register_forward(FM_SetModel, "fwdSetModel", 1) server_cmd( "sv_restart 1" ); RegisterCvars( ); g_iMaxPlayers = get_maxplayers( ); } public client_connect(id) { } public plugin_end( ) { TrieDestroy( g_tEntities ); }
public EventNewRound() { CacheCvars( ); remove_task( TASK_TIMER ); new szColor[ 20 ], szRed[ 4 ], szGreen[ 4 ], szBlue[ 4 ], szAlpha[ 4 ]; get_pcvar_string( g_pFadeColor, szColor, 19 ); parse( szColor, szRed, 4, szGreen, 4, szBlue, 4, szAlpha, 4 ); g_iFadeColor[ 0 ] = str_to_num( szRed ); g_iFadeColor[ 1 ] = str_to_num( szGreen ); g_iFadeColor[ 2 ] = str_to_num( szBlue ); g_iFadeColor[ 3 ] = str_to_num( szAlpha ); g_bNoFlash = bool:get_pcvar_num( g_pNoFlash ); g_bNoSlowDown = bool:get_pcvar_num( g_pNoSlowDown ); g_bTimerSounds = bool:get_pcvar_num( g_pSound ); g_iSlash = get_pcvar_num( g_pSlash ); g_iHiderSurviveFrags = get_pcvar_num( pCvar_HiderSurviveFrags ); if( GetPlayers( ) ) { g_bStarted = true; g_iTimer = get_pcvar_num( g_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_hudmessage( 50, 150, 220, -1.0, 0.75, 1, 0.0, 5.0, 0.1, 0.1, 1 ); show_hudmessage( 0, "%L ", LANG_PLAYER, "CT_NUGALEJO" ); } else if( g_iRoundsLost >= get_pcvar_num( g_pSwitch ) > 0 ) { SwapTeams( ); g_bAllowSlash = false; g_iRoundsLost = 0; } else { client_cmd(0, "spk ^"%s^"", tlaimejo) set_hudmessage( 150, 5, 5, -1.0, 0.75, 1, 0.0, 5.0, 0.1, 0.2, 1 ); show_hudmessage( 0, "%L", LANG_PLAYER, "T_NUGALEJO" ); } if( g_iHiderSurviveFrags ) { static i, iFrags; for( i = 1; i <= g_iMaxPlayers; i++ ) { if( is_user_alive( i ) && cs_get_user_team( i ) == CS_TEAM_T ) { iFrags = get_user_frags( i ) + g_iHiderSurviveFrags; set_user_frags( i, iFrags ); UTIL_ScoreInfo( i, iFrags, cs_get_user_deaths( i ), CS_TEAM_T ); client_print( i,print_chat, "You earned %i frag%s for surviving the round!", g_iHiderSurviveFrags, g_iHiderSurviveFrags == 1 ? "" : "s" ); } } } return PLUGIN_CONTINUE; }
public MsgScreenFade( iId, iDest, iClient ) { if( get_msg_arg_int( 4 ) == 255 && get_msg_arg_int( 5 ) == 255 && get_msg_arg_int( 6 ) == 255 ) { switch( cs_get_user_team( iClient ) ) { case CS_TEAM_T: { if( g_bNoFlash ) { return PLUGIN_HANDLED; } } case CS_TEAM_CT: { if( g_iTimer > 0 ) { return PLUGIN_HANDLED; } } } } return PLUGIN_CONTINUE; }
public MsgTextMsg( ) { static szMsg[ 32 ]; get_msg_arg_string( 2, szMsg, 31 ); switch( szMsg[ 1 ] ) { case 'C', 'T', 'H': { return PLUGIN_HANDLED; } } return PLUGIN_CONTINUE; }
public client_PreThink( iClient ) { if( g_bNoSlowDown && is_user_alive( iClient ) ) { entity_set_float( iClient, EV_FL_fuser2, 0.0 ); } if( g_iEnable ) { static iLastThink, i; if( iClient < iLastThink ) { for( i = 1; i <= g_iMaxPlayers; i++ ) { if( is_user_alive( i ) ) { g_iSemiclipTeam[ i ] = cs_get_user_team( i ); g_bSemiclipSolid[ i ] = bool:( entity_get_int( i, EV_INT_solid ) == SOLID_SLIDEBOX ); } else { g_bSemiclipSolid[ i ] = false; } } } iLastThink = iClient; if( g_bSemiclipSolid[ iClient ] ) { for( i = 1; i <= g_iMaxPlayers; i++ ) { if( i != iClient && g_bSemiclipSolid[ i ] && !g_bSemiclipRestore[ i ] && ( g_iSemiclipTeam[ iClient ] == g_iSemiclipTeam[ i ] || g_iEnable == 2 ) ) { entity_set_int( i, EV_INT_solid, SOLID_NOT ); g_bSemiclipRestore[ i ] = true; } } } } }
public FwdPlayerSpawnPost( iClient ) { if( !is_user_alive( iClient ) ) { return HAM_IGNORED; } new CsTeams:iTeam; iTeam = cs_get_user_team( iClient ); cs_reset_user_model( iClient ); set_user_footsteps( iClient, get_pcvar_num( g_pFootSteps ) == _:iTeam ? 1 : 0 ); strip_user_weapons( iClient ); set_pdata_int( iClient, OFFSET_PRIMARYWEAPON, 0 ) give_item( iClient, "weapon_knife" ); if( iTeam == CS_TEAM_T ) { static iParams[ 2 ]; iParams[ 0 ] = _:iTeam; if( g_bWeaponsGiven ) { set_task( 0.6, "TaskGiveWeapons", iClient + TASK_ID_GIVEWEAPONS, iParams, 2 ); } } return HAM_IGNORED; }
public FwdPlayerKilled( iClient ) { switch( cs_get_user_team( iClient ) ) { case CS_TEAM_T: { if( g_bStarted ) { new iPlayers[ MAXPLAYERS ], iNum; get_players( iPlayers, iNum, "ae", "TERRORIST" ); if( iNum == 1 ) { } } } case CS_TEAM_CT: { if( g_iTimer > 0 ) { entity_set_int( iClient, EV_INT_flags, entity_get_int( iClient, EV_INT_flags ) & ~FL_FROZEN ); UTIL_ScreenFade( iClient, 0 ); } } } }
public FwdTouchWeapon( iEnt, iClient ) // pickup weap { if( ( 1 <= iClient <= g_iMaxPlayers ) && !get_pcvar_num( g_pPickup ) ) { return HAM_SUPERCEDE; } return HAM_IGNORED; }
public FwdKnifePrimaryAttack( iEnt ) { new iClient = entity_get_edict( iEnt, EV_ENT_owner ) if( !iClient ) { return HAM_IGNORED; } switch( cs_get_user_team( iClient ) ) { case CS_TEAM_T: { return HAM_SUPERCEDE; } case CS_TEAM_CT: { if( !g_bAllowSlash ) { ExecuteHamB( Ham_Weapon_SecondaryAttack, iEnt ); return HAM_SUPERCEDE; } } } return HAM_IGNORED; }
public FwdKnifeSecondaryAttack( iEnt ) { new iClient = entity_get_edict( iEnt, EV_ENT_owner ) if( !iClient ) { return HAM_IGNORED; } if( cs_get_user_team( iClient ) == CS_TEAM_T ) { return HAM_SUPERCEDE; } return HAM_IGNORED; }
public FwdKnifeDeployPost( iEnt ) { new iClient = entity_get_edict( iEnt, EV_ENT_owner ) if( !iClient ) { return HAM_IGNORED; } if( cs_get_user_team( iClient ) == CS_TEAM_T ) { // entity_set_string( iClient, EV_SZ_viewmodel, "" ); entity_set_string( iClient, EV_SZ_weaponmodel, "" ); } return HAM_IGNORED; }
public FwdGameDescription( ) { static szGameName[ 32 ]; get_pcvar_string( g_pGameName, szGameName, 31 ); if( szGameName[ 0 ] ) { forward_return( FMV_STRING, szGameName ); return FMRES_SUPERCEDE; } return FMRES_IGNORED; }
public FwdSpawnPost( iEnt ) { if( !is_valid_ent( iEnt ) ) { return FMRES_IGNORED; } static szClass[ 32 ]; entity_get_string( iEnt, EV_SZ_classname, szClass, 31 ); if( TrieKeyExists( g_tEntities, szClass ) ) { remove_entity( iEnt ); } else if( get_pcvar_num( g_pRemoveBreakables ) && equal( szClass, g_szBreakable ) && entity_get_float( iEnt, EV_FL_takedamage ) ) { remove_entity( iEnt ); } else if( get_pcvar_num( g_pRemoveDoors ) ) { if( equal( szClass, g_szDoor ) || equal( szClass, g_szDoorRotating ) ) { remove_entity( iEnt ); } } return FMRES_IGNORED; }
public FwdClientKill( id, iClient ) { if( is_user_connected(id) && is_user_alive(id) && get_pcvar_num( g_pBlockKill ) ) { console_print( id, "%L", LANG_PLAYER,"SAVIZUDYBEKONSOLE") set_hudmessage( 111, 111, 140, -1.0, 0.70, 1, 0.1, 6.1, 0.0, 0.2, 1 ) show_hudmessage( id, "%L", LANG_PLAYER, "SAVIZUDYBE") return FMRES_SUPERCEDE; } return FMRES_IGNORED; }
public TaskTimer( ) { if( g_iTimer > 0 ) { for( new i = 1; i <= g_iMaxPlayers; i++ ) { if( is_user_connected( i ) && !is_user_alive( i ) ) { continue; } if( cs_get_user_team( i ) == CS_TEAM_CT ) { entity_set_int( i, EV_INT_flags, entity_get_int( i, EV_INT_flags ) | FL_FROZEN ); UTIL_ScreenFade( i ); } if( g_bTimerSounds ) { static szSound[ 20 ]; num_to_word( g_iTimer, szSound, 19 ); client_cmd( i, "spk fvox/%s", szSound ); } } set_hudmessage( 111, 111, 140, -1.0, 0.75, 1, 1.0, 1.1, 0.0, 0.0, 1 ); show_hudmessage( 0, "%i", g_iTimer ); g_iTimer--; set_task( 1.0, "TaskTimer", TASK_TIMER ); } else { new CsTeams:iTeam; for( new i = 1; i <= g_iMaxPlayers; i++ ) { if( !is_user_alive( i ) ) { continue; } iTeam = cs_get_user_team( i ); if( iTeam == CS_TEAM_T ) { continue; } else if( iTeam == CS_TEAM_CT ) { entity_set_int( i, EV_INT_flags, entity_get_int( i, EV_INT_flags ) & ~FL_FROZEN ); UTIL_ScreenFade( i, 0 ); } static iParams[ 2 ]; iParams[ 0 ] = _:iTeam; TaskGiveWeapons( iParams, i + TASK_ID_GIVEWEAPONS ); client_cmd(0, "spk ^"%s^"", roundpradzia) g_bWeaponsGiven = true; }
if( g_iRoundsLost == g_iSlash ) { g_bAllowSlash = true; set_hudmessage( 111, 111, 111, -1.0, 0.75, 1, 0.0, 2.0, 1.0, 0.0, 1 ); show_hudmessage( 0, "%i %L", g_iSlash, LANG_PLAYER, "SLASH" ); }
set_hudmessage( 111, 111, 111, -1.0, 0.75, 1, 0.0, 4.0, 1.0, 0.0, 1 ); show_hudmessage( 0, "%L", LANG_PLAYER, "STARTAS" ); } }
public TaskGiveWeapons( iParams[ ], iTaskId ) { static CsTeams:iTeam, client; iTeam = CsTeams:iParams[ 0 ]; client = iTaskId - TASK_ID_GIVEWEAPONS; static NadeTypes:iNade, iLimit, iGiveMax, iChance, iTries, iGiven; for( iNade = NadeTypes:0; iNade < NadeTypes; iNade++ ) { iLimit = g_iNadeLimit[ iNade ]; iGiveMax = g_iNadeInfo[ iTeam ][ iNade ][ NADE_COUNT ]; iChance = g_iNadeInfo[ iTeam ][ iNade ][ NADE_CHANCE ]; iGiven = 0; for( iTries = 0; iTries < iGiveMax; iTries++ ) { if( iChance == 100 || random_num( 1, 100 ) <= iChance ) { iGiven++; } } if( iGiven ) { for( iTries = 0; iTries < iGiven; iTries++ ) { if( iTries < iLimit ) { give_item( client, g_szNadeWeaponNames[ iNade ] ); } else { cs_set_user_bpammo( client, g_iNadeIds[ iNade ], iGiven ); break; } } if( iChance != 100 ) { client_print( client,print_chat, "You received %i of %i %s%s! (%i%% chance per)",\ iGiven,\ iGiveMax,\ g_szNadeNames[ iNade ],\ iGiveMax == 1 ? "" : "s",\ iChance ); } } } cs_set_user_armor( client, g_iArmorInfo[ iTeam ][ ARMOR_VALUE ], g_iArmorInfo[ iTeam ][ ARMOR_TYPE ] ); }
SwapTeams( ) { const GROUP = 5; // at a time const Float:INTERVAL = 0.5; // delay between groups new switched, data[ 1 ]; for( new i = 1; i <= g_iMaxPlayers; i++ ) { if( is_user_connected( i ) ) { data[ 0 ] = get_user_team( i ); if( TEAM_TERRORIST <= data[ 0 ] <= TEAM_CT ) { data[ 0 ] = 3 - data[ 0 ]; if( switched++ < GROUP ) { TaskSwitch( data, i ); } else { set_task( INTERVAL * ( switched / GROUP ), "TaskSwitch", i, data, sizeof( data ) ); } } } } }
public TaskSwitch( data[ ], id ) { if( is_user_connected( id ) ) { cs_set_team( id, data[ 0 ] ); } }
UTIL_ScreenFade( const iClient, iFade = 1 ) { message_begin( MSG_ONE, g_iMsgScreenFade, _, iClient ) write_short( 7500 * iFade ); write_short( 7500 * iFade ); write_short( 0x0000 ); write_byte( g_iFadeColor[ 0 ] ); write_byte( g_iFadeColor[ 1 ] ); write_byte( g_iFadeColor[ 2 ] ); write_byte( g_iFadeColor[ 3 ] ); message_end(); }
bool:TerroristAlive( ) { for( new i = 1; i <= g_iMaxPlayers; i++ ) { if( is_user_alive( i ) && cs_get_user_team( i ) == CS_TEAM_T ) { return true; } } return false; }
bool:GetPlayers( ) { new iTerrorists, iCTs; for( new i = 1; i <= g_iMaxPlayers; i++ ) { if( !is_user_connected( i ) ) { continue; } switch( cs_get_user_team( i ) ) { case CS_TEAM_T: { iTerrorists++; } case CS_TEAM_CT: { iCTs++; } } if( iTerrorists && iCTs ) { return true; } } return false; }
public client_PostThink( client ) { static i; for( i = 1; i <= g_iMaxPlayers; i++ ) { if( g_bSemiclipRestore[ i ] ) { entity_set_int( i, EV_INT_solid, SOLID_SLIDEBOX ); g_bSemiclipRestore[ i ] = false; } } }
public FwdAddToFullPack( es, e, iEntity, iHost, iHostFlags, iPlayer, pSet ) { if( iPlayer && g_iEnable ) { if( ( g_iEnable == 2 || g_iSemiclipTeam[ iHost ] == g_iSemiclipTeam[ iEntity ] ) && g_bSemiclipSolid[ iHost ] && g_bSemiclipSolid[ iEntity ] ) { set_es( es, ES_Solid, SOLID_NOT ); if( 0.0 <= g_fAlphaPercent < 100.0 && g_iSemiclipTeam[ iHost ] == g_iSemiclipTeam[ iEntity ] ) { set_es( es, ES_RenderMode, kRenderTransAlpha ); set_es( es, ES_RenderAmt, 255.0 * g_fAlphaPercent / 100.0 ); } } } } public Player_TakeDamage(id) { if( get_pcvar_num(g_pCvarPainShockFree) ) { set_pdata_float(id, fPainShock, 1.0, 5) } } UTIL_ScoreInfo( const client, const iFrags, const iDeaths, const CsTeams:iTeam ) { message_begin( MSG_BROADCAST, g_iMsgId_ScoreInfo ); write_byte( client ); write_short( iFrags ); write_short( iDeaths ); write_short( 0 ); write_short( _:iTeam ); message_end( ); }
Last edited by kileedyg; 05-10-2012 at 10:12.
|
|