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. | //Bf2 Rank Mod hamsandwich File
//Contains all the Ham Sandwich functions.
#if defined bf2_ham_included
#endinput
#endif
#define bf2_ham_included
//Called on task from client_putinserver
public RegisterHam_CZBot(id)
{
// Thx to Avalanche and GunGame for which this method is based on.
if ( gCZBotRegisterHam || !is_user_connected(id) ) return;
// Make sure it's a bot and if quota greater than 0 it's a cz bot.
if ( gPcvarBotQuota && get_pcvar_num(gPcvarBotQuota) > 0 && is_user_bot(id) ) {
// Post-spawn fix for cz bots, since RegisterHam does not work for them.
RegisterHamFromEntity(Ham_Spawn, id, "Ham_Spawn_Post", 1);
RegisterHamFromEntity(Ham_TakeDamage, id, "Ham_TakeDamage_Pre");
gCZBotRegisterHam = true;
// Incase this CZ bot was spawned alive during a round, call the Ham_Spawn
// because it would have happened before the RegisterHam.
if ( is_user_alive(id) ) Ham_Spawn_Post(id);
}
}
public Ham_Spawn_Post(id)
{
if ( !get_pcvar_num(gPcvarBF2Active) ) return HAM_IGNORED;
// Verify the client is not just put in server but is alive
if ( !is_user_alive(id) ) return HAM_IGNORED;
// Make sure this is not a bot creation before it spawns
if ( cs_get_user_team(id) == CS_TEAM_UNASSIGNED ) return HAM_IGNORED;
check_level(id);
// Task is needed because sometimes when survived round StatusText gets cleared on spawn
if(!task_exists(id+TASK_HUD))
{
set_task(0.1, "DisplayHUD", id+TASK_HUD, _, _, "b");
}
if ( !get_pcvar_num(gPcvarBadgesActive) || !get_pcvar_num(gPcvarBadgePowers) ) return HAM_IGNORED;
new assaultlevel = g_PlayerBadges[id][BADGE_ASSAULT];
if ( assaultlevel )
{
new hp;
hp = 100 + (assaultlevel*10);
set_user_health(id, hp);
}
set_invis(id);
set_task(0.5, "give_userweapon", id);
set_task(0.6, "set_speed", id);
gPlayerMedkitUsed[id]=false;
return HAM_IGNORED;
}
public Ham_TakeDamage_Pre(victim, inflictor, attacker, Float:damage, damagebits)
{
if(!is_user_alive(victim) || !is_user_connected(victim) || !is_user_connected(attacker) || get_user_team(victim) == get_user_team(attacker))
return HAM_IGNORED;
new expBadgeLevel = g_PlayerBadges[attacker][BADGE_EXPLOSIVES];
new supBadgeLevel = g_PlayerBadges[attacker][BADGE_SUPPORT];
new dmgBadgeLevel = g_PlayerBadges[attacker][BADGE_DMG];
if ( expBadgeLevel && (damagebits & DMG_GRENADE) ) //Explosives badge, nade dmg
{
//multiply .2 nade damage per level
damage += damage * expBadgeLevel * 0.15;
}
if ( supBadgeLevel && inflictor == attacker && get_user_weapon(attacker) == CSW_M249 ) //Support badge, bonus damg
{
//add to 2 m249 damage per level
damage += supBadgeLevel * 2.0;
}
damage += dmgBadgeLevel * 2.0;
SetHamParamFloat(4, damage);
return HAM_HANDLED;
}
public Ham_Death_Player(id)
{
if(!is_user_connected(id))
return HAM_IGNORED;
RemoveHUD(id)
return HAM_IGNORED;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/
|