Modificare Shop/Furien

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
Cristi602
Membru, skill 0
Membru, skill 0
Posts: 47
Joined: 21 Nov 2015, 11:02
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

22 Jan 2020, 05:57

Salut, as vrea si eu la acest shop sa mai adaug cateva chestii si modificari, la ct sa fie adaugat respawn odata pe runda sa fie acces la vip si sa coste o anumita suma de bani , si pet care sa iti ofere 20hp+20ap tot la vip si sa coste tot la fel bani , respawn la fel ca la ct cu acces vip si mega knife care sa iti ofere 20hp+20ap dmg x3 !
| Afiseaza codul
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <fun>
#include <hamsandwich>

// Limitele HP si AP
#define MAX_HP 250
#define MAX_AP 250

new bool:g_noflash[33], g_superknife[33], g_msg_screenfade;

// Aici modifici ca urmatoarele. Prima este numele, a 2 pretul, a 3 echipa (0 fiind pentru ambele echipe), a 4 a mesajul eroare.
new const item_names[][] =
{
	"Super Knife",
	"Super Knife 2",
	"50 HP",
	"50 AP",
	"He Grenade",
	"No Flash"
}

new const item_cost[] =
{
	16000,
	16000,
	3000,
	2000,
	3000,
	1000
}

new const item_team[] =
{
	1,
	1,
	0,
	0,
	0,
	0
}

new const item_error[][] =
{
	"Ai deja Super Knife!",
	"Ai deja Super Knife 2!",
	"Nu poti cumpara mai mult de 250 HP!",
	"Nu poti cumpara mai mult de 250 AP!",
	"Ai deja o grenada!",
	"Ai deja No Flash!"
}

new const superknife[][] = 
{
	"models/furien/superknife.mdl",
	"models/furien/superknife2.mdl"
}

public plugin_init()
{
	register_plugin("Simple Shop", "1.0", "cyby");
	RegisterHam(Ham_Spawn, "player", "spawn_post", 1);
	RegisterHam(Ham_TakeDamage, "player", "ham_take_damage", 0);
	register_event("DeathMsg", "death_msg", "a");
	register_event("CurWeapon", "current_weapon", "be", "1=1");
	g_msg_screenfade = get_user_msgid("ScreenFade");
	register_message(g_msg_screenfade, "msg_screenfade");
	register_clcmd("say /shop", "shop_cmd");
	register_clcmd("say shop", "shop_cmd");
}

public plugin_precache()
{
	for(new i = 0; i < sizeof superknife; i++)
		precache_model(superknife);
}

public shop_cmd(id)
{
	if(!is_user_alive(id))
	{
		client_print(id, print_center, "Doar jucatorii care sunt in viata pot accesa shopul!");
		return PLUGIN_HANDLED;
	}
	new menu_item[128], menu, tasta[2];
	formatex(menu_item, charsmax(menu_item), "\yShop\r Furien.Ro^n\yBanuti:\r %d$", cs_get_user_money(id));
	menu = menu_create(menu_item, "shop_handler");
	for(new i = 0; i < sizeof item_names; i++)
	{
		switch(item_team)
		{
			case 0: formatex(menu_item, charsmax(menu_item), "\y%s\R%d$", item_names, item_cost);
			case 1:
			{
				if(get_user_team(id) != 1)
					formatex(menu_item, charsmax(menu_item), "\d%s\R%d$", item_names, item_cost);
				else
					formatex(menu_item, charsmax(menu_item), "\y%s\R%d$", item_names, item_cost);
			}
			case 2:
			{
				if(get_user_team(id) != 2)
					formatex(menu_item, charsmax(menu_item), "\d%s\R%d$", item_names, item_cost);
				else
					formatex(menu_item, charsmax(menu_item), "\y%s\R%d$", item_names, item_cost);
			}
		}
		tasta[0] = i;
		tasta[1] = 0;
		menu_additem(menu, menu_item, tasta);
	}
	menu_display(id, menu, 0);
	return PLUGIN_HANDLED;
}

public shop_handler(id, menu, item)
{
	if(item == MENU_EXIT)
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	if(!is_user_alive(id))
	{
		client_print(id, print_center, "Nu poti folosi shopul cat esti mort!");
		return PLUGIN_HANDLED;
	}
	
	if(item_team[item] != 0 && get_user_team(id) != item_team[item])
	{
		client_print(id, print_center, "Nu poti cumpara acest item la echipa ta!");
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	if(cs_get_user_money(id) < item_cost[item])
	{
		client_print(id, print_center, "Nu ai destui bani pentru a cumpara acest item!");
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	switch(item)
	{
		case 0:
		{
			if(g_superknife[id] > 0)
			{
				error_message(id, menu, item);
				return PLUGIN_HANDLED;
			}
			g_superknife[id] = 1, current_weapon(id);
		}
		case 1:
		{
			if(g_superknife[id] > 0)
			{
				error_message(id, menu, item);
				return PLUGIN_HANDLED;
			}
			g_superknife[id] = 2, current_weapon(id);
		}
		case 2:
		{
			if(get_user_health(id) == 250)
			{
				error_message(id, menu, item);
				return PLUGIN_HANDLED;
			}
			set_user_health(id, clamp(get_user_health(id) + 50, 0, MAX_HP));
		}
		case 3: 
		{
			if(get_user_armor(id) == 250)
			{
				error_message(id, menu, item);
				return PLUGIN_HANDLED;
			}
			set_user_armor(id, clamp(get_user_armor(id) + 50, 0, MAX_AP));
		}
		case 4:
		{
			if(user_has_weapon(id, CSW_HEGRENADE))
			{
				error_message(id, menu, item);
				return PLUGIN_HANDLED;
			}
			give_item(id, "weapon_hegrenade");
		}
		case 5:
		{
			if(g_noflash[id])
			{
				error_message(id, menu, item);
				return PLUGIN_HANDLED;
			}
			g_noflash[id] = true;
		}
	}
	client_print(id, print_center, "Ai cumparat %s", item_names[item]);
	cs_set_user_money(id, cs_get_user_money(id) - item_cost[item]);
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

public client_putinserver(id)
{
	g_noflash[id] = false;
	g_superknife[id] = 0;
}

public spawn_post(id)
{
	if(!is_user_alive(id))
		return;
		
	g_noflash[id] = false;
	if(get_user_team(id) == 2)
		g_superknife[id] = 0;
}

public ham_take_damage(vic, inf, att, Float:dmg, dmgbits)
{
	if(!is_user_alive(att))
		return HAM_IGNORED;
	
	// fixeaza dmg-ul dublu dat pe grenada
	if(get_user_team(att) == 1 && (g_superknife[att] > 0 && g_superknife[att] < 3) && !(dmgbits & (1<<24)))
		dmg *= 2.0;
		
	SetHamParamFloat(4, dmg);
	return HAM_IGNORED;
}

public death_msg()
{
	new victim = read_data(2);
	g_noflash[victim] = false;
	g_superknife[victim] = 0;
}

public current_weapon(id)
{
	if(!is_user_alive(id))
		return;
		
	if(get_user_team(id) == 1 && get_user_weapon(id) == CSW_KNIFE && (g_superknife[id] > 0 && g_superknife[id] < 3))
		set_pev(id, pev_viewmodel2, superknife[g_superknife[id] - 1]);
}

public msg_screenfade(msgid, dest, id)
{
	if(g_noflash[id])
	{
		new date[4];
		date[0] = get_msg_arg_int(4); 
		date[1] = get_msg_arg_int(5);
		date[2] = get_msg_arg_int(6); 
		date[3] = get_msg_arg_int(7);
		
		if(date[0] == 255 && date[1] == 255 && date[2] == 255 && date[3] > 199)
			return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}

stock error_message(id, menu, item)
{
	if(!is_user_alive(id))
		menu_destroy(menu);
	client_print(id, print_center, "%s", item_error[item]);
	menu_destroy(menu);
}
RoyalServer
Manutza*
Membru, skill 0
Membru, skill 0
Posts: 80
Joined: 10 Nov 2018, 11:47
Detinator Steam: Da
CS Status: id/amgshowtime
Fond eXtream: 0
Discord: RS6#1237
Been thanked: 4 times
Contact:

22 Jan 2020, 18:23

Nimeni nu iti face asa ceva moca
Image
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests