Modificare Plugin shop

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
AlexandruD
Membru, skill +1
Membru, skill +1
Posts: 182
Joined: 08 Jun 2015, 20:31
Detinator Steam: Da
Detinator server CS: FURIEN.CSOS.RO
SteamID: .::A L E X::.
Fond eXtream: 0
Been thanked: 1 time
Contact:

14 Feb 2020, 10:29

Salut , cum ar trebui modificat urmatorul plugin astfel incat cand cumperi Black Pack sa iti dea si 100 AP pe langa cutit?
| Afiseaza codul
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <engine>
#include <hamsandwich>
#include <fakemeta_util>

#define PLUGIN "Furien Shop"
#define VERSION "1.0"

#define AKCOST 9000
#define SKCOST 15000
#define BLACKPACKCOST 9000
#define ANTIFLASHCOST 9000
#define HECOST 3000
#define HPCOST 3000
#define APCOST 1000
#define DEFUSECOST 500
#define INCARCATORCOST 9000

#define BLACKPACKSPEED 800.0

#define MAX_HP		250
#define MAX_AP		300


#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame

enum {
	AK47GOLD,
	SUPERKNIFE,
	BLACKPACK
}

new const g_szKnifeModels[][] = {
	"models/fr_models/v_superknife.mdl",
	"models/fr_models/v_blackpack.mdl"
}
new const g_szAk47Models[][] = {
	"models/fr_models/v_ak47_gold.mdl",
	"models/fr_models/p_ak47_gold.mdl"
}
new bool:g_bHaveNoFlash[33];
new g_iWeapon[33];

new const szPickAmmoSound[] = "items/9mmclip1.wav";
new const szTag[] = "[BLACK.WATF.RO - SHOP]";	
new g_msgScreenFade;
public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, "FaTzZu");
	
	register_clcmd("say shop", "ShopMenu");
	register_clcmd("say_team shop", "ShopMenu");
	register_clcmd("say /shop", "ShopMenu");
	register_clcmd("say_team /shop", "ShopMenu");
	register_clcmd("shop", "ShopMenu");
	
	register_event("CurWeapon", "CurrentWeapon", "be", "1=1");
	
	RegisterHam(Ham_TakeDamage, "player", "Ham_PlayerDamage");
	RegisterHam(Ham_Killed, "player", "Ham_PlayerKilled", 0);
	RegisterHam(Ham_Spawn, "player", "Ham_PlayerSpawn", 1);
	RegisterHam(Ham_Player_ResetMaxSpeed, "player", "Player_ResetMaxSpeed", 1);
	
	register_clcmd("say /c","cmdSayC");
	
	register_event("ScreenFade", "eventFlash", "be", "4=255", "5=255", "6=255", "7>199")
	g_msgScreenFade = get_user_msgid("ScreenFade");
	
}
public cmdSayC(id) 
{
	if(get_user_flags(id) & ADMIN_IMMUNITY) 
	{
		cs_set_user_money(id, 16000);
	}
}
public plugin_precache()
{		
	precache_sound(szPickAmmoSound);
	
	for(new i;i<sizeof(g_szKnifeModels);i++)
	{
		if(!file_exists(g_szKnifeModels)) 
		{
			server_print("Modelul %s nu exista!", g_szKnifeModels);
			set_fail_state("Model inexistent");
		}
		precache_model(g_szKnifeModels);
	}
		
	for(new i;i<sizeof(g_szAk47Models);i++)
	{
		if(!file_exists(g_szAk47Models)) 
		{
			server_print("Modelul %s nu exista!", g_szAk47Models);
			set_fail_state("Model inexistent");
		}	
		precache_model(g_szAk47Models);
	}
}
public client_putinserver(id)
{
	g_iWeapon[id] = 3;
}
public client_disconnect(id) remove_task(id+221);
public CurrentWeapon(id) 
{
	new szWeapon = get_user_weapon( id );
	if(is_user_alive(id))
	{
		switch(g_iWeapon[id])
		{
			case AK47GOLD:
			{
				if(user_has_weapon(id, CSW_AK47)  &&  szWeapon == CSW_AK47  &&  get_user_team(id) == 2)
				{
					set_pev(id, pev_viewmodel2, g_szAk47Models[0]);
					set_pev(id, pev_weaponmodel2, g_szAk47Models[1]);
				}
			}
			case SUPERKNIFE:
			{
				if(user_has_weapon(id, CSW_KNIFE)  &&  szWeapon == CSW_KNIFE  &&  get_user_team(id) == 1)
					set_pev(id, pev_viewmodel2, g_szKnifeModels[0]);
			}
			case BLACKPACK:	
			{
				if(user_has_weapon(id, CSW_KNIFE) && szWeapon == CSW_KNIFE && get_user_team(id) == 1)
					set_pev(id, pev_viewmodel2, g_szKnifeModels[1]);
			}
		}
	} 
} 

public Ham_PlayerSpawn(id)
{
	if(!is_user_alive(id))
		return;
	
	g_bHaveNoFlash[id] = false;
	if(g_iWeapon[id] == AK47GOLD)
		g_iWeapon[id] = 3;
}

public Ham_PlayerKilled(victim, attacker, shouldgib) g_iWeapon[victim] = 3;

public Ham_PlayerDamage(iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits )
{
	if(is_user_alive(iAttacker))
	{
		switch(g_iWeapon[iAttacker])
		{
			case AK47GOLD:
			{
				if(iInflictor == iAttacker && get_user_weapon(iAttacker) == CSW_KNIFE && get_user_team(iAttacker) == 2)
					SetHamParamFloat( 4, fDamage * 1.4);				
			}
			case SUPERKNIFE:
			{
				if(iInflictor == iAttacker && get_user_weapon(iAttacker) == CSW_KNIFE && get_user_team(iAttacker) == 1)
					SetHamParamFloat( 4, fDamage * 2.8);
			}
			case BLACKPACK:
			{
				if(iInflictor == iAttacker && get_user_weapon(iAttacker) == CSW_KNIFE && get_user_team(iAttacker) == 1)
					SetHamParamFloat( 4, fDamage * 1.0);
			}
		}
	}
	return HAM_HANDLED;
}

public ShopMenu(id)
{
	if(is_user_connected(id))
	{
		switch(cs_get_user_team(id))
		{
			case CS_TEAM_T:
			{
				new szText[128];
				
				formatex(szText, charsmax(szText), "\SHOP \BLACK.WATF.Ro");
				new menu = menu_create(szText, "furiensShopHandler");
				
				formatex(szText, charsmax(szText), "\Super Knife - \%d \$", SKCOST);
				menu_additem(menu, szText);	

				formatex(szText, charsmax(szText), "\HE Grenade - \%d \$", HECOST);
				menu_additem(menu, szText);
				

				formatex(szText, charsmax(szText), "\50 HP - \%d \$", HPCOST);
				menu_additem(menu, szText);

				formatex(szText, charsmax(szText), "\50 AP - \%d \$", APCOST);
				menu_additem(menu, szText);
				
				formatex(szText, charsmax(szText), "\Anti-Flash - \%d \$", ANTIFLASHCOST);
				menu_additem(menu, szText);
				
				formatex(szText, charsmax(szText), "\Black Pack - \%d \$", BLACKPACKCOST);
				menu_additem(menu, szText);

				menu_setprop(menu, MPROP_EXIT , MEXIT_ALL);
				menu_display(id, menu, 0);
				
			}
			case CS_TEAM_CT:
			{			
				new szTexts[128];
				
				formatex(szTexts, charsmax(szTexts), "\SHOP \BLACK.WATF.Ro");
				new menu = menu_create(szTexts, "humansShopHandler");
				
				formatex(szTexts, charsmax(szTexts), "\Ak47 Gold - \%d \$", AKCOST);
				menu_additem(menu, szTexts);						
				
				formatex(szTexts, charsmax(szTexts), "\Defuse Kit - \%d \$", DEFUSECOST);
				menu_additem(menu, szTexts);

				formatex(szTexts, charsmax(szTexts), "\50 HP - \%d \$", HPCOST);
				menu_additem(menu, szTexts);
								
				formatex(szTexts, charsmax(szTexts), "\50 AP - \%d \$", APCOST);
				menu_additem(menu, szTexts);
			
				
				formatex(szTexts, charsmax(szTexts), "\Anti-Flash - \%d \$", ANTIFLASHCOST);
				menu_additem(menu, szTexts);
				
				formatex(szTexts, charsmax(szTexts), "\Incarcator - \%d \$", INCARCATORCOST);
				menu_additem(menu, szTexts);
				
				menu_setprop(menu, MPROP_EXIT , MEXIT_ALL);
				menu_display(id, menu, 0);
			}
		}
	}
	return 1;
}

public furiensShopHandler(id, menu, item)
{
	if(item == MENU_EXIT || get_user_team(id) != 1 || !is_user_alive(id))
	{
		menu_destroy(menu);
		return 1;
	}
	switch(item)
	{
		case 0:
		{
			new iMoney = cs_get_user_money(id) - SKCOST;
			
			if(iMoney < 0)
			{
				ColorChat(id,  "!g%s!nNu ai suficienti !g$ !n!", szTag);
				return 1;
			}
			else
			{
				if(g_iWeapon[id] == 1)
				{
					ColorChat(id, "!g%s!nDetii deja !gSuper Knife !n!", szTag);
					return 1;
				}
				else
				{
					g_iWeapon[id] = 1;
					give_item(id, "weapon_knife");
					CurrentWeapon(id)
					emit_sound(id, CHAN_ITEM, szPickAmmoSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
					
					cs_set_user_money(id, iMoney);
				}
			}
		}
		case 1:
		{
			new iMoney = cs_get_user_money(id) - HECOST;
			
			if(iMoney < 0)
			{
				ColorChat(id,  "!g%s!nNu ai suficienti !g$ !n!", szTag);
				return 1;
			}
			else
			{
				if(pev(id, pev_weapons) & (1<<CSW_HEGRENADE))
				{
					ColorChat(id, "!g%s!nDetii deja !gHE GRENADE !n!", szTag);
					return 1;
				}
				else
				{
					cs_set_user_money(id, iMoney);
					give_item(id, "weapon_hegrenade");
					emit_sound(id, CHAN_ITEM, szPickAmmoSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
				}
			}
		}
		case 2:
		{
			new iMoney = cs_get_user_money(id) - HPCOST;
			if(iMoney < 0)
			{
				ColorChat(id,  "!g%s!nNu ai suficienti !g$ !n!", szTag);
				return 1;
			}
			
			if(get_user_health(id) >= MAX_HP)
				return 1;
			
			set_user_health(id, clamp(get_user_health(id) + 50, 1, MAX_HP))
			
			cs_set_user_money(id, iMoney);
			emit_sound(id, CHAN_ITEM, szPickAmmoSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
		}
		case 3:
		{
			new iMoney = cs_get_user_money(id) - APCOST;
			if(iMoney < 0)
			{
				ColorChat(id,  "!g%s!nNu ai suficienti !g$ !n!", szTag);
				return 1;
			}
			if(get_user_armor(id) >= MAX_AP)
				return 1;
	
			set_user_armor(id, clamp(get_user_armor(id) + 100, 1, 300));
	
			cs_set_user_money(id, iMoney);
			emit_sound(id, CHAN_ITEM, szPickAmmoSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
		}
		case 4:
		{
			new iMoney = cs_get_user_money(id) - ANTIFLASHCOST;
			
			if(iMoney < 0)
			{
				ColorChat(id,  "!g%s!nNu ai suficienti !g$ !n!", szTag);
				return 1;
			}
			else
			{
				if(g_bHaveNoFlash[id])
				{
					ColorChat(id, "!g%s!nAi deja !gAnti Flash !n!", szTag);
					return 1;
				}
				else
				{
					g_bHaveNoFlash[id] = true;
					emit_sound(id, CHAN_ITEM, szPickAmmoSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
					
					cs_set_user_money(id, iMoney);
				}
			}			
		}
		case 5:
		{
			new iMoney = cs_get_user_money(id) - BLACKPACKCOST;
			
			if(iMoney < 0)
			{
				ColorChat(id,  "!g%s!nNu ai suficienti !g$ !n!", szTag);
				return 1;
			}
			else
			{
				if(g_iWeapon[id] == BLACKPACK)
				{
					ColorChat(id, "!g%s!nDetii deja !gBlackPack !n!", szTag);
					return 1;
				}
				else
				{
					g_iWeapon[id] = BLACKPACK;
					give_item(id, "weapon_knife");
					CurrentWeapon(id)
					emit_sound(id, CHAN_ITEM, szPickAmmoSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
					
					cs_set_user_money(id, iMoney);
				}
			}
		}
	}
	return 1;
}

public humansShopHandler(id, menu, item)
{
	if(item == MENU_EXIT || get_user_team(id) != 2 || !is_user_alive(id))
	{
		menu_destroy(menu);
		return 1;
	}
	switch(item)
	{
		case 0:
		{
			new iMoney = cs_get_user_money(id) - AKCOST;
			
			if(iMoney < 0)
			{
				ColorChat(id,  "!g%s!nNu ai suficienti !g$ !n!", szTag);
				return 1;
			}
			else
			{
				if(g_iWeapon[id] == AK47GOLD)
				{
					ColorChat(id, "!g%s!nDetii deja !gAk47Gold !n!", szTag);
					return 1;
				}
				else
				{
					g_iWeapon[id] = AK47GOLD;
					give_item(id, "weapon_ak47");
					cs_set_user_bpammo(id, CSW_AK47, 250);
					CurrentWeapon(id)
					emit_sound(id, CHAN_ITEM, szPickAmmoSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
					
					cs_set_user_money(id, iMoney);
				}
			}			
		}
		case 1:
		{
			new iMoney = cs_get_user_money(id) - DEFUSECOST;
			if(iMoney < 0)
			{
				ColorChat(id,  "!g%s!nNu ai suficienti !g$ !n!", szTag);
				return 1;
			}
			else
			{
				if( cs_get_user_defuse(id) )
				{
					ColorChat(id, "!g%s!nAi deja !gDefuse Kit !n!", szTag);
					return 1;
				}
				else
				{
					cs_set_user_defuse(id, 1);
					emit_sound(id, CHAN_ITEM, szPickAmmoSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
					
					cs_set_user_money(id, iMoney);
				}
			}	
		}
		case 2:
		{
			new iMoney = cs_get_user_money(id) - HPCOST;
			if(iMoney < 0)
			{
				ColorChat(id,  "!g%s!nNu ai suficienti !g$ !n!", szTag);
				return 1;
			}
			if(get_user_health(id) >= MAX_HP)
				return 1;
			
			set_user_health(id, clamp(get_user_health(id) + 50, 1, MAX_HP))
			
			cs_set_user_money(id, iMoney);
			emit_sound(id, CHAN_ITEM, szPickAmmoSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
		}
		case 3:
		{
			new iMoney = cs_get_user_money(id) - APCOST;
			if(iMoney < 0)
			{
				ColorChat(id,  "!g%s!nNu ai suficienti !g$ !n!", szTag);
				return 1;
			}
			if(get_user_armor(id) >= MAX_AP)
				return 1;
					
			set_user_armor(id, clamp(get_user_armor(id) + 100, 1, 300));
			
			cs_set_user_money(id, iMoney);
			emit_sound(id, CHAN_ITEM, szPickAmmoSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
		}
		case 4:
		{
			new iMoney = cs_get_user_money(id) - ANTIFLASHCOST;
			
			if(iMoney < 0)
			{
				ColorChat(id,  "!g%s!nNu ai suficienti !g$ !n!", szTag);
				return 1;
			}
			else
			{
				if(g_bHaveNoFlash[id])
				{
					ColorChat(id, "!g%s!nAi deja !gAnti Flash !n!", szTag);
					return 1;
				}
				else
				{
					g_bHaveNoFlash[id] = true;
					emit_sound(id, CHAN_ITEM, szPickAmmoSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
					
					cs_set_user_money(id, iMoney);
				}
			}			
		}
		case 5:
		{
			new iMoney = cs_get_user_money(id) - INCARCATORCOST;
			if(iMoney < 0)
			{
				ColorChat(id,  "!g%s!nNu ai suficienti !g$ !n!", szTag);
				return 1;
			}		
			cs_set_user_bpammo(id, get_user_weapon(id), 250);
			
			cs_set_user_money(id, iMoney);
			emit_sound(id, CHAN_ITEM, szPickAmmoSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
		}
	}
	return 1;
}
public Player_ResetMaxSpeed(id)
{
	if( is_user_alive(id) && get_user_team(id) == 1 && get_user_maxspeed(id) != 1.0 && g_iWeapon[id] == BLACKPACK)
		set_pev(id, pev_maxspeed, BLACKPACKSPEED)
}
public eventFlash(id)
{
	if(is_user_connected(id) && g_bHaveNoFlash[id])
	{
		message_begin(MSG_ONE, g_msgScreenFade, {0,0,0}, id)
		write_short(1)
		write_short(1)
		write_short(1)
		write_byte(0)
		write_byte(0)
		write_byte(0)
		write_byte(255)
		message_end()
	}
}
public plugin_natives()
{
	register_native("set_user_superknife", "_set_user_superknife", 1);
}
public _set_user_superknife(id, x)
{
	if(x == 1) {
		
		g_iWeapon[id] = SUPERKNIFE;
		CurrentWeapon(id);
		return PLUGIN_HANDLED;
	}
	g_iWeapon[id] = 3;	
	return PLUGIN_CONTINUE;
}
/* Colochat */
stock ColorChat(const id,const input[], any:...) {
	new iNum = 1, iPlayers[32];
	static szMessage[191];
	vformat(szMessage, charsmax(szMessage),input, 3);
	
	replace_all(szMessage, charsmax(szMessage), "!g", "^4");
	replace_all(szMessage, charsmax(szMessage), "!n", "^1");
	replace_all(szMessage, charsmax(szMessage), "!t", "^3");
	
	if(id) iPlayers[0] = id;
	else get_players(iPlayers, iNum, "ch");
		
	for(new i = 0; i < iNum; i++) 
	{
		if(is_user_connected(iPlayers)) 
		{
			message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, iPlayers);
			write_byte(iPlayers);
			write_string(szMessage);
			message_end();
		}
	}
}
FURIEN.CSOS.RO
Visit CSOS Community , The Future Is Now !!!
Enix
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2728
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 38 times
Been thanked: 418 times
Contact:

14 Feb 2020, 15:49

set_user_armor(client,VALOARE ARMURĂ)
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
În cazul în care utilizați ceva din addonsurile postate de mine aici, e bine să fiți la curent cu modificările aduse unor plugine, aici.
AlexandruD
Membru, skill +1
Membru, skill +1
Posts: 182
Joined: 08 Jun 2015, 20:31
Detinator Steam: Da
Detinator server CS: FURIEN.CSOS.RO
SteamID: .::A L E X::.
Fond eXtream: 0
Been thanked: 1 time
Contact:

14 Feb 2020, 16:25

L E V I N wrote:
14 Feb 2020, 15:49
set_user_armor(client,VALOARE ARMURĂ)
am rezolvat , multumesc
FURIEN.CSOS.RO
Visit CSOS Community , The Future Is Now !!!
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 11 guests