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
|
global function RiffInstagib_Init
#if SERVER
struct {
table<entity, int> playerWeapons
array<string> instagibWeapons
} file
#endif
void function RiffInstagib_Init()
{
AddPrivateMatchModeSettingEnum( "#MODE_SETTING_CATEGORY_RIFF", "riff_instagib", [ "#SETTING_DISABLED", "#SETTING_ENABLED" ], "0" )
#if SERVER
if ( GetCurrentPlaylistVarInt( "riff_instagib", 0 ) == 0 )
return
SetLoadoutGracePeriodEnabled( false )
SetWeaponDropsEnabled( false )
file.instagibWeapons = [
"mp_weapon_sniper",
"mp_weapon_wingman",
"mp_weapon_defender",
"mp_weapon_arena3",
"mp_weapon_wingman_n",
"mp_weapon_doubletake",
]
file.instagibWeapons.randomize()
AddCallback_OnPlayerRespawned( InstagibSetWeapons )
AddCallback_OnPlayerKilled( InstagibCycleWeaponsForKill )
AddCallback_OnClientDisconnected( InstagibCleanupClient )
#endif
}
#if SERVER
void function InstagibSetWeapons( entity player )
{
if ( !( player in file.playerWeapons ) )
file.playerWeapons[ player ] <- 0
player.SetMaxHealth( 1 )
InstagibUpdateWeapons( player )
}
void function InstagibUpdateWeapons( entity player )
{
foreach( entity weapon in player.GetMainWeapons() )
player.TakeWeaponNow( weapon.GetWeaponClassName() )
player.TakeWeaponNow( player.GetOffhandWeapon( OFFHAND_RIGHT ).GetWeaponClassName() )
if ( !HasOffhandWeapon( player, "mp_weapon_grenade_sonar" ) )
player.GiveOffhandWeapon( "mp_weapon_grenade_sonar", OFFHAND_RIGHT )
player.GiveWeapon( file.instagibWeapons[ file.playerWeapons[ player ] ] )
}
void function InstagibCycleWeaponsForKill( entity victim, entity attacker, var damageInfo )
{
if ( !victim.IsPlayer() || !attacker.IsPlayer() || victim == attacker )
return
file.playerWeapons[ attacker ] = ( file.playerWeapons[ attacker ] + 1 ) % file.instagibWeapons.len()
InstagibUpdateWeapons( attacker )
}
void function InstagibCleanupClient( entity player )
{
if ( player in file.playerWeapons )
delete file.playerWeapons[ player ]
}
#endif
|