Plugin VIP CSGO Remake

Pluginuri pentru modul AmxModX.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
Shadows Adi
Membru, skill 0
Membru, skill 0
Posts: 27
Joined: 26 Jan 2020, 18:52
Detinator Steam: Da
CS Status: 0x416469
SteamID: STEAM_1:0:195136759
Fond eXtream: 0
Has thanked: 2 times
Been thanked: 1 time

01 May 2020, 12:03

Descriere: Acesta este pluginul de VIP al lui Effx, in care am adaugat doar un shop cu iteme speciale.

Descarcare:

Code: Select all

#include <amxmodx> 
#include <amxmisc>
#include <cstrike> 
#include <engine>
#include <fakemeta>
#include <hamsandwich> 
#include <nvault> 
#include <fun>

#define PLUGIN "VIP - adaugare shop csgo remake by Shadows Adi" 
#define VERSION "2.0" 
#define AUTHOR "EFFx" 

#define nvault_clear(%1) nvault_prune(%1, 0, get_systime() + 1) // Thx OciXCrom
#define LOGFILE "vip_log.log"

new const szCfgFile[] = "VIP_Config.cfg"

enum(+= 1000)
{
	TASK_HPREGEN,
	TASK_SHOWEXPERIENCE,
	TASK_SHOWVMONEY,
	TASK_GODMOD
}

static timer[33]

enum _:Weapons
{
	WeapName[200],
	WeaponID[32],
	BpAmmo
}

new const VipWeapons[][Weapons] =
{
	{ "AK47 \d+ \wDeagle \d+ \wAll Grenades", "weapon_ak47",250 },
	{ "M4A1 \d+ \wDeagle \d+ \wAll Grenades","weapon_m4a1",250 },
	{ "AWP \d+ \wDeagle \d+ \wAll Grenades", "weapon_awp",250 }
}

new bool:WeaponSelected[33]

native get_user_vip(user_id)
native set_user_vip(user_id,vip_mode)

new CVAR_color_Kill[3]

new g_iJumpCount[ 33 ]

new PcvarHPGive,PcvarAPGive,PcvarVIPMoneyKillBonus,
PcvarMaxRegenHP,PcvarHpRegenAdd,PcvarShowVMoney,
PcvarMaxExperience,PcvarPrefixChat

new VIP[33],VIPMoney[33],Experience[33]

new VIPMj[33],VIPBh[33],VIPRegen[33],VIPNoDmg[33],VIPImm[33]
new bool:g_bActived_Mj[33],bool:g_bActived_Bhop[33],bool:g_bActived_Imm[33],
bool:g_bActived_Regen[33],bool:g_bActived_NoDmg[33]

new HudsSync[6]

new maxplayers

new g_nVault 

native csgor_get_user_dusts(id)
native csgor_set_user_dusts(id, amount)
native csgor_get_user_keys(id)
native csgor_set_user_keys(id, amount)
native csgor_get_user_cases(id)
native csgor_set_user_cases(id, amount)
native csgor_set_user_skins(id, skinid, amount)
native csgor_get_user_points(id)
native csgor_set_user_points(id, amount)
native csgor_is_user_logged(id)

public plugin_init()  
{
	register_plugin(PLUGIN, VERSION, AUTHOR) 
	
	PcvarPrefixChat = register_cvar("vip_prefixchat","[EFFxVIP]")
	PcvarShowVMoney = register_cvar("vip_showmoney","1")
	PcvarHPGive = register_cvar("vip_killhpbonus","25")
	PcvarAPGive = register_cvar("vip_killapbonus","25")
	PcvarVIPMoneyKillBonus = register_cvar("vip_vipmoneybonus","15")
	PcvarMaxRegenHP = register_cvar("vip_hpregenmax","100")
	PcvarHpRegenAdd = register_cvar("vip_hpregenadd","2")
	PcvarMaxExperience= register_cvar("vip_maxexperience","12500")
	
	maxplayers = get_maxplayers()
		
	for(new i;i < sizeof HudsSync;i++)
		HudsSync[i] = CreateHudSyncObj()
	
	register_forward( FM_CmdStart, "CmdStart" )
	
	register_clcmd("say /vips","ShowVIPs")
	register_clcmd("say /vipmenu","ShowVIPMenu")
	
	register_concmd("amx_resetdata","cmdReset",ADMIN_BAN,"- Reset all vip data")
	register_concmd("amx_vip", "cmdVIP", ADMIN_KICK, "<name or @ALL> [1|0]")
	
	RegisterHam(Ham_TakeDamage, "player", "ham_Player_TakeDamage_Post", 0)
	RegisterHam(Ham_Player_PostThink, "player", "ham_Player_PostThink_Post", 1 )
	RegisterHam(Ham_Killed,"player","fw_Ham_Player_Killed",1)
	RegisterHam(Ham_Spawn,"player","fwSpawn",1) 
	
	LoadCfg()
}

LoadCfg()
{
	new text[128], fp 
	formatex(text,charsmax(text),"addons/amxmodx/configs/VIPCfgs/%s",szCfgFile)
	fp = fopen(text,"rt")
	if(!fp) 
	{
		formatex(text,charsmax(text),"Archive ^"addons/amxmodx/configs/VIPCfgs/%s^" not found",szCfgFile)
		log_to_file(LOGFILE,text)
		set_fail_state(text)
	}
	new szDir[32];
	get_localinfo("amxx_configsdir",szDir,charsmax(szDir));

	server_cmd("exec %s/VIPCfgs/%s",szDir,szCfgFile)
}

public plugin_natives()
{
	register_native("get_user_vip","_get_user_vip")
	register_native("set_user_vip","_set_user_vip")
}
public _get_user_vip(user_id)
{
	new id = get_param(1)
	if(!is_user_connected(id) || !id)
		return 0
		
	return VIP[id]
}
	
public _set_user_vip(user_id,vip_mode)
{
	new id = get_param(1)
	new MODE = get_param(2)
	
	if(!is_user_connected(id) || !id)
		return 0
		
	VIP[id] = MODE
	return 1
}

public cmdReset(id,level,cid)
{
	if (!cmd_access(id, level, cid, 1))	
		return PLUGIN_HANDLED
		
	new name[32]
	get_user_name(id, name, 31)
	
	new Buffer[85]
	get_pcvar_string(PcvarPrefixChat,Buffer,charsmax(Buffer))
	
	color_chat(0,"!g%s!y: ADMIN!t %s!y has reseted all vip data from this server!,",equal(Buffer,"0" ) ? "" : Buffer,name)
	
	new players[32],inum
	get_players(players,inum)
	for(new i = 0 ;i < inum; i++)
	{
		if(get_user_vip(players[i]) == 1)
		{
			VIPMoney[players[i]] = 0
			
			VIPBh[players[i]] = 0
			VIPMj[players[i]] = 0
			VIPImm[players[i]] = 0
			VIPNoDmg[players[i]] = 0
			VIPRegen[players[i]] = 0
			
			g_bActived_Bhop[players[i]] = false
			g_bActived_Imm[players[i]] = false
			g_bActived_Mj[players[i]] = false
			g_bActived_Regen[players[i]] = false
			g_bActived_NoDmg[players[i]] = false
		}
	}
	
	return PLUGIN_HANDLED
}

public cmdVIP(id, level, cid)
{
	if (!cmd_access(id, level, cid, 2))	
		return PLUGIN_HANDLED

	new arg[32]
	read_argv(1, arg, 31)

	new arg2[7]
	read_argv(2, arg2, 6)

	new Buffer[85]
	get_pcvar_string(PcvarPrefixChat,Buffer,charsmax(Buffer))
		
	new name2[32], name[32]
	get_user_name(id, name, 31)
	
	if(equal(arg,"@ALL"))
	{
		if(arg2[0] == '0')
		{
			new players[32],inum
			get_players(players,inum)
			for(new i = 0;i<inum;i++)
			{
				if(get_user_vip(players[i]) == 1)
				{	
					if(task_exists(players[i]+TASK_HPREGEN))
						remove_task(players[i]+TASK_HPREGEN)
							
					if(task_exists(players[i]+TASK_SHOWVMONEY))
						remove_task(players[i]+TASK_SHOWVMONEY)
							
					if(task_exists(players[i]+TASK_GODMOD))
						remove_task(players[i]+TASK_GODMOD)
					
					if(is_user_alive(players[i]))
						set_task(1.0,"ShowExperience",players[i]+TASK_SHOWEXPERIENCE,_,_,"b")
						
					VIPBh[players[i]] = 0
					VIPMj[players[i]] = 0
					VIPImm[players[i]] = 0
					VIPNoDmg[players[i]] = 0
					VIPRegen[players[i]] = 0
					
					g_bActived_Bhop[players[i]] = false
					g_bActived_Imm[players[i]] = false
					g_bActived_Mj[players[i]] = false
					g_bActived_Regen[players[i]] = false
					g_bActived_NoDmg[players[i]] = false
						
					set_user_vip(players[i],0)
					VIPMoney[players[i]] = 0
				}
			}
			color_chat(0,"!g%s!y: ADMIN!t %s!y has !gremoved!y VIP from!t All Players",equal(Buffer,"0" ) ? "" : Buffer,name)
		}
		else if(arg2[0] == '1')
		{
			new players[32],inum
			get_players(players,inum)
			for(new i = 0;i<inum;i++)
			{
				if(get_user_vip(players[i]) == 0)
				{
					if(get_pcvar_num(PcvarShowVMoney) == 1)
						if(is_user_alive(players[i]))
							set_task(1.0,"ShowVIPMoney",players[i]+TASK_SHOWVMONEY,_,_,"b")
						
					if(task_exists(players[i]+TASK_SHOWEXPERIENCE))
						remove_task(players[i]+TASK_SHOWEXPERIENCE)

					set_user_vip(players[i],1)
					Experience[players[i]] = 0
				}
			}
			color_chat(0,"!g%s!y: ADMIN!t %s!y has!g given!y VIP for!t All Players",equal(Buffer,"0" ) ? "" : Buffer,name)
		}
		else
		{
			console_print(id,"[AMXX]: Use '1' or '0' to active/deactive the VIP from player!")
			return PLUGIN_HANDLED
		}
	}
	else
	{
		new player = cmd_target(id, arg, CMDTARGET_NO_BOTS)
		
		if (!player)
			return PLUGIN_HANDLED
			
		get_user_name(player, name2, 31)
		
		if(arg2[0] == '0')
		{
			if(get_user_vip(player) == 1)
			{
				color_chat(0,"!g%s!y: ADMIN!t %s!y has !gremoved!y VIP from!t %s",equal(Buffer,"0" ) ? "" : Buffer,name,name2)
					
				if(task_exists(player+TASK_HPREGEN))
					remove_task(player+TASK_HPREGEN)
						
				if(task_exists(player+TASK_SHOWVMONEY))
					remove_task(player+TASK_SHOWVMONEY)
						
				if(task_exists(player+TASK_GODMOD))
					remove_task(player+TASK_GODMOD)
					
				if(is_user_alive(player))
					set_task(1.0,"ShowExperience",player+TASK_SHOWEXPERIENCE,_,_,"b")
				
				if(get_user_team(player) == 1)
					cs_set_user_model(player,"guerilla")
						
				if(get_user_team(player) == 2)
					cs_set_user_model(player,"gign")
				
				VIPBh[player] = 0
				VIPMj[player] = 0
				VIPImm[player] = 0
				VIPNoDmg[player] = 0
				VIPRegen[player] = 0
				
				g_bActived_Bhop[player] = false
				g_bActived_Imm[player] = false
				g_bActived_Mj[player] = false
				g_bActived_Regen[player] = false
				g_bActived_NoDmg[player] = false
					
				set_user_vip(player,0)
				VIPMoney[player] = 0
			}
			else
				console_print(id,"[AMXX]: This player already have not VIP!")
		}
		else if(arg2[0] == '1')
		{
			if(get_user_vip(player) == 0)
			{
				color_chat(0,"!g%s!y: ADMIN!t %s!y has!g given!y VIP for!t %s",equal(Buffer,"0" ) ? "" : Buffer,name,name2)
				
				if(get_pcvar_num(PcvarShowVMoney) == 1)
					if(is_user_alive(player))
						set_task(1.0,"ShowVIPMoney",player+TASK_SHOWVMONEY,_,_,"b")
					
				if(task_exists(player+TASK_SHOWEXPERIENCE))
					remove_task(player+TASK_SHOWEXPERIENCE)

				set_user_vip(player,1)
				Experience[player] = 0
			}
			else
				console_print(id,"[AMXX]: This player already have VIP!")
		}
		else
		{
			console_print(id,"[AMXX]: Use '1' or '0' to active/deactive the VIP from player!")
			return PLUGIN_HANDLED
		}
	}
	return PLUGIN_HANDLED
}
public client_putinserver(id) 
{ 
	if(is_user_bot(id))
		return
		
	set_task( 0.2 , "HUD" , id + 672 );
		
	LoadVIP(id) 
	if(get_user_vip(id) == 1)
	{
		if(get_pcvar_num(PcvarShowVMoney) == 1)
			set_task(1.0,"ShowVIPMoney",id+TASK_SHOWVMONEY,_,_,"b")
			
		set_task(3.0,"HelloVIP",id+200210)
	}
} 
public HelloVIP(id)
{
	id -= 200210
	
	new szName[32]
	get_user_name(id,szName,31)
	set_hudmessage(0,100,255,0.15,0.35,2,1.0,5.0)
	ShowSyncHudMsg(id,HudsSync[4],"Hello %s, how are you today?^nType /vipmenu for show your menu!",szName)

	client_cmd(id,"spk ^"scientist/hellothere letsgo^"")
}
public client_disconnect(id) 
{ 
	SaveVIP(id) 
} 

public ShowVIPs(user)
{
	new adminnames[33][32]
	new message[256]
	new id, count, x, len
	
	for(id = 1 ; id <= maxplayers ; id++)
		if(is_user_connected(id))
			if(get_user_vip(id) == 1)
				get_user_name(id, adminnames[count++], 31)

	len = format(message, 255, "^x04---------------------------")
	len = format(message, 255, "^x04 VIP's ONLINE:^x01 ")
	if(count > 0) 
	{
		for(x = 0 ; x < count ; x++) 
		{
			len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count-1) ? ",":"")
			if(len > 96 ) 
			{
				color_chat(user, message)
			}
		}
	}
	else 
	{
		len += format(message[len], 255-len, "NO VIP's")
		color_chat(user, message)
	}
	len = format(message, 255, "^x04---------------------------")
}
public ShowVIPMoney(id)
{
	id -= TASK_SHOWVMONEY
	
	if(is_user_alive(id))
	{
		set_hudmessage(0,200,0,0.83,0.80,0,1.0,1.0)
		ShowSyncHudMsg(id,HudsSync[0],"VIPMoney: %d",VIPMoney[id])
	}
	else
		remove_task(id+TASK_SHOWVMONEY)
}
public ShowExperience(id)
{
	id -= TASK_SHOWEXPERIENCE
	
	if(is_user_alive(id))
	{
		set_hudmessage(0,200,0,0.83,0.80,0,1.0,1.0)
		ShowSyncHudMsg(id,HudsSync[2],"Experience: %d / %d",Experience[id],get_pcvar_num(PcvarMaxExperience))
	}
	else
		remove_task(id+TASK_SHOWVMONEY)
}
public ShowVIPMenu(id)
{
	new Buffer[85]
	get_pcvar_string(PcvarPrefixChat,Buffer,charsmax(Buffer))
	
	if(get_user_vip(id) == 1)
	{
		new szMenu = menu_create("VIP Menu^n\d- Choose what you want do!","vip_menu_handler")
		menu_additem(szMenu,"Weapons^n\d- Your first weapons!")
		menu_additem(szMenu,"\rSpecial Items^n\d- Amazing items for you!")
		menu_additem(szMenu, "\rSpecial Shop^n\d- Amazing offers for you!")
		
		menu_display(id,szMenu)
	}
	else
	{
		color_chat(id,"!g%s!y: You cant access this menu!",equal(Buffer,"0" ) ? "" : Buffer)
	}
	return PLUGIN_HANDLED
}
public vip_menu_handler(id,menu,item)
{
	if(item == MENU_EXIT || !is_user_alive(id) || get_user_vip(id) == 0)
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	new Buffer[85]
	get_pcvar_string(PcvarPrefixChat,Buffer,charsmax(Buffer))
	switch(item)
	{
		case 0:
		{
			if(!WeaponSelected[id])
			{
				VipWeaponsMenu(id)
			}
			else
			{
				color_chat(id,"!g%s!y: You already have selected your equipament!",equal(Buffer,"0" ) ? "" : Buffer)
				ShowVIPMenu(id)
			}
		}
		case 1:
		{
			VipItemsMenu(id)
		}
		case 2: 
		{
			VipSpecialMenu(id)
		}
	}
	return PLUGIN_HANDLED
}
public VipWeaponsMenu(id)
{
	new szMenuW = menu_create("Choose your weapon:","vip_weapons_handler")
	
	for ( new i; i < sizeof VipWeapons; i++ )
		menu_additem( szMenuW, VipWeapons[ i ][ WeapName ] )
		
	menu_display(id,szMenuW)
}
public vip_weapons_handler(id,menu,item)
{
	if(item == MENU_EXIT || !is_user_alive(id) || get_user_vip(id) == 0)
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	strip_user_weapons(id)
		
	give_item(id,"weapon_knife")
		
	give_item(id,"weapon_hegrenade")
	give_item(id,"weapon_flashbang")
	give_item(id,"weapon_smokegrenade")
		
	cs_set_user_bpammo(id, CSW_FLASHBANG, 2)
		
	WeaponSelected[id] = true
		
	give_item( id, VipWeapons[ item ][ WeaponID ] )
	cs_set_user_bpammo( id, get_weaponid( VipWeapons[ item ][ WeaponID ] ), VipWeapons[ item ][ BpAmmo ] )
		
	give_item(id,"weapon_deagle")
	cs_set_user_bpammo(id,CSW_DEAGLE,250)
	
	ShowVIPMenu(id)
	return PLUGIN_HANDLED
}
public VipItemsMenu(id)
{
	new szTittle = menu_create("VIP Items Menu^n\d- Your items will be permenently.","vip_items_handler")
		
	if(VIPMj[id] == 0)
		menu_additem(szTittle,"Multi-Jump \r500VM^n\d- Add for you 2 more jumps!")
			
	else
		menu_additem(szTittle,!g_bActived_Mj[id] ? "Multi-Jump \r[OFF]^n\d- Add for you 2 more jumps!" 
		: "Multi-Jump \y[ON]^n\d- Add for you 2 more jumps!")
			
	if(VIPRegen[id] == 0)
		menu_additem(szTittle,"HP Regenerate \r800VM^n\d- Add 2HP per second.")
			
	else
		menu_additem(szTittle,!g_bActived_Regen[id] ? "HP Regenerate \r[OFF]^n\d- Add 2HP per second." : 
		"HP Regenerate \y[ON]^n\d- Add 2HP per second.")
			
	if(VIPImm[id] == 0)
		menu_additem(szTittle,"Immobilize \r1100VM^n\d- Chance for immobilize with a shot!")
			
	else
		menu_additem(szTittle,!g_bActived_Imm[id] ? "Immobilize \r[OFF]^n\d- Chance for immobilize with a shot!" : 
		"Immobilize \y[ON]^n\d- Chance for immobilize with a shot!")
			
	if(VIPBh[id] == 0)
		menu_additem(szTittle,"BunnyHop \r1500VM^n\d- Add for you automatic bhop!")
			
	else
		menu_additem(szTittle,!g_bActived_Bhop[id] ? "BunnyHop \r[OFF]^n\d- Add for you automatic bhop!" : 
		"BunnyHop \y[ON]^n\d- Add for you automatic bhop!")
			
	if(VIPNoDmg[id] == 0)
		menu_additem(szTittle,"No Damage \r2000VM^n\d- You dont lose hp per 15 seconds!")
			
	else
		menu_additem(szTittle,!g_bActived_NoDmg[id] ? "No Damage \r[OFF]^n\d- You dont lose hp per 15 seconds!" : 
		"No Damage \y[ON]^n\d- You dont lose hp per 15 seconds!")
		
	menu_additem(szTittle,"Back")
			
	menu_display(id,szTittle)
			
}
public vip_items_handler(id,menu,item)
{
	if(item == MENU_EXIT || !is_user_alive(id) || get_user_vip(id) == 0)
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	new Buffer[85]
	get_pcvar_string(PcvarPrefixChat,Buffer,charsmax(Buffer))
	switch(item)
	{
		case 0:
		{
			if(VIPMj[id] == 0)
			{
				if(VIPMoney[id] >= 500)
				{
					VIPMj[id] = 1
					VIPMoney[id] -= 500
					color_chat(id,"!g%s!y: You've buyed !gMulti Jump!",equal(Buffer,"0" ) ? "" : Buffer)
					
					client_cmd(id,"spk items/gunpickup2.wav")
					
					VipItemsMenu(id)
				}
				else
				{
					color_chat(id,"!g%s!y: You haven't sufficient VIPMoney. Need more!g %d!y for buy.",equal(Buffer,"0" ) ? "" : Buffer,500 - VIPMoney[id])
					VipItemsMenu(id)
				}
			}
			else
			{
				if(!g_bActived_NoDmg[id])
				{
					if(!g_bActived_Mj[id])
					{
						g_bActived_Mj[id] = true
						
						if(task_exists(id+TASK_GODMOD))
							remove_task(id+TASK_GODMOD)
							
						if(task_exists(id+TASK_HPREGEN))
							remove_task(id+TASK_HPREGEN)
						
						g_bActived_Bhop[id] = false
						g_bActived_Imm[id] = false
						g_bActived_Regen[id] = false
						VipItemsMenu(id)
					}
					else
					{
						g_bActived_Mj[id] = false
						VipItemsMenu(id)
					}
				}
				else
				{
					color_chat(id,"!g%s!y: You cant use this item now. Wait your No Damage finish!",equal(Buffer,"0" ) ? "" : Buffer)
					VipItemsMenu(id)
				}
			}
		}
		case 1:
		{
			if(VIPRegen[id] == 0)
			{
				if(VIPMoney[id] >= 800)
				{
					VIPRegen[id] = 1
					VIPMoney[id] -= 800
					
					client_cmd(id,"spk items/gunpickup2.wav")
					
					color_chat(id,"!g%s!y: You've buyed !gHP Regenerate!",equal(Buffer,"0" ) ? "" : Buffer)
					VipItemsMenu(id)
				}
				else
				{
					color_chat(id,"!g%s!y: You haven't sufficient VIPMoney. Need more!g %d!y for buy.",equal(Buffer,"0" ) ? "" : Buffer,800 - VIPMoney[id])
					VipItemsMenu(id)
				}
			}
			else
			{
				if(!g_bActived_NoDmg[id])
				{
					if(!g_bActived_Regen[id])
					{
						g_bActived_Regen[id] = true
						
						g_bActived_Bhop[id] = false
						g_bActived_Imm[id] = false
						g_bActived_Mj[id] = false
						
						if(task_exists(id+TASK_GODMOD))
							remove_task(id+TASK_GODMOD)
						
						set_task(1.0,"HPRegen",id+TASK_HPREGEN,_,_,"b")
						VipItemsMenu(id)
					}
					else
					{
						g_bActived_Regen[id] = false
						VipItemsMenu(id)
					}
				}
				else
				{
					color_chat(id,"!g%s!y: You cant use this item now. Wait your No Damage finish!",equal(Buffer,"0" ) ? "" : Buffer)
					VipItemsMenu(id)
				}
			}
		}
		case 2:
		{
			if(VIPImm[id] == 0)
			{
				if(VIPMoney[id] >= 1100)
				{
					VIPImm[id] = 1
					VIPMoney[id] -= 1100
					
					client_cmd(id,"spk items/gunpickup2.wav")
					
					color_chat(id,"!g%s!y: You've buyed !gImmobilize!",equal(Buffer,"0" ) ? "" : Buffer)
					VipItemsMenu(id)
				}
				else
				{
					color_chat(id,"!g%s!y: You haven't sufficient VIPMoney. Need more!g %d!y for buy.",equal(Buffer,"0" ) ? "" : Buffer,1100 - VIPMoney[id])
					VipItemsMenu(id)
				}
			}
			else
			{
				if(!g_bActived_NoDmg[id])
				{
					if(!g_bActived_Imm[id])
					{
						g_bActived_Imm[id] = true
						
						if(task_exists(id+TASK_GODMOD))
							remove_task(id+TASK_GODMOD)
							
						if(task_exists(id+TASK_HPREGEN))
							remove_task(id+TASK_HPREGEN)
						
						g_bActived_Bhop[id] = false
						g_bActived_Mj[id] = false
						g_bActived_Regen[id] = false
	
						VipItemsMenu(id)
					}
					else
					{
						g_bActived_Imm[id] = false
						VipItemsMenu(id)
					}
				}
				else
				{
					color_chat(id,"!g%s!y: You cant use this item now. Wait your No Damage finish!",equal(Buffer,"0" ) ? "" : Buffer)
					VipItemsMenu(id)
				}
			}
		}
		case 3:
		{
			if(VIPBh[id] == 0)
			{
				if(VIPMoney[id] >= 1500)
				{
					VIPBh[id] = 1
					VIPMoney[id] -= 1500
					color_chat(id,"!g%s!y: You've buyed !gBunnyHop!",equal(Buffer,"0" ) ? "" : Buffer)
					
					client_cmd(id,"spk items/gunpickup2.wav")
					
					VipItemsMenu(id)
				}
				else
				{
					color_chat(id,"!g%s!y: You haven't sufficient VIPMoney. Need more!g %d!y for buy.",equal(Buffer,"0" ) ? "" : Buffer,1500 - VIPMoney[id])
					VipItemsMenu(id)
				}
			}
			else
			{
				if(!g_bActived_NoDmg[id])
				{
					if(!g_bActived_Bhop[id])
					{
						g_bActived_Bhop[id] = true
						
						if(task_exists(id+TASK_GODMOD))
							remove_task(id+TASK_GODMOD)
							
						if(task_exists(id+TASK_HPREGEN))
							remove_task(id+TASK_HPREGEN)
						
						g_bActived_Imm[id] = false
						g_bActived_Mj[id] = false
						g_bActived_Regen[id] = false
						VipItemsMenu(id)
					}
					else
					{
						g_bActived_Bhop[id] = false
						VipItemsMenu(id)
					}
				}
				else
				{
					color_chat(id,"!g%s!y: You cant use this item now. Wait your No Damage finish!",equal(Buffer,"0" ) ? "" : Buffer)
					VipItemsMenu(id)
				}
			}
		}
		case 4:
		{
			if(VIPNoDmg[id] == 0)
			{
				if(VIPMoney[id] >= 2000)
				{
					VIPNoDmg[id] = 1
					VIPMoney[id] -= 2000
					color_chat(id,"!g%s!y: You've buyed !gNo Damage!",equal(Buffer,"0" ) ? "" : Buffer)
					
					client_cmd(id,"spk items/gunpickup2.wav")
					
					set_pev(id,pev_takedamage,DAMAGE_NO)
					set_task(1.0,"GodMod_CountDown",id+TASK_GODMOD,_,_,"a",15)
					
					VipItemsMenu(id)
				}
				else
				{
					color_chat(id,"!g%s!y: You haven't sufficient VIPMoney. Need more!g %d!y for buy.",equal(Buffer,"0" ) ? "" : Buffer,2000 - VIPMoney[id])
					VipItemsMenu(id)
				}
			}
			else
			{
				if(!g_bActived_NoDmg[id])
				{
					g_bActived_NoDmg[id] = true
					
					if(task_exists(id+TASK_GODMOD))
						remove_task(id+TASK_GODMOD)
						
					if(task_exists(id+TASK_HPREGEN))
						remove_task(id+TASK_HPREGEN)
					
					g_bActived_Bhop[id] = false
					g_bActived_Imm[id] = false
					g_bActived_Mj[id] = false
					g_bActived_Regen[id] = false
					
					set_pev(id,pev_takedamage,DAMAGE_NO)
					set_task(1.0,"GodMod_CountDown",id+TASK_GODMOD,_,_,"a",15)
					
					VipItemsMenu(id)
				}
				else
				{
					color_chat(id,"!g%s!y: You cant use this item right now! Wait the round restart!",equal(Buffer,"0" ) ? "" : Buffer)
					VipItemsMenu(id)
				}
			}
		}
		case 5: ShowVIPMenu(id)
	}
	return PLUGIN_HANDLED
}

public VipSpecialMenu(id)
{
	if(get_user_vip(id) == 1)
	{
		new Temp[64];
		formatex(Temp, charsmax(Temp), "\y[\rVIP\y] Special Market^n^n\wVIPMoney: \y%d", VIPMoney[id])
		new Menu = menu_create(Temp, "vip_special");
		menu_additem(Menu, "\wBuy 100 \rScraps \y( \r200 \y| \wVipMoney\y)", "1");
		menu_additem(Menu, "\wBuy 10 \rChei \y( \r70 \y| \wVipMoney\y)", "2");
		menu_additem(Menu, "\wBuy 10 \rCufere \y( \r70 \y| \wVipMoney\y)", "3");
		menu_additem(Menu, "\wBuy 1000 \rDolari \y( \r50 \y| \wVipMoney\y)", "4");
		
		menu_display(id, Menu, 0);
	}
}

public vip_special(id,menu,item)
{
	if(item == MENU_EXIT || !is_user_alive(id))
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}

	new Buffer[85]
	get_pcvar_string(PcvarPrefixChat,Buffer,charsmax(Buffer))
	if(get_user_vip(id) == 1)
	{
		switch(item)
		{
			case 0:
			{
				if( 200 <= VIPMoney[id] )
				{
					if( csgor_is_user_logged( id ) )
					{
						VIPMoney[id] -= 200
						new dusts = csgor_get_user_dusts(id);
						csgor_set_user_dusts(id, dusts + 100);	
						color_chat(id,"!g%s!y: You bought 100 !gscraps!", equal(Buffer,"0" ) ? "" : Buffer);
					}
					else {
						color_chat(id,"!g%s!y: You need to be !glogged in !yin order to buy items!", equal(Buffer,"0" ) ? "" : Buffer);
						VipSpecialMenu(id);
					}
				}
				else {
					color_chat(id,"!g%s!y: You haven't sufficient VIPMoney. You need!g %d!y more for buy !gScraps.",equal(Buffer,"0" ) ? "" : Buffer,200 - VIPMoney[id])
					VipSpecialMenu(id);
				}
				
			}
			
			case 1:
			{
				if( VIPMoney[id] >= 70 )
				{
					if( csgor_is_user_logged( id ) )
					{
						VIPMoney[id] -= 70
						new keys = csgor_get_user_keys(id);
						csgor_set_user_keys(id, keys + 10);
						color_chat(id,"!g%s!y: You bought 10 !gkeys!", equal(Buffer,"0" ) ? "" : Buffer);
					}
					else {
						color_chat(id,"!g%s!y: You need to be !glogged in !yin order to buy items!", equal(Buffer,"0" ) ? "" : Buffer);
						VipSpecialMenu(id);
					}
				}
				else {
					color_chat(id,"!g%s!y: You haven't sufficient VIPMoney. You need!g %d!y more for buy !gKeys.",equal(Buffer,"0" ) ? "" : Buffer,70 - VIPMoney[id])
					VipSpecialMenu(id);
				}
			}
			
			case 2:
			{
				if(VIPMoney[id] >= 70)
				{
					if( csgor_is_user_logged( id ) )
					{
						VIPMoney[id] -= 70
						new cases = csgor_get_user_cases(id);
						csgor_set_user_cases(id, cases + 10);
						color_chat(id,"!g%s!y: You bought 10 !gcases!", equal(Buffer,"0" ) ? "" : Buffer);
					}
					else {
						color_chat(id,"!g%s!y: You need to be !glogged in !yin order to buy items!", equal(Buffer,"0" ) ? "" : Buffer);
						VipSpecialMenu(id);
					}
				}
				else {
					color_chat(id,"!g%s!y: You haven't sufficient VIPMoney. You need!g %d!y more for buy !gCases.",equal(Buffer,"0" ) ? "" : Buffer,70 - VIPMoney[id])
					VipSpecialMenu(id);
				}
			}
			
			case 3:
			{
				if(VIPMoney[id] >= 50)
				{
					if( csgor_is_user_logged( id ) )
					{
						VIPMoney[id] -= 50
						new points = csgor_get_user_points(id);
						csgor_set_user_points(id, points + 1000);
						color_chat(id,"!g%s!y: You bought 1000 !gdollars!", equal(Buffer,"0" ) ? "" : Buffer);
					}
					else {
						color_chat(id,"!g%s!y: You need to be !glogged in !yin order to buy items!", equal(Buffer,"0" ) ? "" : Buffer);
						VipSpecialMenu(id);
					}
				}
				else {
					color_chat(id,"!g%s!y: You haven't sufficient VIPMoney. You need!g %d!y more for buy !gDollars.",equal(Buffer,"0" ) ? "" : Buffer,50 - VIPMoney[id])
					VipSpecialMenu(id);
				}
			}
		}
	}
	return PLUGIN_HANDLED;
}

public fwSpawn(id) 
{ 
	if(!is_user_alive(id)) 
		return HAM_IGNORED 
	
	if(get_user_vip(id) == 1)
	{
		WeaponSelected[id] = false
		
		g_bActived_NoDmg[id] = false
		
		ShowVIPMenu(id)
		
		set_pev(id,pev_takedamage,DAMAGE_AIM)
		
		timer[id] = 15
		
		if(get_pcvar_num(PcvarShowVMoney) == 1)
			if(!task_exists(id+TASK_SHOWVMONEY))
				set_task(1.0,"ShowVIPMoney",id+TASK_SHOWVMONEY,_,_,"b")
			
		if(g_bActived_Regen[id])
			set_task(1.0,"HPRegen",id+TASK_HPREGEN,_,_,"b")
			
		if(task_exists(id+TASK_GODMOD))
			remove_task(id+TASK_GODMOD)

		cs_set_user_armor(id,100,CsArmorType:2)
			
		if(get_user_team(id) == 2)
			give_item(id, "item_thighpack")
	}
	else
	{
		if(!task_exists(id+TASK_SHOWEXPERIENCE))
			set_task(1.0,"ShowExperience",id+TASK_SHOWEXPERIENCE,_,_,"b")
	}
	return HAM_IGNORED 
} 
public fw_Ham_Player_Killed(iVictim,iAttacker)
{
	if(!iVictim || !iAttacker && !is_user_alive(iVictim) || !is_user_alive(iAttacker))
		return HAM_IGNORED
		
	if(task_exists(iVictim+TASK_HPREGEN))
		remove_task(iVictim+TASK_HPREGEN)
		
	if(task_exists(iVictim+TASK_SHOWVMONEY))
		remove_task(iVictim+TASK_SHOWVMONEY)
		
	if(task_exists(iVictim+TASK_SHOWEXPERIENCE))
		remove_task(iVictim+TASK_SHOWEXPERIENCE)
		
	if(task_exists(iVictim+TASK_GODMOD))
		remove_task(iVictim+TASK_GODMOD)
		
	if(get_user_vip(iAttacker) == 1)
	{
		set_user_health(iAttacker,get_user_health(iAttacker) + get_pcvar_num(PcvarHPGive))
		set_user_armor(iAttacker,get_user_armor(iAttacker) + get_pcvar_num(PcvarAPGive))
			
		VIPMoney[iAttacker] += get_pcvar_num(PcvarVIPMoneyKillBonus)
		
		static color[12],parts[3][4];
			
		switch( CsTeams:cs_get_user_team( iAttacker ) )
		{
			case CS_TEAM_CT:
			{	
				CVAR_color_Kill[0] = 000;
				CVAR_color_Kill[1] = 100;
				CVAR_color_Kill[2] = 200;
						
				message_begin(MSG_ONE,get_user_msgid("ScreenFade"),_,iAttacker);
				write_short(400 * 14);
				write_short(0);
				write_short(0);
				write_byte(CVAR_color_Kill[0]);
				write_byte(CVAR_color_Kill[1]);
				write_byte(CVAR_color_Kill[2]);
				write_byte(75) ;
				message_end();
						
				parse(color,parts[0],3,parts[1],3,parts[2],3);
				CVAR_color_Kill[0] = str_to_num(parts[0]);
				CVAR_color_Kill[1] = str_to_num(parts[1]);
				CVAR_color_Kill[2] = str_to_num(parts[2]);
			}
			case CS_TEAM_T:
			{		
				CVAR_color_Kill[0] = 200;
				CVAR_color_Kill[1] = 000;
				CVAR_color_Kill[2] = 000;
						
				message_begin(MSG_ONE,get_user_msgid("ScreenFade"),_,iAttacker);
				write_short(400 * 14);
				write_short(0);
				write_short(0);
				write_byte(CVAR_color_Kill[0]);
				write_byte(CVAR_color_Kill[1]);
				write_byte(CVAR_color_Kill[2]);
				write_byte(75) ;
				message_end();
						
				parse(color,parts[0],3,parts[1],3,parts[2],3);
				CVAR_color_Kill[0] = str_to_num(parts[0]);
				CVAR_color_Kill[1] = str_to_num(parts[1]);
				CVAR_color_Kill[2] = str_to_num(parts[2]);
			}
		}
	}
	else
	{
		Experience[iAttacker] += random_num(25,80)
		if(Experience[iAttacker] >= get_pcvar_num(PcvarMaxExperience))
		{
			set_user_vip(iAttacker,1)
			if(get_pcvar_num(PcvarShowVMoney) == 1)
				set_task(1.0,"ShowVIPMoney",iAttacker+TASK_SHOWVMONEY,_,_,"b")
				
			set_hudmessage(0,255,0,-1.0,0.25,1,1.0,5.0)
			ShowSyncHudMsg(iAttacker,HudsSync[3],"CONGRATULATIONS!^nYou got VIP!")
			
			remove_task(iAttacker+TASK_SHOWEXPERIENCE)
			
			new Buffer[85]
			get_pcvar_string(PcvarPrefixChat,Buffer,charsmax(Buffer))

			new Name[32]
			get_user_name(iAttacker,Name,31)
			color_chat(0,"!g%s!y: Player!t %s!y got vip with!g %d!y of !g%d!y experience!",equal(Buffer,"0" ) ? "" : Buffer,Name,Experience[iAttacker],get_pcvar_num(PcvarMaxExperience))
			
			client_cmd(0,"spk buttons/bell1")
		}
	}
	return HAM_IGNORED
}
public GodMod_CountDown(id)
{
	id -= TASK_GODMOD
	
	if(task_exists(id+TASK_GODMOD))
	{
		set_hudmessage(255,255,255,-1.0,0.70,0,1.0,1.0)
		ShowSyncHudMsg(id,HudsSync[1],"No Dmg will be off in %d second%s",timer[id],( timer[id] >= 2 ) ? "s" : "")
		
		timer[id]--
		
		if(timer[id] == 0)
		{
			remove_task(id+TASK_GODMOD)
			
			new Buffer[85]
			get_pcvar_string(PcvarPrefixChat,Buffer,charsmax(Buffer))
			
			set_pev(id,pev_takedamage,DAMAGE_AIM)

			color_chat(id,"!g%s!y: !yNo Damage deactived!",equal(Buffer,"0" ) ? "" : Buffer)
			ShowVIPMenu(id)
			
			timer[id] = 15
		}
	}
}
public HPRegen(id)
{
	id -= TASK_HPREGEN
	
	if(get_user_health(id) >= get_pcvar_num(PcvarMaxRegenHP))
	{
		set_user_health(id,get_pcvar_num(PcvarMaxRegenHP))
		return PLUGIN_HANDLED
	}
	
	else
	{
		set_user_health(id,get_user_health(id) + get_pcvar_num(PcvarHpRegenAdd))
	}
	return PLUGIN_CONTINUE
}
public ham_Player_TakeDamage_Post( iVictim, iInfictor, iAttacker, Float:fDamage, iDmgBits )
{
	if( !is_user_connected( iVictim ) || !is_user_connected( iAttacker ) || iVictim == iAttacker )
		return HAM_IGNORED
		
	if( g_bActived_Imm[iAttacker] )
	{
		if(cs_get_user_team(iAttacker) != cs_get_user_team(iVictim))
		{
			if( iDmgBits & DMG_BULLET || iDmgBits & (1<<24) || iDmgBits & DMG_SLASH )
			{
				new random = random_num( 1,4 )
				if( random == 2 )
				{
					set_pev( iVictim, pev_flags, pev( iVictim, pev_flags ) | FL_FROZEN )
					if( !task_exists( iVictim ) )
						set_task( 2.0, "remove_frozen", iVictim )
				}
			}
		}
	}
	return HAM_IGNORED
}

public remove_frozen( iVictim )
	set_pev( iVictim, pev_flags, pev( iVictim, pev_flags ) & ~FL_FROZEN )

SaveVIP( id ) 
{ 
	new szAuthid[ 32 ] 
	get_user_authid( id, szAuthid, charsmax( szAuthid ) ) 
	
	new szVaultKey[ 128 ], szVaultData[ 512 ] 
	
	formatex( szVaultKey, 127, "VIP_%s", szAuthid ) 
	formatex( szVaultData, 511, "%i %i %i %i %i %i %i %i", VIP[id],VIPMoney[id],VIPBh[id],VIPMj[id],VIPNoDmg[id],VIPRegen[id],VIPImm[id], Experience[id]) 
	nvault_set( g_nVault, szVaultKey, szVaultData ) 
} 

LoadVIP( id ) 
{ 
	new szAuthid[ 32 ] 
	get_user_authid( id, szAuthid, charsmax( szAuthid ) ) 

	new szVaultKey[ 128 ], szVaultData[ 512 ] 

	formatex( szVaultKey, 127, "VIP_%s", szAuthid ) 
	formatex( szVaultData, 511, "%i %i %i %i %i %i %i %i", VIP[id],VIPMoney[id],VIPBh[id],VIPMj[id],VIPNoDmg[id],VIPRegen[id],VIPImm[id], Experience[id]) 

	nvault_get( g_nVault, szVaultKey, szVaultData, 511 ) 

	new vp[32],vpm[32],vpmj[32],vpbhop[32],vpnodmg[32],vpregen[32],vpimm[32],exp[32]

	parse( szVaultData, vp, 31,vpm, 31,vpmj, 31, vpbhop, 31, vpnodmg, 31, vpregen, 31 ,vpimm, 31, exp, 31) 

	VIP[ id ] = str_to_num( vp )
	VIPMoney[ id ] = str_to_num( vpm ) 
	VIPBh[id] = str_to_num( vpbhop )
	VIPMj[id] = str_to_num( vpmj )
	VIPNoDmg[id] = str_to_num( vpnodmg )
	VIPRegen[id] = str_to_num( vpregen )
	VIPImm[id] = str_to_num( vpimm )
	Experience[id] = str_to_num( exp )
	
} 
public HUD( id )
{    
	id -= 672;
	
	set_task( 0.2, "HUD", id+672 );    
	if(!is_user_alive( id ) )
	{
		new szHud[64];
			
		new target = entity_get_int( id, EV_INT_iuser2 );
		if( target == 0 )
			return PLUGIN_HANDLED
			
		if(get_user_vip(target) == 1)
		{
			if(g_bActived_Bhop[target])
				formatex(szHud,63,"[ VIPMoney: %d | VIP Item: BunnyHop ]", VIPMoney[target])
				
			else if(g_bActived_Imm[target])
				formatex(szHud,63,"[ VIPMoney: %d | VIP Item: Immobilize ]", VIPMoney[target])
				
			else if(g_bActived_Mj[target])
				formatex(szHud,63,"[ VIPMoney: %d | VIP Item: MultiJump ]", VIPMoney[target])
			
			else if(g_bActived_NoDmg[target])
				formatex(szHud,63,"[ VIPMoney: %d | VIP Item: No Damage ]", VIPMoney[target])
				
			else if(g_bActived_Regen[target])
				formatex(szHud,63,"[ VIPMoney: %d | VIP Item: HP Regenerate ]", VIPMoney[target])
				
			else
				formatex(szHud,63,"[ VIPMoney: %d | VIP Item: None ]", VIPMoney[target])
		}
				
		else
			formatex(szHud,63,"[ Experience: %d of %s ]", Experience[target],get_pcvar_num(PcvarMaxExperience))
			
		set_hudmessage(150, 50, 35, -1.0, 0.95, 0, 1.0, 0.1);
		ShowSyncHudMsg(id,HudsSync[5],szHud);
	}
	return PLUGIN_CONTINUE;
}
public plugin_end( ) 
{ 
	nvault_close( g_nVault ) 
	return PLUGIN_CONTINUE 
} 

public plugin_cfg( ) 
{ 
	g_nVault = nvault_open( "VIP_Player" ) 

	if( g_nVault == INVALID_HANDLE ) 
		set_fail_state( "Error opening VIP nVault, file does not exist!" ) 
}  
public CmdStart( id, uc_handle )
{
	if( !is_user_alive( id ))
		return FMRES_IGNORED
		
	new flags = pev( id, pev_flags )
	
	if( ( get_uc( uc_handle, UC_Buttons ) & IN_JUMP ) && !( flags & FL_ONGROUND ) && !( pev( id, pev_oldbuttons ) & IN_JUMP ) && g_iJumpCount[ id ] )
	{
		g_iJumpCount[ id ]--
		new Float:velocity[ 3 ]
		pev( id, pev_velocity, velocity )
		velocity[ 2 ] = random_float( 265.0,285.0 )
		set_pev( id, pev_velocity, velocity )
	}
	else if( flags & FL_ONGROUND )
	{
		g_iJumpCount[ id ] = g_bActived_Mj[id] ? 2 : 0
	}
	return FMRES_IGNORED
}
public ham_Player_PostThink_Post( id )
{
	if( !is_user_alive( id ) )
		return HAM_IGNORED
		
	if( g_bActived_Bhop[id])
	{
		if( pev( id, pev_button) & IN_JUMP )
		{
			new flags = pev( id, pev_flags )
			
			if( flags & FL_WATERJUMP )
				return HAM_IGNORED
				
			if( pev( id, pev_waterlevel ) >= 2 )
				return HAM_IGNORED
				
			if( !( flags & FL_ONGROUND ) )
				return HAM_IGNORED
				
			static Float:velocity[ 3 ]
			pev( id, pev_velocity, velocity )
			velocity[ 2 ] += 250.0
			set_pev( id, pev_velocity, velocity )
			
			set_pev( id, pev_gaitsequence, 6 )
		}
	}
	return HAM_IGNORED
}
stock color_chat( id, const szStr[], any:... ) 
{
	new szMsg[ 191 ], iPlayers[ 32 ], iCount = 1
	
	vformat( szMsg, sizeof szMsg - 1, szStr, 3 )
	
	replace_all( szMsg, 190, "!g", "^4" )
	replace_all( szMsg, 190, "!y", "^1" )
	replace_all( szMsg, 190, "!t", "^3" )
	
	if( id )
		iPlayers[ 0 ] = id

	else 
		get_players( iPlayers, iCount, "ch" )
	
	for( new i = 0 ; i < iCount ; i++ )
	{
		if(is_user_connected( iPlayers[ i ] ) )
		{
			message_begin( MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, iPlayers[ i ] )
			write_byte( iPlayers[ i ] )
			write_string( szMsg )
			message_end( )
		}
	}
}
Nume: VIP Effx + Adaugare Shop de catre mine.
Link oficial: https://bit.ly/3aM9eby
Instalare:
Compilati fisierul din arhiva, iar folderul VIP il puneti in configs/
Alti pasi necesari: Nup
Alte precizari: Acest Plugin il vinde domnul @renegade. Vand si eu asa ceva, dar versiunea privata ( debuguita si multe update-uri, printre care si VIP Free ).
Post Reply

Return to “AmxModX”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests