vip

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
JAMMA
Membru, skill 0
Membru, skill 0
Posts: 43
Joined: 23 Jan 2018, 18:16
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Has thanked: 1 time
Contact:

09 Jan 2019, 11:37

Salut , am si eu un plugin de vip.Sa fim realisti nu am stat sa fac eu unu de la 0 , am luat unul de pe net si l-am editat . Si am si eu nevoie de ajutor cu ceva va rog.
Vreau si eu codul atunci cand faci kill sa scrie in chat ceva gen:

* Kill Reward: 30 HP , 32 AP and 300 $
* Kill Reward: 15 HP , 10 AP and 200 $
| Afiseaza codul
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <fun>

// --------------------------------------------
//   ------------- DE EDITAT ---------------
// --------------------------------------------
new const TAG[] = "[XXXXXXXXXXX]";		// TAGUL IN CHAT CARE APARE
new const CONTACT[] = "Forum";
// --------------------------------------------
//   ------------- DE EDITAT ---------------
// --------------------------------------------

#define PLUGIN_NAME "VIP System"
#define PLUGIN_NAME_PAUSED "VIP System [OPRIT]"
#define PLUGIN_VERSION "1.1"
#define PLUGIN_AUTHOR "YONTU"

#define is_user_valid(%1) (1 <= %1 <= max_players)

enum _:vip_data
{
	name[32],
	password[32]
}

enum cvars
{
	hp_spawn = 0,
	ap_spawn,
	hp_kill,
	hp_hs,
	hp_max,
	money_kill,
	money_hs,
	show_vip_tab,
	show_bullet_dmg
}

new cvar[cvars], rounds = 0;
new max_players;
new g_iPlayerPos[33], g_iPlayerCol[33];
new Array:vip_array;
new bool:is_user_vip[33], vips_number = 0;
new cvar_password_field;

// NU SCHIMBA
new const Float:g_flCoords[][] =  
{ 
	{0.50, 0.40}, 
	{0.56, 0.44}, 
	{0.60, 0.50}, 
	{0.56, 0.56}, 
	{0.50, 0.60}, 
	{0.44, 0.56}, 
	{0.40, 0.50}, 
	{0.44, 0.44} 
}

// NU SCHIMBA VALORILE DEJA EXISTENTE. Poti adauga mai multe culori, respectand matricea
new const g_iColors[][] = 
{ 
	{0, 127, 255}, // blue 
	{255, 127, 0}, // orange 
	{127, 0, 255}, // purple 
	{255, 0, 0}, // red 
	{255, 100, 150}, // pink
	{0, 255, 0} // green
}

public plugin_init()
{	
	new path[64];
	get_localinfo("amxx_configsdir", path, charsmax(path));
	formatex(path, charsmax(path), "%s/vip_maps.ini", path);
	
	new file = fopen(path, "r+");
	
	if(!file_exists(path))
	{
		write_file(path, "; VIP-UL ESTE DEZACTIVAT PE URMATOARELE HARTI: ");
		write_file(path, "; Exemplu de adaugare HARTA:^n; ^"harta^"^n^nfy_snow^ncss_bycastor");
	}
	
	new mapname[32];
	get_mapname(mapname, charsmax(mapname));
	
	new text[121], maptext[32], bool:remove_vip = false;
	while(!feof(file))
	{
		fgets(file, text, charsmax(text));
		trim(text);
		
		if(text[0] == ';' || !strlen(text)) 
		{
			continue; 
		}
		
		parse(text, maptext, charsmax(maptext));
		
		if(equal(maptext, mapname))
		{
			log_amx("Am dezactivat pluginul 'VIP' pe harta %s.", maptext);
			remove_vip = true;
			break;
		}
		
	}
	fclose(file);
	
	if(!remove_vip)
	{
		register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);

		register_event("DeathMsg", "event_DeathMsg", "a");
		register_event("Damage", "event_Damage", "b", "2>0", "3=0");
		register_event("HLTV", "event_NewRound", "a", "1=0", "2=0");
		register_event("TextMsg", "event_textmsg", "a", "2=#Game_will_restart_in")

		RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawnPost", 1);

		register_message(get_user_msgid("ScoreAttrib"), "msg_ScoreAttrib");
		
		register_clcmd("say /vips", "CmdVipsOnline");
		register_clcmd("say_team /vips", "CmdVipsOnline");
		register_clcmd("say vips", "CmdVipsOnline");
		register_clcmd("say_team vips", "CmdVipsOnline");
		
		register_clcmd("say vip", "CmdPrintAttributes");
		register_clcmd("say_team vip", "CmdPrintAttributes");
		register_clcmd("say /vip", "CmdPrintAttributes");
		register_clcmd("say_team /vip", "CmdPrintAttributes");

		cvar_password_field = register_cvar("amxx_password_field", "_pw");
		cvar[hp_spawn] = register_cvar("vip_hp_spawn", "130");			// 0 = dezactivat
		cvar[ap_spawn] = register_cvar("vip_ap_spawn", "0");			// 0 = dezactivat
		cvar[show_vip_tab] = register_cvar("vip_show_tab", "1");			// 0 = dezactivat
		cvar[show_bullet_dmg] = register_cvar("vip_show_bullet_dmg", "1");		// 0 = dezactivat
		cvar[hp_kill] = register_cvar("vip_hp_kill", "10");				// 0 = dezactivat
		cvar[hp_hs] = register_cvar("vip_hp_hs", "15");				// 0 = dezactivat
		cvar[hp_max] = register_cvar("vip_hp_max", "130");			// 0 = viata infinita
		cvar[money_kill] = register_cvar("vip_money_kill", "150");			// 0 = dezactivat
		cvar[money_hs] = register_cvar("vip_money_hs", "300");			// 0 = dezactivat

		max_players = get_maxplayers();
		read_vip_file();
	}
	else
	{
		register_plugin(PLUGIN_NAME_PAUSED, PLUGIN_VERSION, PLUGIN_AUTHOR);
		pause("ade");
	}
	
	register_cvar("vip_", PLUGIN_VERSION, FCVAR_SPONLY|FCVAR_SERVER);
	set_cvar_string("vip_", PLUGIN_VERSION);
}

read_vip_file()
{
	new path[64];
	get_localinfo("amxx_configsdir", path, charsmax(path));
	format(path, charsmax(path), "%s/vips.ini", path);
	
	new file = fopen(path, "r+");
	
	if(!file_exists(path))
	{
		new format_txt[128];
		log_to_file("vip_errors.txt", "Nu am gasit fisierul '%s'. Il creez acum!", path);

		format(format_txt, charsmax(format_txt), ";------------ | %s - Configuration file | ------------", PLUGIN_NAME);
		write_file(path, format_txt);
		format(format_txt, charsmax(format_txt), ";-------------------------- | by %s | --------------------------^n^n", PLUGIN_AUTHOR);
		write_file(path, format_txt);
		write_file(path, "; Exemplu de adaugare VIP:^n; ^"NUME^" ^"PAROLA^"^n^n^n");
	}
	
	if(vips_number)
	{
		ArrayClear(vip_array);
		vips_number = 0;
	}
	
	new text[121], p_name[32], p_password[32], vip_infos[vip_data];
	while(!feof(file))
	{
		fgets(file, text, charsmax(text));
		trim(text);
		
		if(text[0] == ';' || !strlen(text)) 
		{
			continue; 
		}
		
		if(parse(text, p_name, charsmax(p_name), p_password, charsmax(p_password)) != 2)
		{
			log_to_file("vip_errors.txt", "[AMXX] Nu am putut delimita linia (%s). Este scrisa gresit.", text);
			continue;
		}
		
		copy(vip_infos[name], charsmax(vip_infos), p_name);
		copy(vip_infos[password], charsmax(vip_infos), p_password);
		ArrayPushArray(vip_array, vip_infos);
		vips_number++;
	}
	
	fclose(file);
	
	switch(vips_number)
	{
		case 0: server_print("[AMXX] Nu am gasit nici un VIP in fisier.");
		default: server_print("[AMXX] Am incarcat %d VIP%s din fisier.", vips_number, vips_number == 1 ? "" : "I");
	}
}

public plugin_natives()
{
	vip_array = ArrayCreate(vip_data);
	
	register_native("is_user_vip", "native_is_user_vip", 1);
	register_native("set_user_vip", "native_set_user_vip", 1);
}

public plugin_end()
{
	ArrayDestroy(vip_array);
}

public native_is_user_vip(id)
{
	return is_user_vip[id];
}

public native_set_user_vip(id, bool:value)
{
	return is_user_vip[id] = (value == true) ? true : false;
}

public client_disconnect(id)
{
	is_user_vip[id] = false;
}

public client_putinserver(id)
{
	new p_name[32], p_password_field[32], p_password[32];
	get_user_info(id, "name", p_name, charsmax(p_name));
	get_pcvar_string(cvar_password_field, p_password_field, charsmax(p_password_field));
	get_user_info(id, p_password_field, p_password, charsmax(p_password));
	
	is_user_vip[id] = false;
	new vip_infos[vip_data], i;
	
	for(i = 0; i < vips_number; i++)
	{
		ArrayGetArray(vip_array, i, vip_infos);
		
		if(equal(vip_infos[name], p_name))
		{
			if(equal(vip_infos[password], p_password))
			{
				is_user_vip[id] = true;
			}
			else
			{
				server_cmd("kick #%d ^"Parola gresita...^"", get_user_userid(id));
			}
			
			break;
		}
	}
}

public CmdVipsOnline(id)
{
	if(!is_user_connected(id))
		return PLUGIN_CONTINUE;

	new adminnames[33][32], message[256], i, count, len;
	len = format(message, charsmax(message), "!4%s!3 VIPS ONLINE: ", TAG);
	for(i = 1 ; i <= max_players; i++)
	{
		if(is_user_connected(i) && is_user_vip)
			get_user_name(i, adminnames[count++], charsmax(adminnames[]));
	}
	
	if(count > 0)
	{
		for(i = 0; i < count; i++)
		{
			len += format(message[len], 255 -len, "!4%s!1%s ", adminnames, i < (count -1) ? " | " : "");
		}
		ColorChat(id, message);
	}
	else
	{
		len += format(message[len], 255 -len, "!4No one !")
		ColorChat(id, message);
	}

	return PLUGIN_CONTINUE;
}

public CmdPrintAttributes(id)
{
	if(!is_user_connected(id)) return;
	show_motd(id, "vip.html", "Beneficii VIP");
}

public event_DeathMsg()
{
	new killer = read_data(1), hs = read_data(3);	
	if(is_user_alive(killer) && is_user_vip[killer])
	{
		if(killer == read_data(2)) return PLUGIN_HANDLED;

		new cache = hs ? get_pcvar_num(cvar[hp_hs]) : get_pcvar_num(cvar[hp_kill]);
		if(cache != 0) set_user_health(killer, min(get_user_health(killer) + cache, get_pcvar_num(cvar[hp_max])));

		cache = hs ? get_pcvar_num(cvar[money_hs]) : get_pcvar_num(cvar[money_kill]);
		if(cache != 0) cs_set_user_money(killer, min(cs_get_user_money(killer) + cache, 16000));
	}

	return PLUGIN_CONTINUE;
}

public event_Damage(victim)
{
	if(!get_pcvar_num(cvar[show_bullet_dmg]))
		return PLUGIN_CONTINUE;
		
	new id = get_user_attacker(victim);
	if(is_user_valid(id))
	{
		if(is_user_alive(id) && !is_user_vip[id])
			return PLUGIN_HANDLED;
		
		if(read_data(4) || read_data(5) || read_data(6))
		{		
			new iPos = ++g_iPlayerPos[id];
			if(iPos == sizeof(g_flCoords))
				iPos = g_iPlayerPos[id] = 0;
			
			new iCol = ++g_iPlayerCol[id];
			if(iCol == sizeof(g_iColors))
				iCol = g_iPlayerCol[id] = 0;
			
			set_hudmessage(g_iColors[iCol][0], g_iColors[iCol][1], g_iColors[iCol][2], Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 0, 0.1, 2.5, 0.02, 0.02, -1);
			show_hudmessage(id, "%d", read_data(2));
		}
	}
	
	return PLUGIN_CONTINUE;
}

public event_NewRound()
{
	rounds++;
}

public event_textmsg()
{
	rounds = 0;
}

public fw_PlayerSpawnPost(id)
{
	if(is_user_vip[id] && is_user_alive(id))
	{
		set_task(0.25, "give_items", id + 212);
		return HAM_IGNORED;
	}
	
	return HAM_IGNORED;
}

public give_items(taskid)
{
	new id = taskid - 212;
	if(!is_user_alive(id))
		return;

	new cache = get_pcvar_num(cvar[hp_spawn])
	if(cache != 0) set_user_health(id, cache);

	cache = get_pcvar_num(cvar[ap_spawn]);
	if(cache != 0) cs_set_user_armor(id, cache, CS_ARMOR_VESTHELM);

	if(rounds >= 3) ShowVipMenu(id);
}

public msg_ScoreAttrib(msgid, dest, id)
{
	if(!get_pcvar_num(cvar[show_vip_tab]))
		return PLUGIN_CONTINUE;
		
	new id = get_msg_arg_int(1);
	if(is_user_connected(id) && is_user_vip[id])
		set_msg_arg_int(2, ARG_BYTE, is_user_alive(id) ? (1<<2) : (1<<0));
	
	return PLUGIN_CONTINUE;
}

public ShowVipMenu(id)
{
	if(!is_user_connected(id))
		return PLUGIN_HANDLED;

	if(!is_user_vip[id])
	{
		ColorChat(id, "!4%s!1 Imi pare rau, dar nu ai acces la meniul pentru!3 membrii VIP!1.", TAG);
		ColorChat(id, "!4%s!1 Poti cumpara VIP, contactand adresa Y!M:!3 %s!1.", TAG, CONTACT);
		return PLUGIN_HANDLED;
	}

	give_item(id, "weapon_hegrenade");
	give_item(id, "weapon_flashbang");
	give_item(id, "weapon_flashbang");
	drop_weapons(id, 2);
	give_item(id, "weapon_deagle");
	cs_set_user_bpammo(id, CSW_DEAGLE, 35);

	new menu = menu_create("\rMeniu VIP", "VipMenuHandler");
	menu_additem(menu, "M4A1 + Echipament", "1");
	menu_additem(menu, "AK-47 + Echipament", "2");
	menu_additem(menu, "AWP + Echipament", "3");
	
	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
	menu_display(id, menu, 0);
	
	return PLUGIN_CONTINUE;
}

public VipMenuHandler(id, menu, item)
{
	if(!is_user_connected(id) || item == MENU_EXIT)
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}

	new data[6], namei[64], access, CallBack;
	menu_item_getinfo(menu, item, access, data, charsmax(data), namei, charsmax(namei), CallBack);
	new key = str_to_num(data);

	switch(key)
	{
		case 1:
		{
			drop_weapons(id, 1);
			give_item(id, "weapon_m4a1");
			cs_set_user_bpammo(id, CSW_M4A1, 120);
			
			ColorChat(id, "!4%s!1 Ai ales!3 M4A1!1 +!3 Deagle!1 +!3 Set grenade!1 (!31 HE!1 + !32 FB!1).", TAG);
		}

		case 2:
		{
			drop_weapons(id, 1);
			give_item(id, "weapon_ak47");
			cs_set_user_bpammo(id, CSW_AK47, 120);
			
			ColorChat(id, "!4%s!1 Ai ales!3 AK47!1 +!3 Deagle!1 +!3 Set grenade!1 (!31 HE!1 + !32 FB!1).", TAG);
		}

		case 3:
		{
			drop_weapons(id, 1);
			give_item(id, "weapon_awp");
			cs_set_user_bpammo(id, CSW_AWP, 30);
			
			ColorChat(id, "!4%s!1 Ai ales!3 AWP!1 +!3 Deagle!1 +!3 Set grenade!1 (!31 HE!1 + !32 FB!1).", TAG);
		}
	}

	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90);
const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE);

// Drop primary/secondary weapons
stock drop_weapons(id, dropwhat)
{
	// Get user weapons
	static weapons[32], num, i, weaponid, wname[32];
	num = 0; // reset passed weapons count (bugfix)
	get_user_weapons(id, weapons, num);
	
	// Loop through them and drop primaries or secondaries
	for (i = 0; i < num; i++)
	{
		// Prevent re-indexing the array
		weaponid = weapons;
		
		if((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
		{
			// Get weapon entity
			get_weaponname(weaponid, wname, charsmax(wname));
			engclient_cmd(id, "drop", wname);
		}
	}
}

stock ColorChat(id, String[], any:...) 
{
	static szMesage[192];
	vformat(szMesage, charsmax(szMesage), String, 3);
	
	replace_all(szMesage, charsmax(szMesage), "!1", "^1");
	replace_all(szMesage, charsmax(szMesage), "!3", "^3");
	replace_all(szMesage, charsmax(szMesage), "!4", "^4");
	
	static g_msg_SayText = 0;
	if(!g_msg_SayText)
		g_msg_SayText = get_user_msgid("SayText");
	
	new Players[32], iNum = 1, i;

 	if(id) Players[0] = id;
	else get_players(Players, iNum, "ch");
	
	for(--iNum; iNum >= 0; iNum--) 
	{
		i = Players[iNum];
		
		message_begin(MSG_ONE_UNRELIABLE, g_msg_SayText, _, i);
		write_byte(i);
		write_string(szMesage);
		message_end();
	}
}[/quote]
Last edited by JAMMA on 09 Jan 2019, 12:05, edited 1 time in total.
RoyalServer
User avatar
Laurentiu P.
Fost moderator
Fost moderator
Posts: 2549
Joined: 10 Jul 2013, 21:26
Detinator Steam: Da
Reputatie: Fost super moderator
Fond eXtream: 100
Has thanked: 26 times
Been thanked: 62 times
Contact:

09 Jan 2019, 12:04

Mutat la modificari pluginuri.
no...
User avatar
levin
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 3844
Joined: 24 Aug 2011, 12:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Discord: devilclass
Has thanked: 36 times
Been thanked: 594 times
Contact:

09 Jan 2019, 18:20

| Afiseaza codul
[code]
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <fun>

// --------------------------------------------
//   ------------- DE EDITAT ---------------
// --------------------------------------------
new const TAG[] = "[XXXXXXXXXXX]";		// TAGUL IN CHAT CARE APARE
new const CONTACT[] = "Forum";
// --------------------------------------------
//   ------------- DE EDITAT ---------------
// --------------------------------------------

#define PLUGIN_NAME "VIP System"
#define PLUGIN_NAME_PAUSED "VIP System [OPRIT]"
#define PLUGIN_VERSION "1.1"
#define PLUGIN_AUTHOR "YONTU"

#define is_user_valid(%1) (1 <= %1 <= max_players)

enum _:vip_data
{
	name[32],
	password[32]
}

enum cvars
{
	hp_spawn = 0,
	ap_spawn,
	hp_kill,
	hp_hs,
	hp_max,
	money_kill,
	money_hs,
	show_vip_tab,
	show_bullet_dmg
}

new cvar[cvars], rounds = 0;
new max_players;
new g_iPlayerPos[33], g_iPlayerCol[33];
new Array:vip_array;
new bool:is_user_vip[33], vips_number = 0;
new cvar_password_field;

// NU SCHIMBA
new const Float:g_flCoords[][] =  
{ 
	{0.50, 0.40}, 
	{0.56, 0.44}, 
	{0.60, 0.50}, 
	{0.56, 0.56}, 
	{0.50, 0.60}, 
	{0.44, 0.56}, 
	{0.40, 0.50}, 
	{0.44, 0.44} 
}

// NU SCHIMBA VALORILE DEJA EXISTENTE. Poti adauga mai multe culori, respectand matricea
new const g_iColors[][] = 
{ 
	{0, 127, 255}, // blue 
	{255, 127, 0}, // orange 
	{127, 0, 255}, // purple 
	{255, 0, 0}, // red 
	{255, 100, 150}, // pink
	{0, 255, 0} // green
}

public plugin_init()
{	
	new path[64];
	get_localinfo("amxx_configsdir", path, charsmax(path));
	formatex(path, charsmax(path), "%s/vip_maps.ini", path);
	
	new file = fopen(path, "r+");
	
	if(!file_exists(path))
	{
		write_file(path, "; VIP-UL ESTE DEZACTIVAT PE URMATOARELE HARTI: ");
		write_file(path, "; Exemplu de adaugare HARTA:^n; ^"harta^"^n^nfy_snow^ncss_bycastor");
	}
	
	new mapname[32];
	get_mapname(mapname, charsmax(mapname));
	
	new text[121], maptext[32], bool:remove_vip = false;
	while(!feof(file))
	{
		fgets(file, text, charsmax(text));
		trim(text);
		
		if(text[0] == ';' || !strlen(text)) 
		{
			continue; 
		}
		
		parse(text, maptext, charsmax(maptext));
		
		if(equal(maptext, mapname))
		{
			log_amx("Am dezactivat pluginul 'VIP' pe harta %s.", maptext);
			remove_vip = true;
			break;
		}
		
	}
	fclose(file);
	
	if(!remove_vip)
	{
		register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);

		register_event("DeathMsg", "event_DeathMsg", "a");
		register_event("Damage", "event_Damage", "b", "2>0", "3=0");
		register_event("HLTV", "event_NewRound", "a", "1=0", "2=0");
		register_event("TextMsg", "event_textmsg", "a", "2=#Game_will_restart_in")

		RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawnPost", 1);

		register_message(get_user_msgid("ScoreAttrib"), "msg_ScoreAttrib");
		
		register_clcmd("say /vips", "CmdVipsOnline");
		register_clcmd("say_team /vips", "CmdVipsOnline");
		register_clcmd("say vips", "CmdVipsOnline");
		register_clcmd("say_team vips", "CmdVipsOnline");
		
		register_clcmd("say vip", "CmdPrintAttributes");
		register_clcmd("say_team vip", "CmdPrintAttributes");
		register_clcmd("say /vip", "CmdPrintAttributes");
		register_clcmd("say_team /vip", "CmdPrintAttributes");

		cvar_password_field = register_cvar("amxx_password_field", "_pw");
		cvar[hp_spawn] = register_cvar("vip_hp_spawn", "130");			// 0 = dezactivat
		cvar[ap_spawn] = register_cvar("vip_ap_spawn", "0");			// 0 = dezactivat
		cvar[show_vip_tab] = register_cvar("vip_show_tab", "1");			// 0 = dezactivat
		cvar[show_bullet_dmg] = register_cvar("vip_show_bullet_dmg", "1");		// 0 = dezactivat
		cvar[hp_kill] = register_cvar("vip_hp_kill", "10");				// 0 = dezactivat
		cvar[hp_hs] = register_cvar("vip_hp_hs", "15");				// 0 = dezactivat
		cvar[hp_max] = register_cvar("vip_hp_max", "130");			// 0 = viata infinita
		cvar[money_kill] = register_cvar("vip_money_kill", "150");			// 0 = dezactivat
		cvar[money_hs] = register_cvar("vip_money_hs", "300");			// 0 = dezactivat

		max_players = get_maxplayers();
		read_vip_file();
	}
	else
	{
		register_plugin(PLUGIN_NAME_PAUSED, PLUGIN_VERSION, PLUGIN_AUTHOR);
		pause("ade");
	}
	
	register_cvar("vip_", PLUGIN_VERSION, FCVAR_SPONLY|FCVAR_SERVER);
	set_cvar_string("vip_", PLUGIN_VERSION);
}

read_vip_file()
{
	new path[64];
	get_localinfo("amxx_configsdir", path, charsmax(path));
	format(path, charsmax(path), "%s/vips.ini", path);
	
	new file = fopen(path, "r+");
	
	if(!file_exists(path))
	{
		new format_txt[128];
		log_to_file("vip_errors.txt", "Nu am gasit fisierul '%s'. Il creez acum!", path);

		format(format_txt, charsmax(format_txt), ";------------ | %s - Configuration file | ------------", PLUGIN_NAME);
		write_file(path, format_txt);
		format(format_txt, charsmax(format_txt), ";-------------------------- | by %s | --------------------------^n^n", PLUGIN_AUTHOR);
		write_file(path, format_txt);
		write_file(path, "; Exemplu de adaugare VIP:^n; ^"NUME^" ^"PAROLA^"^n^n^n");
	}
	
	if(vips_number)
	{
		ArrayClear(vip_array);
		vips_number = 0;
	}
	
	new text[121], p_name[32], p_password[32], vip_infos[vip_data];
	while(!feof(file))
	{
		fgets(file, text, charsmax(text));
		trim(text);
		
		if(text[0] == ';' || !strlen(text)) 
		{
			continue; 
		}
		
		if(parse(text, p_name, charsmax(p_name), p_password, charsmax(p_password)) != 2)
		{
			log_to_file("vip_errors.txt", "[AMXX] Nu am putut delimita linia (%s). Este scrisa gresit.", text);
			continue;
		}
		
		copy(vip_infos[name], charsmax(vip_infos), p_name);
		copy(vip_infos[password], charsmax(vip_infos), p_password);
		ArrayPushArray(vip_array, vip_infos);
		vips_number++;
	}
	
	fclose(file);
	
	switch(vips_number)
	{
		case 0: server_print("[AMXX] Nu am gasit nici un VIP in fisier.");
		default: server_print("[AMXX] Am incarcat %d VIP%s din fisier.", vips_number, vips_number == 1 ? "" : "I");
	}
}

public plugin_natives()
{
	vip_array = ArrayCreate(vip_data);
	
	register_native("is_user_vip", "native_is_user_vip", 1);
	register_native("set_user_vip", "native_set_user_vip", 1);
}

public plugin_end()
{
	ArrayDestroy(vip_array);
}

public native_is_user_vip(id)
{
	return is_user_vip[id];
}

public native_set_user_vip(id, bool:value)
{
	return is_user_vip[id] = (value == true) ? true : false;
}

public client_disconnect(id)
{
	is_user_vip[id] = false;
}

public client_putinserver(id)
{
	new p_name[32], p_password_field[32], p_password[32];
	get_user_info(id, "name", p_name, charsmax(p_name));
	get_pcvar_string(cvar_password_field, p_password_field, charsmax(p_password_field));
	get_user_info(id, p_password_field, p_password, charsmax(p_password));
	
	is_user_vip[id] = false;
	new vip_infos[vip_data], i;
	
	for(i = 0; i < vips_number; i++)
	{
		ArrayGetArray(vip_array, i, vip_infos);
		
		if(equal(vip_infos[name], p_name))
		{
			if(equal(vip_infos[password], p_password))
			{
				is_user_vip[id] = true;
			}
			else
			{
				server_cmd("kick #%d ^"Parola gresita...^"", get_user_userid(id));
			}
			
			break;
		}
	}
}

public CmdVipsOnline(id)
{
	if(!is_user_connected(id))
		return PLUGIN_CONTINUE;

	new adminnames[33][32], message[256], i, count, len;
	len = format(message, charsmax(message), "!4%s!3 VIPS ONLINE: ", TAG);
	for(i = 1 ; i <= max_players; i++)
	{
		if(is_user_connected(i) && is_user_vip)
			get_user_name(i, adminnames[count++], charsmax(adminnames[]));
	}
	
	if(count > 0)
	{
		for(i = 0; i < count; i++)
		{
			len += format(message[len], 255 -len, "!4%s!1%s ", adminnames, i < (count -1) ? " | " : "");
		}
		ColorChat(id, message);
	}
	else
	{
		len += format(message[len], 255 -len, "!4No one !")
		ColorChat(id, message);
	}

	return PLUGIN_CONTINUE;
}

public CmdPrintAttributes(id)
{
	if(!is_user_connected(id)) return;
	show_motd(id, "vip.html", "Beneficii VIP");
}

public event_DeathMsg()
{
	new killer = read_data(1), hs = read_data(3);	
	if(is_user_alive(killer) && is_user_vip[killer])
	{
		if(killer == read_data(2)) return PLUGIN_HANDLED;

		new cache = hs ? get_pcvar_num(cvar[hp_hs]) : get_pcvar_num(cvar[hp_kill]);
		if(cache != 0)	set_user_health(killer, min(get_user_health(killer) + cache, get_pcvar_num(cvar[hp_max])));

		new cache2 = hs ? get_pcvar_num(cvar[money_hs]) : get_pcvar_num(cvar[money_kill]);
		if(cache2 != 0) cs_set_user_money(killer, min(cs_get_user_money(killer) + cache2, 16000));

		ColorChat(killer, "!4%s!1 * Kill Reward: %d HP and %d $", TAG,cache,cache2);
	}

	return PLUGIN_CONTINUE;
}

public event_Damage(victim)
{
	if(!get_pcvar_num(cvar[show_bullet_dmg]))
		return PLUGIN_CONTINUE;
		
	new id = get_user_attacker(victim);
	if(is_user_valid(id))
	{
		if(is_user_alive(id) && !is_user_vip[id])
			return PLUGIN_HANDLED;
		
		if(read_data(4) || read_data(5) || read_data(6))
		{		
			new iPos = ++g_iPlayerPos[id];
			if(iPos == sizeof(g_flCoords))
				iPos = g_iPlayerPos[id] = 0;
			
			new iCol = ++g_iPlayerCol[id];
			if(iCol == sizeof(g_iColors))
				iCol = g_iPlayerCol[id] = 0;
			
			set_hudmessage(g_iColors[iCol][0], g_iColors[iCol][1], g_iColors[iCol][2], Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 0, 0.1, 2.5, 0.02, 0.02, -1);
			show_hudmessage(id, "%d", read_data(2));
		}
	}
	
	return PLUGIN_CONTINUE;
}

public event_NewRound()
{
	rounds++;
}

public event_textmsg()
{
	rounds = 0;
}

public fw_PlayerSpawnPost(id)
{
	if(is_user_vip[id] && is_user_alive(id))
	{
		set_task(0.25, "give_items", id + 212);
		return HAM_IGNORED;
	}
	
	return HAM_IGNORED;
}

public give_items(taskid)
{
	new id = taskid - 212;
	if(!is_user_alive(id))
		return;

	new cache = get_pcvar_num(cvar[hp_spawn])
	if(cache != 0) set_user_health(id, cache);

	cache = get_pcvar_num(cvar[ap_spawn]);
	if(cache != 0) cs_set_user_armor(id, cache, CS_ARMOR_VESTHELM);

	if(rounds >= 3) ShowVipMenu(id);
}

public msg_ScoreAttrib(msgid, dest, id)
{
	if(!get_pcvar_num(cvar[show_vip_tab]))
		return PLUGIN_CONTINUE;
		
	new id = get_msg_arg_int(1);
	if(is_user_connected(id) && is_user_vip[id])
		set_msg_arg_int(2, ARG_BYTE, is_user_alive(id) ? (1<<2) : (1<<0));
	
	return PLUGIN_CONTINUE;
}

public ShowVipMenu(id)
{
	if(!is_user_connected(id))
		return PLUGIN_HANDLED;

	if(!is_user_vip[id])
	{
		ColorChat(id, "!4%s!1 Imi pare rau, dar nu ai acces la meniul pentru!3 membrii VIP!1.", TAG);
		ColorChat(id, "!4%s!1 Poti cumpara VIP, contactand adresa Y!M:!3 %s!1.", TAG, CONTACT);
		return PLUGIN_HANDLED;
	}

	give_item(id, "weapon_hegrenade");
	give_item(id, "weapon_flashbang");
	give_item(id, "weapon_flashbang");
	drop_weapons(id, 2);
	give_item(id, "weapon_deagle");
	cs_set_user_bpammo(id, CSW_DEAGLE, 35);

	new menu = menu_create("\rMeniu VIP", "VipMenuHandler");
	menu_additem(menu, "M4A1 + Echipament", "1");
	menu_additem(menu, "AK-47 + Echipament", "2");
	menu_additem(menu, "AWP + Echipament", "3");
	
	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
	menu_display(id, menu, 0);
	
	return PLUGIN_CONTINUE;
}

public VipMenuHandler(id, menu, item)
{
	if(!is_user_connected(id) || item == MENU_EXIT)
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}

	new data[6], namei[64], access, CallBack;
	menu_item_getinfo(menu, item, access, data, charsmax(data), namei, charsmax(namei), CallBack);
	new key = str_to_num(data);

	switch(key)
	{
		case 1:
		{
			drop_weapons(id, 1);
			give_item(id, "weapon_m4a1");
			cs_set_user_bpammo(id, CSW_M4A1, 120);
			
			ColorChat(id, "!4%s!1 Ai ales!3 M4A1!1 +!3 Deagle!1 +!3 Set grenade!1 (!31 HE!1 + !32 FB!1).", TAG);
		}

		case 2:
		{
			drop_weapons(id, 1);
			give_item(id, "weapon_ak47");
			cs_set_user_bpammo(id, CSW_AK47, 120);
			
			ColorChat(id, "!4%s!1 Ai ales!3 AK47!1 +!3 Deagle!1 +!3 Set grenade!1 (!31 HE!1 + !32 FB!1).", TAG);
		}

		case 3:
		{
			drop_weapons(id, 1);
			give_item(id, "weapon_awp");
			cs_set_user_bpammo(id, CSW_AWP, 30);
			
			ColorChat(id, "!4%s!1 Ai ales!3 AWP!1 +!3 Deagle!1 +!3 Set grenade!1 (!31 HE!1 + !32 FB!1).", TAG);
		}
	}

	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90);
const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE);

// Drop primary/secondary weapons
stock drop_weapons(id, dropwhat)
{
	// Get user weapons
	static weapons[32], num, i, weaponid, wname[32];
	num = 0; // reset passed weapons count (bugfix)
	get_user_weapons(id, weapons, num);
	
	// Loop through them and drop primaries or secondaries
	for (i = 0; i < num; i++)
	{
		// Prevent re-indexing the array
		weaponid = weapons;
		
		if((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
		{
			// Get weapon entity
			get_weaponname(weaponid, wname, charsmax(wname));
			engclient_cmd(id, "drop", wname);
		}
	}
}

stock ColorChat(id, String[], any:...) 
{
	static szMesage[192];
	vformat(szMesage, charsmax(szMesage), String, 3);
	
	replace_all(szMesage, charsmax(szMesage), "!1", "^1");
	replace_all(szMesage, charsmax(szMesage), "!3", "^3");
	replace_all(szMesage, charsmax(szMesage), "!4", "^4");
	
	static g_msg_SayText = 0;
	if(!g_msg_SayText)
		g_msg_SayText = get_user_msgid("SayText");
	
	new Players[32], iNum = 1, i;

 	if(id) Players[0] = id;
	else get_players(Players, iNum, "ch");
	
	for(--iNum; iNum >= 0; iNum--) 
	{
		i = Players[iNum];
		
		message_begin(MSG_ONE_UNRELIABLE, g_msg_SayText, _, i);
		write_byte(i);
		write_string(szMesage);
		message_end();
	}
}
[/code]
Pentru ajutor, faceți cerere bine detaliată, completând și respectând modelul corespunzător.
Nu-mi mai dați cereri doar pentru a mă avea în lista de prieteni.
Dacă te ajut, și mă ignori/etc > te adaug în „foe”.
Aveți grijă la cei ce încearcă să mă copieze sau să dea drept mine..Puteți lua legătura cu mine prin STEAM dacă aveți o problemă/nelămurire în acest caz! Cont de forum am doar aici.
În cazul în care utilizați ceva din ce am postat(ex: aici), e bine să fiți la curent cu modificările aduse și de aici, iar dacă sunt ceva probleme nu ezitați să luați legătura cu mine. Actualizarea unor coduri nu se vor afișa public, doar dacă se găsește ceva critic/urgent de remediat, unele fiind coduri vechi iar unele refăcute chiar recent dar private.
* Nume pe cs1.6: eVoLuTiOn \ Nume vechi: eVo
* Atelierul meu - post2819572.html#p2819572 (închis, click link ca să vedeți de ce)
JAMMA
Membru, skill 0
Membru, skill 0
Posts: 43
Joined: 23 Jan 2018, 18:16
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Has thanked: 1 time
Contact:

10 Jan 2019, 11:40

User avatar
levin
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 3844
Joined: 24 Aug 2011, 12:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Discord: devilclass
Has thanked: 36 times
Been thanked: 594 times
Contact:

10 Jan 2019, 15:44

?????????????????
Pentru ajutor, faceți cerere bine detaliată, completând și respectând modelul corespunzător.
Nu-mi mai dați cereri doar pentru a mă avea în lista de prieteni.
Dacă te ajut, și mă ignori/etc > te adaug în „foe”.
Aveți grijă la cei ce încearcă să mă copieze sau să dea drept mine..Puteți lua legătura cu mine prin STEAM dacă aveți o problemă/nelămurire în acest caz! Cont de forum am doar aici.
În cazul în care utilizați ceva din ce am postat(ex: aici), e bine să fiți la curent cu modificările aduse și de aici, iar dacă sunt ceva probleme nu ezitați să luați legătura cu mine. Actualizarea unor coduri nu se vor afișa public, doar dacă se găsește ceva critic/urgent de remediat, unele fiind coduri vechi iar unele refăcute chiar recent dar private.
* Nume pe cs1.6: eVoLuTiOn \ Nume vechi: eVo
* Atelierul meu - post2819572.html#p2819572 (închis, click link ca să vedeți de ce)
JAMMA
Membru, skill 0
Membru, skill 0
Posts: 43
Joined: 23 Jan 2018, 18:16
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Has thanked: 1 time
Contact:

10 Jan 2019, 15:51

Mi-o dat eroare la compilat ceva cu colorchat
User avatar
levin
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 3844
Joined: 24 Aug 2011, 12:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Discord: devilclass
Has thanked: 36 times
Been thanked: 594 times
Contact:

10 Jan 2019, 17:45

nu e nici o eroare,sunt atenționări
Pentru ajutor, faceți cerere bine detaliată, completând și respectând modelul corespunzător.
Nu-mi mai dați cereri doar pentru a mă avea în lista de prieteni.
Dacă te ajut, și mă ignori/etc > te adaug în „foe”.
Aveți grijă la cei ce încearcă să mă copieze sau să dea drept mine..Puteți lua legătura cu mine prin STEAM dacă aveți o problemă/nelămurire în acest caz! Cont de forum am doar aici.
În cazul în care utilizați ceva din ce am postat(ex: aici), e bine să fiți la curent cu modificările aduse și de aici, iar dacă sunt ceva probleme nu ezitați să luați legătura cu mine. Actualizarea unor coduri nu se vor afișa public, doar dacă se găsește ceva critic/urgent de remediat, unele fiind coduri vechi iar unele refăcute chiar recent dar private.
* Nume pe cs1.6: eVoLuTiOn \ Nume vechi: eVo
* Atelierul meu - post2819572.html#p2819572 (închis, click link ca să vedeți de ce)
JAMMA
Membru, skill 0
Membru, skill 0
Posts: 43
Joined: 23 Jan 2018, 18:16
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Has thanked: 1 time
Contact:

10 Jan 2019, 18:18

Poti spune si AP?
User avatar
levin
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 3844
Joined: 24 Aug 2011, 12:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Discord: devilclass
Has thanked: 36 times
Been thanked: 594 times
Contact:

10 Jan 2019, 19:01

| Afiseaza codul
[code]
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <fun>

#pragma tabsize 0

// --------------------------------------------
//   ------------- DE EDITAT ---------------
// --------------------------------------------
new const TAG[] = "[XXXXXXXXXXX]";      // TAGUL IN CHAT CARE APARE
new const CONTACT[] = "Forum";
// --------------------------------------------
//   ------------- DE EDITAT ---------------
// --------------------------------------------

#define PLUGIN_NAME "VIP System"
#define PLUGIN_NAME_PAUSED "VIP System [OPRIT]"
#define PLUGIN_VERSION "1.1"
#define PLUGIN_AUTHOR "YONTU"

#define is_user_valid(%1) (1 <= %1 <= max_players)

enum _:vip_data
{
   name[32],
   password[32]
}

enum cvars
{
   hp_spawn = 0,
   ap_spawn,
   hp_kill,
   hp_hs,
   hp_max,

ap_kill,
ap_hs,
ap_max,

   money_kill,
   money_hs,
   show_vip_tab,
   show_bullet_dmg
}

new cvar[cvars], rounds = 0;
new max_players;
new g_iPlayerPos[33], g_iPlayerCol[33];
new Array:vip_array;
new bool:is_user_vip[33], vips_number = 0;
new cvar_password_field;

// NU SCHIMBA
new const Float:g_flCoords[][] =  
{ 
   {0.50, 0.40}, 
   {0.56, 0.44}, 
   {0.60, 0.50}, 
   {0.56, 0.56}, 
   {0.50, 0.60}, 
   {0.44, 0.56}, 
   {0.40, 0.50}, 
   {0.44, 0.44} 
}

// NU SCHIMBA VALORILE DEJA EXISTENTE. Poti adauga mai multe culori, respectand matricea
new const g_iColors[][] = 
{ 
   {0, 127, 255}, // blue 
   {255, 127, 0}, // orange 
   {127, 0, 255}, // purple 
   {255, 0, 0}, // red 
   {255, 100, 150}, // pink
   {0, 255, 0} // green
}

public plugin_init()
{   
   new path[64];
   get_localinfo("amxx_configsdir", path, charsmax(path));
   formatex(path, charsmax(path), "%s/vip_maps.ini", path);
   
   new file = fopen(path, "r+");
   
   if(!file_exists(path))
   {
      write_file(path, "; VIP-UL ESTE DEZACTIVAT PE URMATOARELE HARTI: ");
      write_file(path, "; Exemplu de adaugare HARTA:^n; ^"harta^"^n^nfy_snow^ncss_bycastor");
   }
   
   new mapname[32];
   get_mapname(mapname, charsmax(mapname));
   
   new text[121], maptext[32], bool:remove_vip = false;
   while(!feof(file))
   {
      fgets(file, text, charsmax(text));
      trim(text);
      
      if(text[0] == ';' || !strlen(text)) 
      {
         continue; 
      }
      
      parse(text, maptext, charsmax(maptext));
      
      if(equal(maptext, mapname))
      {
         log_amx("Am dezactivat pluginul 'VIP' pe harta %s.", maptext);
         remove_vip = true;
         break;
      }
      
   }
   fclose(file);
   
   if(!remove_vip)
   {
      register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);

      register_event("DeathMsg", "event_DeathMsg", "a");
      register_event("Damage", "event_Damage", "b", "2>0", "3=0");
      register_event("HLTV", "event_NewRound", "a", "1=0", "2=0");
      register_event("TextMsg", "event_textmsg", "a", "2=#Game_will_restart_in")

      RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawnPost", 1);

      register_message(get_user_msgid("ScoreAttrib"), "msg_ScoreAttrib");
      
      register_clcmd("say /vips", "CmdVipsOnline");
      register_clcmd("say_team /vips", "CmdVipsOnline");
      register_clcmd("say vips", "CmdVipsOnline");
      register_clcmd("say_team vips", "CmdVipsOnline");
      
      register_clcmd("say vip", "CmdPrintAttributes");
      register_clcmd("say_team vip", "CmdPrintAttributes");
      register_clcmd("say /vip", "CmdPrintAttributes");
      register_clcmd("say_team /vip", "CmdPrintAttributes");

      cvar_password_field = register_cvar("amxx_password_field", "_pw");
      cvar[hp_spawn] = register_cvar("vip_hp_spawn", "130");         // 0 = dezactivat
      cvar[ap_spawn] = register_cvar("vip_ap_spawn", "0");         // 0 = dezactivat
      cvar[show_vip_tab] = register_cvar("vip_show_tab", "1");         // 0 = dezactivat
      cvar[show_bullet_dmg] = register_cvar("vip_show_bullet_dmg", "1");      // 0 = dezactivat
      cvar[hp_kill] = register_cvar("vip_hp_kill", "10");            // 0 = dezactivat
      cvar[hp_hs] = register_cvar("vip_hp_hs", "15");            // 0 = dezactivat
      cvar[hp_max] = register_cvar("vip_hp_max", "130");         // 0 = viata infinita

      cvar[ap_kill] = register_cvar("vip_ap_kill", "10");            // 0 = dezactivat
      cvar[ap_hs] = register_cvar("vip_ap_hs", "15");            // 0 = dezactivat
      cvar[ap_max] = register_cvar("vip_ap_max", "200");         // 0 = armura infinita

      cvar[money_kill] = register_cvar("vip_money_kill", "150");         // 0 = dezactivat
      cvar[money_hs] = register_cvar("vip_money_hs", "300");         // 0 = dezactivat

      max_players = get_maxplayers();
      read_vip_file();
   }
   else
   {
      register_plugin(PLUGIN_NAME_PAUSED, PLUGIN_VERSION, PLUGIN_AUTHOR);
      pause("ade");
   }
   
   register_cvar("vip_", PLUGIN_VERSION, FCVAR_SPONLY|FCVAR_SERVER);
   set_cvar_string("vip_", PLUGIN_VERSION);
}

read_vip_file()
{
   new path[64];
   get_localinfo("amxx_configsdir", path, charsmax(path));
   format(path, charsmax(path), "%s/vips.ini", path);
   
   new file = fopen(path, "r+");
   
   if(!file_exists(path))
   {
      new format_txt[128];
      log_to_file("vip_errors.txt", "Nu am gasit fisierul '%s'. Il creez acum!", path);

      format(format_txt, charsmax(format_txt), ";------------ | %s - Configuration file | ------------", PLUGIN_NAME);
      write_file(path, format_txt);
      format(format_txt, charsmax(format_txt), ";-------------------------- | by %s | --------------------------^n^n", PLUGIN_AUTHOR);
      write_file(path, format_txt);
      write_file(path, "; Exemplu de adaugare VIP:^n; ^"NUME^" ^"PAROLA^"^n^n^n");
   }
   
   if(vips_number)
   {
      ArrayClear(vip_array);
      vips_number = 0;
   }
   
   new text[121], p_name[32], p_password[32], vip_infos[vip_data];
   while(!feof(file))
   {
      fgets(file, text, charsmax(text));
      trim(text);
      
      if(text[0] == ';' || !strlen(text)) 
      {
         continue; 
      }
      
      if(parse(text, p_name, charsmax(p_name), p_password, charsmax(p_password)) != 2)
      {
         log_to_file("vip_errors.txt", "[AMXX] Nu am putut delimita linia (%s). Este scrisa gresit.", text);
         continue;
      }
      
      copy(vip_infos[name], charsmax(vip_infos), p_name);
      copy(vip_infos[password], charsmax(vip_infos), p_password);
      ArrayPushArray(vip_array, vip_infos);
      vips_number++;
   }
   
   fclose(file);
   
   switch(vips_number)
   {
      case 0: server_print("[AMXX] Nu am gasit nici un VIP in fisier.");
      default: server_print("[AMXX] Am incarcat %d VIP%s din fisier.", vips_number, vips_number == 1 ? "" : "I");
   }
}

public plugin_natives()
{
   vip_array = ArrayCreate(vip_data);
   
   register_native("is_user_vip", "native_is_user_vip", 1);
   register_native("set_user_vip", "native_set_user_vip", 1);
}

public plugin_end()
{
   ArrayDestroy(vip_array);
}

public native_is_user_vip(id)
{
   return is_user_vip[id];
}

public native_set_user_vip(id, bool:value)
{
   return is_user_vip[id] = (value == true) ? true : false;
}

public client_disconnect(id)
{
   is_user_vip[id] = false;
}

public client_putinserver(id)
{
   new p_name[32], p_password_field[32], p_password[32];
   get_user_info(id, "name", p_name, charsmax(p_name));
   get_pcvar_string(cvar_password_field, p_password_field, charsmax(p_password_field));
   get_user_info(id, p_password_field, p_password, charsmax(p_password));
   
   is_user_vip[id] = false;
   new vip_infos[vip_data], i;
   
   for(i = 0; i < vips_number; i++)
   {
      ArrayGetArray(vip_array, i, vip_infos);
      
      if(equal(vip_infos[name], p_name))
      {
         if(equal(vip_infos[password], p_password))
         {
            is_user_vip[id] = true;
         }
         else
         {
            server_cmd("kick #%d ^"Parola gresita...^"", get_user_userid(id));
         }
         
         break;
      }
   }
}

public CmdVipsOnline(id)
{
   if(!is_user_connected(id))
      return PLUGIN_CONTINUE;

   new adminnames[33][32], message[256], i, count, len;
   len = format(message, charsmax(message), "!4%s!3 VIPS ONLINE: ", TAG);
   for(i = 1 ; i <= max_players; i++)
   {
      if(is_user_connected(i) && is_user_vip)
         get_user_name(i, adminnames[count++], charsmax(adminnames[]));
   }
   
   if(count > 0)
   {
      for(i = 0; i < count; i++)
      {
         len += format(message[len], 255 -len, "!4%s!1%s ", adminnames, i < (count -1) ? " | " : "");
      }
      ColorChat(id, message);
   }
   else
   {
      len += format(message[len], 255 -len, "!4No one !")
      ColorChat(id, message);
   }

   return PLUGIN_CONTINUE;
}

public CmdPrintAttributes(id)
{
   if(!is_user_connected(id)) return;
   show_motd(id, "vip.html", "Beneficii VIP");
}

public event_DeathMsg()
{
   new killer = read_data(1), hs = read_data(3);   
   if(is_user_alive(killer) && is_user_vip[killer])
   {
      if(killer == read_data(2)) return PLUGIN_HANDLED;

      new cache = hs ? get_pcvar_num(cvar[hp_hs]) : get_pcvar_num(cvar[hp_kill]);
      if(cache != 0)	set_user_health(killer, min(get_user_health(killer) + cache, get_pcvar_num(cvar[hp_max])));

      new cache2 = hs ? get_pcvar_num(cvar[money_hs]) : get_pcvar_num(cvar[money_kill]);
      if(cache2 != 0) cs_set_user_money(killer, min(cs_get_user_money(killer) + cache2, 16000));

new cache3=hs?get_pcvar_num(cvar[ap_hs]) : get_pcvar_num(cvar[ap_kill]);
if(cache3!=0)	set_user_armor(killer, min(get_user_armor(killer) + cache3, get_pcvar_num(cvar[ap_max])));

      ColorChat(killer, "!4%s!1 * Kill Reward: %d HP, %d AP  and %d $", TAG,cache,cache3,cache2);
   }

   return PLUGIN_CONTINUE;
}

public event_Damage(victim)
{
   if(!get_pcvar_num(cvar[show_bullet_dmg]))
      return PLUGIN_CONTINUE;
      
   new id = get_user_attacker(victim);
   if(is_user_valid(id))
   {
      if(is_user_alive(id) && !is_user_vip[id])
         return PLUGIN_HANDLED;
      
      if(read_data(4) || read_data(5) || read_data(6))
      {      
         new iPos = ++g_iPlayerPos[id];
         if(iPos == sizeof(g_flCoords))
            iPos = g_iPlayerPos[id] = 0;
         
         new iCol = ++g_iPlayerCol[id];
         if(iCol == sizeof(g_iColors))
            iCol = g_iPlayerCol[id] = 0;
         
         set_hudmessage(g_iColors[iCol][0], g_iColors[iCol][1], g_iColors[iCol][2], Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 0, 0.1, 2.5, 0.02, 0.02, -1);
         show_hudmessage(id, "%d", read_data(2));
      }
   }
   
   return PLUGIN_CONTINUE;
}

public event_NewRound()
{
   rounds++;
}

public event_textmsg()
{
   rounds = 0;
}

public fw_PlayerSpawnPost(id)
{
   if(is_user_vip[id] && is_user_alive(id))
   {
      set_task(0.25, "give_items", id + 212);
      return HAM_IGNORED;
   }
   
   return HAM_IGNORED;
}

public give_items(taskid)
{
   new id = taskid - 212;
   if(!is_user_alive(id))
      return;

   new cache = get_pcvar_num(cvar[hp_spawn])
   if(cache != 0) set_user_health(id, cache);

   cache = get_pcvar_num(cvar[ap_spawn]);
   if(cache != 0) cs_set_user_armor(id, cache, CS_ARMOR_VESTHELM);

   if(rounds >= 3) ShowVipMenu(id);
}

public msg_ScoreAttrib(msgid, dest, id)
{
   if(!get_pcvar_num(cvar[show_vip_tab]))
      return PLUGIN_CONTINUE;
      
   new id = get_msg_arg_int(1);
   if(is_user_connected(id) && is_user_vip[id])
      set_msg_arg_int(2, ARG_BYTE, is_user_alive(id) ? (1<<2) : (1<<0));
   
   return PLUGIN_CONTINUE;
}

public ShowVipMenu(id)
{
   if(!is_user_connected(id))
      return PLUGIN_HANDLED;

   if(!is_user_vip[id])
   {
      ColorChat(id, "!4%s!1 Imi pare rau, dar nu ai acces la meniul pentru!3 membrii VIP!1.", TAG);
      ColorChat(id, "!4%s!1 Poti cumpara VIP, contactand adresa Y!M:!3 %s!1.", TAG, CONTACT);
      return PLUGIN_HANDLED;
   }

   give_item(id, "weapon_hegrenade");
   give_item(id, "weapon_flashbang");
   give_item(id, "weapon_flashbang");
   drop_weapons(id, 2);
   give_item(id, "weapon_deagle");
   cs_set_user_bpammo(id, CSW_DEAGLE, 35);

   new menu = menu_create("\rMeniu VIP", "VipMenuHandler");
   menu_additem(menu, "M4A1 + Echipament", "1");
   menu_additem(menu, "AK-47 + Echipament", "2");
   menu_additem(menu, "AWP + Echipament", "3");
   
   menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
   menu_display(id, menu, 0);
   
   return PLUGIN_CONTINUE;
}

public VipMenuHandler(id, menu, item)
{
   if(!is_user_connected(id) || item == MENU_EXIT)
   {
      menu_destroy(menu);
      return PLUGIN_HANDLED;
   }

   new data[6], namei[64], access, CallBack;
   menu_item_getinfo(menu, item, access, data, charsmax(data), namei, charsmax(namei), CallBack);
   new key = str_to_num(data);

   switch(key)
   {
      case 1:
      {
         drop_weapons(id, 1);
         give_item(id, "weapon_m4a1");
         cs_set_user_bpammo(id, CSW_M4A1, 120);
         
         ColorChat(id, "!4%s!1 Ai ales!3 M4A1!1 +!3 Deagle!1 +!3 Set grenade!1 (!31 HE!1 + !32 FB!1).", TAG);
      }

      case 2:
      {
         drop_weapons(id, 1);
         give_item(id, "weapon_ak47");
         cs_set_user_bpammo(id, CSW_AK47, 120);
         
         ColorChat(id, "!4%s!1 Ai ales!3 AK47!1 +!3 Deagle!1 +!3 Set grenade!1 (!31 HE!1 + !32 FB!1).", TAG);
      }

      case 3:
      {
         drop_weapons(id, 1);
         give_item(id, "weapon_awp");
         cs_set_user_bpammo(id, CSW_AWP, 30);
         
         ColorChat(id, "!4%s!1 Ai ales!3 AWP!1 +!3 Deagle!1 +!3 Set grenade!1 (!31 HE!1 + !32 FB!1).", TAG);
      }
   }

   menu_destroy(menu);
   return PLUGIN_HANDLED;
}

const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90);
const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE);

// Drop primary/secondary weapons
stock drop_weapons(id, dropwhat)
{
   // Get user weapons
   static weapons[32], num, i, weaponid, wname[32];
   num = 0; // reset passed weapons count (bugfix)
   get_user_weapons(id, weapons, num);
   
   // Loop through them and drop primaries or secondaries
   for (i = 0; i < num; i++)
   {
      // Prevent re-indexing the array
      weaponid = weapons;
      
      if((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
      {
         // Get weapon entity
         get_weaponname(weaponid, wname, charsmax(wname));
         engclient_cmd(id, "drop", wname);
      }
   }
}

stock ColorChat(id, String[], any:...) 
{
   static szMesage[192];
   vformat(szMesage, charsmax(szMesage), String, 3);
   
   replace_all(szMesage, charsmax(szMesage), "!1", "^1");
   replace_all(szMesage, charsmax(szMesage), "!3", "^3");
   replace_all(szMesage, charsmax(szMesage), "!4", "^4");
   
   static g_msg_SayText = 0;
   if(!g_msg_SayText)
      g_msg_SayText = get_user_msgid("SayText");
   
   new Players[32], iNum = 1, i;

    if(id) Players[0] = id;
   else get_players(Players, iNum, "ch");
   
   for(--iNum; iNum >= 0; iNum--) 
   {
      i = Players[iNum];
      
      message_begin(MSG_ONE_UNRELIABLE, g_msg_SayText, _, i);
      write_byte(i);
      write_string(szMesage);
      message_end();
   }
}
[/code]
Pentru ajutor, faceți cerere bine detaliată, completând și respectând modelul corespunzător.
Nu-mi mai dați cereri doar pentru a mă avea în lista de prieteni.
Dacă te ajut, și mă ignori/etc > te adaug în „foe”.
Aveți grijă la cei ce încearcă să mă copieze sau să dea drept mine..Puteți lua legătura cu mine prin STEAM dacă aveți o problemă/nelămurire în acest caz! Cont de forum am doar aici.
În cazul în care utilizați ceva din ce am postat(ex: aici), e bine să fiți la curent cu modificările aduse și de aici, iar dacă sunt ceva probleme nu ezitați să luați legătura cu mine. Actualizarea unor coduri nu se vor afișa public, doar dacă se găsește ceva critic/urgent de remediat, unele fiind coduri vechi iar unele refăcute chiar recent dar private.
* Nume pe cs1.6: eVoLuTiOn \ Nume vechi: eVo
* Atelierul meu - post2819572.html#p2819572 (închis, click link ca să vedeți de ce)
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: Yandex [Bot] and 10 guests