Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <cstrike>
- static sClim,sRstatus,sLimset,sPlus,g_iTextMsg,scLimiton,stLimiton,szSt;
- public plugin_init(){
- register_plugin("Simple AWP Limited","1.0b","Seroff");
- sClim=register_cvar("awp_lim","3");
- sRstatus=register_cvar("awp_slim","1");
- sPlus=register_cvar("awp_plim","2");
- g_iTextMsg = get_user_msgid("TextMsg");
- register_event("HLTV", "eRestart", "a", "1=0", "2=0");
- register_event("TextMsg", "eRestart", "a", "2=#Game_will_restart_in","2=#Game_Commencing");
- }
- public eRestart(){
- sLimset=get_pcvar_num(sRstatus);
- switch(sLimset){
- case 1:{
- scLimiton=3;
- stLimiton=3;
- }
- case 2:{
- scLimiton=2;
- stLimiton=2;
- szSt=1;
- }
- case 3:{
- scLimiton=get_pcvar_num(sClim)+get_pcvar_num(sPlus);
- stLimiton=get_pcvar_num(sClim)+get_pcvar_num(sPlus);
- szSt=1;
- }
- case 4:{
- scLimiton=get_pcvar_num(sClim)+get_pcvar_num(sPlus);
- stLimiton=get_pcvar_num(sClim)+get_pcvar_num(sPlus);
- }
- case 5:{
- scLimiton=get_pcvar_num(sClim)+get_pcvar_num(sPlus)/2;
- stLimiton=get_pcvar_num(sClim)+get_pcvar_num(sPlus)/2;
- }
- case 6:{
- scLimiton=get_pcvar_num(sClim)+get_pcvar_num(sPlus)/2;
- stLimiton=get_pcvar_num(sClim)+get_pcvar_num(sPlus)/2;
- szSt=1;
- }
- }
- }
- stock teamCount(szTeam){
- new Count, Players[32];
- get_players(Players, Count, "e",szTeam ? "TERRORIST":"CT");
- return Count;
- }
- public client_buy(id, i_Item){
- new CsTeams:check_team;
- check_team = cs_get_user_team(id);
- // Проверяем, что купил игрок, если это AWP и игрок не имеет AWP в наличии, то выполняем
- if (i_Item==CSW_AWP && !user_has_weapon(id, CSW_AWP)){
- switch(check_team){
- case CS_TEAM_CT:{
- if(szSt){
- if(scLimiton){
- switch(teamCount(0)){
- case 1,2,3:{
- scLimiton--;
- }
- case 4..32:{
- scLimiton=teamCount(0)-scLimiton;
- }
- }
- }
- }else{
- if(scLimiton){
- scLimiton--;
- }
- }
- }
- case CS_TEAM_T:{
- if(szSt){
- if(stLimiton){
- switch(teamCount(1)){
- case 1,2,3:{
- stLimiton--;
- }
- case 4..32:{
- stLimiton=teamCount(0)-stLimiton;
- }
- }
- }else{
- if(stLimiton){
- stLimiton--;
- }
- }
- }
- }
- }
- if(!stLimiton || !scLimiton){
- message_begin(MSG_ONE_UNRELIABLE, g_iTextMsg, .player = id)
- {
- write_byte(print_center);
- write_string("#Alias_Not_Avail");
- write_string("#ArcticWarfareMagnum");
- }
- message_end();
- // Используем PLUGIN_HANDLED для блокировки покупки
- return PLUGIN_HANDLED
- }
- }
- return PLUGIN_CONTINUE
- }
Advertisement
Add Comment
Please, Sign In to add comment