// ---------------------------------------------------------------------------
// StatsMe 2.8.3 Config Pack [16 June, 2004]
// ---------------------------------------------------------------------------
// This file is part of StatsMe (See README for more information).
// Copyright 2002 - 2004 UnitedAdmins (www.unitedadmins.com)
// Project originally created by OLO (http://olo.counter-strike.pl)
// ---------------------------------------------------------------------------
// Please read the manual and the forums carefully before altering this file!
// The Manual is located at http://docs.unitedadmins.com/statsme/
// The Forum can be found at http://forums.unitedadmins.com/
// ---------------------------------------------------------------------------
// Limit AWP

sm_mode3 set i

localinfo mawp 1 // set max. number of awps in one team
localinfo mact "drop" // you can set "drop" instead "weapon_knife"

sm_menu "Limit AWP (needs changelevel)\y\R{sm_mode3&i?ON:OFF}" "sm_mode3 {sm_mode3&i?remove:set{%.awpC=0}{%.awpT=0}} i"

// Reset some values
sm_reg "SM_MapStart i 3" "{%.awpC=0}{%.awpT=0}" ade

// We have lost our AWP
sm_reg "DeathMsg i 3" "{%.awp{v.id}?:#}{%.awp{v.team=CT?C:T}-1}{%.awp{v.id}=0}" ade
sm_reg "SM_Disconnect i 3" "{%.awp{p.id}?:#}{%.awp{p.team=CT?C:T}-1}{%.awp{p.id}=0}" bde

// Give warning if player can't buy more awp
sm_reg "ShowMenu i 3" "{%.awp{p.team=CT?C:T}<{I.mawp}?#}sm_tell2 #{p.uid} \'[SM] WARNING: AWP purchasing is limited, you cannot buy an AWP.\' 3" bde "4&BuyRifle"

// We have bought or picked up the AWP
sm_reg "WeapPickup i 3" "{%.awp{p.id}?#}{%.awp{p.team=CT?C:T}+1}{%.awp{p.id}=1}" bde "1=18"

// AWP in hands
sm_reg "CurWeapon i 3" "{%.awph{p.id}=1}{%.awp{p.team=CT?C:T}>{I.mawp}?:#}sm_clexec2 #{p.uid} {I.mact};sm_tell2 #{p.uid} \'[SM] Your team can't use any more AWPs.\' 3" bcde "1=1" "2=18"

// Check if we have lost our awp or just switched to another weapon
sm_reg "CurWeapon i 3" "{%.awph{p.id}=0}" bcde "1=0" "2=18"
sm_alias "drop" "{%.awph{p.id}?:#}{%.awp{p.id}=0}{%.awp{p.team=CT?C:T}-1}" ac

// Report about AWPs in teams
sm_alias "/awp" "sm_tell2 #{p.uid} \'[SM] {p.team}s have {%.awp{p.team=CT?C:T}?{w.{%.awp{p.team=CT?C:T}}} awp:no awp}{%.awp{p.team=CT?C:T}!1?s}\' 3" b