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
|
untyped
global function AddWeaponXP
void function AddWeaponXP( entity player, int amount )
{
entity activeWeapon = player.GetActiveWeapon()
string weaponClassname = activeWeapon.GetWeaponClassName()
int oldLevel = WeaponGetLevel( player, weaponClassname )
// increment xp
player.SetPersistentVar( GetItemPersistenceStruct( weaponClassname ) + ".weaponXP", min( WeaponGetXP( player, weaponClassname ) + amount, WeaponGetMaxXP( weaponClassname ) ) )
// level up notif
if ( WeaponGetLevel( player, weaponClassname ) != oldLevel )
{
Remote_CallFunction_NonReplay( player, "ServerCallback_WeaponLeveledUp", shWeaponXP.weaponClassNames.find( weaponClassname ), WeaponGetGen( player, weaponClassname ), WeaponGetLevel( player, weaponClassname ) )
AddPlayerScore( player, "WeaponLevelUp" )
}
// proscreen
if ( player == activeWeapon.GetProScreenOwner() )
{
player.SetPersistentVar( GetItemPersistenceStruct( weaponClassname ) + ".proScreenKills", WeaponGetProScreenKills( player, weaponClassname ) + amount )
// not currently used rn, but adding a script var so scripts can handle proscreen values manually if wanted
if ( !( "manualProscreenControl" in activeWeapon.s && activeWeapon.s.manualProscreenControl ) )
activeWeapon.SetProScreenIntValForIndex( 0, WeaponGetProScreenKills( player, weaponClassname ) )
}
}
|