PLUGIN SHOP

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori

Post Reply
Pegasus6ix
Membru, skill 0
Membru, skill 0
Posts: 24
Joined: 11 Nov 2018, 23:25
Detinator Steam: Nu
Fond eXtream: 0
Has thanked: 10 times

28 Jul 2019, 02:53

Salut am acest plugin shop, cand cumpar pet-ul, ramane pe loc, adica nu merge dupa CT ma poate ajuta cineva ? Dau multumesc daca e de ajuns :face_begging_eyes:
| Afiseaza codul
/* Plugin generated by AMXX-Studio */

/*	Copyright © 2013-2014, Adventx

	Furien Shop Ultimate is free software;
	you can redistribute it and/or modify it under the terms of the
	GNU General Public License as published by the Free Software Foundation.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with Furien Shop Ultimate; if not, write to the
	Free Software Foundation, Inc., 59 Temple Place - Suite 330,
	Boston, MA 02111-1307, USA.
	
	Credits:
	
		Sn!ff3r - Thanks for Animals Pet (https://forums.alliedmods.net/showthread.php?t=91860)
*/

#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#include <fun>

new const PLUGIN[] = "Furien: Shop Ultimate";
new const VERSION[] = "0.2.8";

#pragma semicolon 1

// Pet / User Vaild
#define is_user_valid(%0)		(1 <= %0 <= g_iMaxPlayers)
#define fm_precache_model(%1)           engfunc(EngFunc_PrecacheModel,%1)
#define fm_precache_sound(%1)           engfunc(EngFunc_PrecacheSound,%1)
#define fm_remove_entity(%1)            engfunc(EngFunc_RemoveEntity, %1)
#define fm_drop_to_floor(%1)            engfunc(EngFunc_DropToFloor,%1)
#define fm_find_ent_by_class(%1,%2)     engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
#define fm_set_user_gravity(%1,%2)      set_pev(%1,pev_gravity,%2)
 
#define PET_FLAG                        pev_flTimeStepSound
#define PET_KILLED                      389

// Credits System
#define ASKHANAR_CREDITS
//#define ARAGON_CREDITS

#if defined ASKHANAR_CREDITS
native fcs_get_user_credits(client);
native fcs_set_user_credits(client, credits);
#endif

#if defined ARAGON_CREDITS
native get_user_credits(id);
native set_user_credits(id, credits);
#endif

// Pet
new item_pet[33], item_have[33], bool:g_has_speed[33], maxplayers;
static const pet_idle = 13, pet_run = 13, pet_die = 5;
static const Float:pet_idle_speed = 0.3;
static const Float:pet_run_speed = 10.0;
static const Float:player_gravity = 0.65;
new Float:item_leaptime[33];

//Models
new const DualKatanaModel_V[]		= "models/v_katanad.mdl";
new const DualKatanaModel_P[]		= "models/p_katanad.mdl";
new const HorseAxeModel_V[]		= "models/v_horseaxe.mdl";
new const HorseAxeModel_P[]		= "models/p_horseaxe.mdl";
new const pet_model[]			= "models/stukabat.mdl";

//Sounds
new const PICK_AMMO[]			= "items/9mmclip1.wav";
new const PACK_ENERGY[]			= "misc/fmu_energy.wav";
new const FLASH_SOUND[]			= "misc/ultrasound.mp3";

// Pet
static const pet_sounds[][] =
{
	"bullchicken/bc_die1.wav",
	"bullchicken/bc_die2.wav",
	"bullchicken/bc_die3.wav",
	"bullchicken/bc_idle1.wav",
	"bullchicken/bc_pain3.wav" 
};

//Sounds Knife
new const KatanaKnife_SoundList[][] =
{
	"weapons/knife_deploy1.wav",
	"weapons/knife_hit1.wav",
	"weapons/knife_hit2.wav",
	"weapons/knife_hitwall1.wav",
	"weapons/knife_slash1.wav",
	"weapons/knife_slash2.wav",
	"weapons/knife_stab.wav"
};

new const DualKatana_SoundList[][] =
{
	"weapons/katanad_draw.wav",
	"weapons/katanad_hit1.wav",
	"weapons/katanad_hit2.wav",
	"weapons/katanad_hitwall.wav",
	"weapons/katanad_slash1.wav",
	"weapons/katanad_slash2.wav",
	"weapons/katanad_stab.wav"
};

new const HorseAxeKnife_SoundList[][] =
{
	"weapons/knife_deploy1.wav",
	"weapons/knife_hit1.wav",
	"weapons/knife_hit2.wav",
	"weapons/knife_hitwall1.wav",
	"weapons/knife_slash1.wav",
	"weapons/knife_stab.wav"
};

new const HorseAxe_SoundList[][] =
{
	"weapons/hatchet_deploy1.wav",
	"weapons/hatchet1.wav",
	"weapons/hatchet2.wav",
	"weapons/hatchel_hwall.wav",
	"weapons/hatchet_slash1.wav",
	"weapons/hatchel_stab.wav"
};

//Boolean
new bool: g_HaveNoFlash[33];
new bool: g_HaveHorseAxe[33];
new bool: g_HaveDefuseKit[33];
new bool: g_HaveDualKatana[33];
new bool: g_HavePackEnergy[33];
new bool: g_HaveAnimalsPet[33];

//Vectors
new g_iMaxPlayers;
new g_msgScreenFade;

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, "Adventx");
	register_cvar("fmu_shop_*** Reclama ***", VERSION, FCVAR_SERVER | FCVAR_SPONLY);
	
	//Register Command
	register_clcmd("say shop","ClCmdShop");
	register_clcmd("say /shop","ClCmdShop");
	
	//Register Event's
	register_event("DeathMsg", "Event_DeathMsg", "a");
	register_event("HLTV","Event_NewRound", "a","1=0", "2=0");
	register_event("CurWeapon", "Event_CurrentWeapon", "be", "1=1");
	register_event("ScreenFade", "Event_Flash", "be", "4=255", "5=255", "6=255", "7>199");
	
	//Register Forward
	register_forward(FM_Think,"FM_Think_hook");
	register_forward(FM_EmitSound, "fw_EmitSounds");
	register_forward(FM_PlayerPreThink, "FM_PlayerPreThink_hook");
	
	//Register Hamsandwich
	RegisterHam(Ham_Spawn, "player", "hamPlayerSpawnPost", 1);
	RegisterHam(Ham_TakeDamage, "player", "Player_TakeDamage");
	
	//Vars
	g_iMaxPlayers = get_maxplayers();
	g_msgScreenFade = get_user_msgid("ScreenFade");
}

public plugin_precache()
{
	//Sound
	precache_sound(PICK_AMMO);
	precache_sound(PACK_ENERGY);
	precache_generic(FLASH_SOUND);
	
	//Hosrse Axe
	precache_model(HorseAxeModel_V);
	precache_model(HorseAxeModel_P);
	
	//Dual Katana
	precache_model(DualKatanaModel_V);
	precache_model(DualKatanaModel_P);
	
	static i;
	for(i = 0; i <= charsmax(DualKatana_SoundList); i++)
	{
		precache_sound(DualKatana_SoundList);
	}
	
	for(i = 0; i <= charsmax(HorseAxe_SoundList); i++)
	{
		precache_sound(HorseAxe_SoundList);
	}
	
	for(i = 0; i < sizeof pet_sounds; i++)
	{
		fm_precache_sound(pet_sounds);
	}
       
	fm_precache_model(pet_model);
}

public client_putinserver(id)
{
	g_HaveNoFlash[id] = false;
	g_HaveHorseAxe[id] = false;
	g_HaveDefuseKit[id] = false;
	g_HaveDualKatana[id] = false;
	g_HavePackEnergy[id] = false;
	g_HaveAnimalsPet[id] = false;
}

public client_disconnect(id)
{
	g_HaveNoFlash[id] = false;
	g_HaveHorseAxe[id] = false;
	g_HaveDefuseKit[id] = false;
	g_HaveDualKatana[id] = false;
	g_HavePackEnergy[id] = false;
	g_HaveAnimalsPet[id] = false;
}

public Event_NewRound()
{
	new entid = -1;
	
	while((entid = fm_find_ent_by_class(entid, "zp_bat")))
	{
		if(pev(entid,PET_FLAG) == PET_KILLED)
		{
			fm_remove_entity(entid);
		}              
	}      
}

public hamPlayerSpawnPost(id)
{
	if(is_user_alive(id))
	{
		if(get_user_team(id) == 1)
		{
			kill_pet(id);
			item_have[id] = 0;
		}
		
		if(get_user_team(id) == 2)
		{
			//Return Knife
			g_HaveHorseAxe[id] = false;
			g_HaveDualKatana[id] = false;
		
			//Defuse Kit
			if(g_HaveDefuseKit[id] == true)
			{
				cs_set_user_defuse(id, 0);
				g_HaveDefuseKit[id] = false;
			}
		}
		
		if(item_have[id])
		{
			fm_set_user_gravity(id, player_gravity);
			set_user_health(id, 200);
			set_user_armor(id, 200);
			g_has_speed[id] = true;
		}
	
		//Strip User Weapons
		strip_user_weapons(id);
	
		//Give Equipment
		FmuGiveEquipment(id);
	
		//Booleans
		g_HavePackEnergy[id] = false;
		g_HaveAnimalsPet[id] = false;
	}
}

public FmuGiveEquipment(id)
{
	if(is_user_alive(id))
	{
		if(get_user_team(id) == 1)
		{
			give_item(id, "weapon_knife");
			give_item(id, "weapon_hegrenade");
			give_item(id, "weapon_flashbang");
		}

		if(get_user_team(id) == 2)
		{
			give_item(id, "weapon_knife");
			give_item(id, "weapon_flashbang");
			give_item(id, "weapon_smokegrenade");
		}
	}
}

public ClCmdShop(id)
{
	if(get_user_team(id) == 1)
	{
		set_task(0.1, "FurienShop", id);
	}
	
	if(get_user_team(id) == 2)
	{
		set_task(0.1, "AntiFurienShop", id);
	}
}

public FurienShop(id)
{
	static credits;
	
	#if defined ASKHANAR_CREDITS
	credits = fcs_get_user_credits(id);
	#endif
			
	#if defined ARAGON_CREDITS
	credits = get_user_credits(id);
	#endif
	
	new szFormatex[128];
	formatex(szFormatex, charsmax(szFormatex), "\yFurien Shop \rECILA.RO^n\yCredite: \w%d", credits);
	
	new szMenu = menu_create(szFormatex, "FurienShopHandler");
	
	menu_additem(szMenu, "\y50 \wHP - \r[ \y5 Credite \r]", "1");
	menu_additem(szMenu, "\y50 \wAP - \r[ \y5 Credite \r]", "2");
	menu_additem(szMenu, "\yHE \wGrenade - \r[ \y10 Credite \r]^n", "3");
	
	menu_additem(szMenu, "\wNo Flash - \r[ \y15 Credite \r]", "4");
	menu_additem(szMenu, "\yPack \rEnergy \w - \r[ \y20 Credite \r]^n", "5");
	
	menu_additem(szMenu, "\yHorse Axe \w - \r[ \y25 Credite \r]", "6");
	menu_additem(szMenu, "\wDual Katana \w - \r[ \y30 Credite \r]", "7");
	
	menu_setprop(szMenu, MPROP_EXIT, MEXIT_ALL);
	menu_display(id, szMenu, 0);
	
	return PLUGIN_HANDLED;
}

public AntiFurienShop(id)
{
	static credits;
	
	#if defined ASKHANAR_CREDITS
	credits = fcs_get_user_credits(id);
	#endif
			
	#if defined ARAGON_CREDITS
	credits = get_user_credits(id);
	#endif
			
	new szFormatex[128];
	formatex(szFormatex, charsmax(szFormatex), "\yAntiFurien Shop \rECILA.RO^n\yCredite: \w%d", credits);
	
	new szMenu = menu_create(szFormatex, "AntiFurienShopHandler");
	
	menu_additem(szMenu, "\y50 \wHP - \r[ \y5 Credite \r]", "1");
	menu_additem(szMenu, "\y50 \wAP - \r[ \y5 Credite \r]", "2");
	menu_additem(szMenu, "\yHE \wGrenade - \r[ \y10 Credite \r]^n", "3");
	
	menu_additem(szMenu, "\wNo Flash - \r[ \y15 Credite \r]", "4");
	menu_additem(szMenu, "\yPack \rEnergy \w - \r[ \y20 Credite \r]^n", "5");
	
	menu_additem(szMenu, "\wDefuse Kit \w - \r[ \y10 Credite \r]", "6");
	menu_additem(szMenu, "\yAnimals \rPet \w - \r[ \y35 Credite \r]", "7");
	
	menu_setprop(szMenu, MPROP_EXIT, MEXIT_ALL);
	menu_display(id, szMenu, 0);
	
	return PLUGIN_HANDLED;
}

public FurienShopHandler(id, szMenu, item)
{
	if(item == MENU_EXIT || !is_user_alive(id))
	{
		return PLUGIN_HANDLED;
	}
	
	static credits;
	new data[6], szName[64];
	new access, callback;
	menu_item_getinfo(szMenu, item, access, data, charsmax(data), szName, charsmax(szName), callback);
	new key = str_to_num(data);
	
	switch(key)
	{
		case 1:
		{
			#if defined ASKHANAR_CREDITS
			credits = fcs_get_user_credits(id);
			#endif
			
			#if defined ARAGON_CREDITS
			credits = get_user_credits(id);
			#endif
			
			if(credits < 5)
			{
				ChatColor(id, "!g[Furien] !nYou don't have enough credits to buy !t50 HP");
				return PLUGIN_HANDLED;
			}
			
			if(get_user_health(id) >= 200)	//200 Health
			{	
				ChatColor(id, "!g[Furien] !nYou have reached your maximum !tHealth");
				return PLUGIN_HANDLED;
			}
			
			else
			{
				//Add Health
				set_user_health(id, min(get_user_health(id) + 50, 200));
				
				//Sound
				emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
				
				//Set/Get User Credits
				#if defined ASKHANAR_CREDITS
				fcs_set_user_credits(id, fcs_get_user_credits(id) - 5);
				#endif
				
				#if defined ARAGON_CREDITS
				set_user_credits(id, get_user_credits(id) - 5);
				#endif
				
				ChatColor(id, "!g[Furien] !nYou bought !t50 HP !nfor !t5 credits");
			}
		}
		
		case 2:
		{
			#if defined ASKHANAR_CREDITS
			credits = fcs_get_user_credits(id);
			#endif
			
			#if defined ARAGON_CREDITS
			credits = get_user_credits(id);
			#endif
				
			if(credits < 5)
			{
				ChatColor(id, "!g[Furien] !nYou don't have enough credits to buy !t50 AP");
				return PLUGIN_HANDLED;
			}
			
			if(get_user_armor(id) >= 150)	//150 Armor
			{
				ChatColor(id, "!g[Furien] !nYou have reached your maximum !tArmor");
				return PLUGIN_HANDLED;
			}
			
			else
			{
				//Add Armor
				set_user_armor(id, min(get_user_armor(id) + 50, 150));
				
				//Sound
				emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
				
				//Set/Get User Credits
				#if defined ASKHANAR_CREDITS
				fcs_set_user_credits(id, fcs_get_user_credits(id) - 5);
				#endif
				
				#if defined ARAGON_CREDITS
				set_user_credits(id, get_user_credits(id) - 5);
				#endif
				
				ChatColor(id, "!g[Furien] !nYou bought !t50 AP !nfor !t5 credits");
			}
		}
		
		case 3:
		{
			#if defined ASKHANAR_CREDITS
			credits = fcs_get_user_credits(id);
			#endif
			
			#if defined ARAGON_CREDITS
			credits = get_user_credits(id);
			#endif
			
			if(credits < 10)
			{
				ChatColor(id, "!g[Furien] !nYou don't have enough credits to buy !tHE Grenade");
				return PLUGIN_HANDLED;
			}
			
			if(user_has_weapon(id, CSW_HEGRENADE))
			{
				ChatColor(id, "!g[Furien] !nYou have already a !tHE Grenade");
				return PLUGIN_HANDLED;
			}
			
			else
			{
				//Give HE Grenade
				give_item(id, "weapon_hegrenade");
				
				//Set/Get User Credits
				#if defined ASKHANAR_CREDITS
				fcs_set_user_credits(id, fcs_get_user_credits(id) - 10);
				#endif
				
				#if defined ARAGON_CREDITS
				set_user_credits(id, get_user_credits(id) - 10);
				#endif
				
				ChatColor(id, "!g[Furien] !nYou bought !tHE Grenade !nfor !t10 credits");
			}
		}
		
		case 4:
		{
			#if defined ASKHANAR_CREDITS
			credits = fcs_get_user_credits(id);
			#endif
			
			#if defined ARAGON_CREDITS
			credits = get_user_credits(id);
			#endif
			
			if(credits < 15)
			{
				ChatColor(id, "!g[Furien] !nYou don't have enough credits to buy !tNo Flash");
				return PLUGIN_HANDLED;
			}
			
			if(g_HaveNoFlash[id] == true)
			{
				ChatColor(id, "!g[Furien] !nYou have already a !tNo Flash");
				return PLUGIN_HANDLED;
			}
			
			else
			{
				//Give No Flash
				g_HaveNoFlash[id] = true;
				
				//Sound
				emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
				
				//Set/Get User Credits
				#if defined ASKHANAR_CREDITS
				fcs_set_user_credits(id, fcs_get_user_credits(id) - 15);
				#endif
				
				#if defined ARAGON_CREDITS
				set_user_credits(id, get_user_credits(id) - 15);
				#endif
				
				ChatColor(id, "!g[Furien] !nYou bought !tNo Flash !nfor !t15 credits");
			}
		}
		
		case 5:
		{
			#if defined ASKHANAR_CREDITS
			credits = fcs_get_user_credits(id);
			#endif
			
			#if defined ARAGON_CREDITS
			credits = get_user_credits(id);
			#endif
			
			if(credits < 20)
			{
				ChatColor(id, "!g[Furien] !nYou don't have enough credits to buy !tPack Energy");
				return PLUGIN_HANDLED;
			}
			
			if(g_HavePackEnergy[id] == true)
			{
				ChatColor(id, "!g[Furien] !nYou have already a !tPack Energy");
				return PLUGIN_HANDLED;
			}
			
			else
			{
				//Set Health/Armor
				set_user_armor(id, 200);
				set_user_health(id, 200);
				
				//Set Boolean Pack Enegry
				g_HavePackEnergy[id] = true;
				
				//Add Effects
				ShakeScreen(id, 0.9);
				
				//Fade Screen
				FadeScreen(id, 0.5, 250, 110, 110, 100);
				
				//Sound
				emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
				
				//Set/Get User Credits
				#if defined ASKHANAR_CREDITS
				fcs_set_user_credits(id, fcs_get_user_credits(id) - 20);
				#endif
				
				#if defined ARAGON_CREDITS
				set_user_credits(id, get_user_credits(id) - 20);
				#endif
				
				ChatColor(id, "!g[Furien] !nYou bought !tPack Energy !nfor !t20 credits");
			}
		}
		
		case 6:
		{
			#if defined ASKHANAR_CREDITS
			credits = fcs_get_user_credits(id);
			#endif
			
			#if defined ARAGON_CREDITS
			credits = get_user_credits(id);
			#endif
			
			if(credits < 25)
			{
				ChatColor(id, "!g[Furien] !nYou don't have enough credits to buy !tHorse Axe");
				return PLUGIN_HANDLED;
			}
			
			if(g_HaveHorseAxe[id] == true)
			{
				ChatColor(id, "!g[Furien] !nYou have already a !tHorse Axe");
				return PLUGIN_HANDLED;
			}
			
			else
			{
				//Give Knife Horse Axe
				g_HaveHorseAxe[id] = true;
				
				//Return Dual Katana
				g_HaveDualKatana[id] = false;
				
				//Current Weapons
				Event_CurrentWeapon(id);
				
				//Sound
				emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
				
				//Set/Get User Credits
				#if defined ASKHANAR_CREDITS
				fcs_set_user_credits(id, fcs_get_user_credits(id) - 25);
				#endif
				
				#if defined ARAGON_CREDITS
				set_user_credits(id, get_user_credits(id) - 25);
				#endif
				
				ChatColor(id, "!g[Furien] !nYou bought !tHorse Axe !nfor !t25 credits");
			}
		}
		
		case 7:
		{
			#if defined ASKHANAR_CREDITS
			credits = fcs_get_user_credits(id);
			#endif
			
			#if defined ARAGON_CREDITS
			credits = get_user_credits(id);
			#endif
			
			if(credits < 30)
			{
				ChatColor(id, "!g[Furien] !nYou don't have enough credits to buy !tDual Katana");
				return PLUGIN_HANDLED;
			}
			
			if(g_HaveDualKatana[id] == true)
			{
				ChatColor(id, "!g[Furien] !nYou have already a !tDual Katana");
				return PLUGIN_HANDLED;
			}
			
			else
			{
				//Give Knife Horse Axe
				g_HaveDualKatana[id] = true;
				
				//Return Horse Axe
				g_HaveHorseAxe[id] = false;
				
				//Current Weapons
				Event_CurrentWeapon(id);
				
				//Sound
				emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
				
				//Set/Get User Credits
				#if defined ASKHANAR_CREDITS
				fcs_set_user_credits(id, fcs_get_user_credits(id) - 30);
				#endif
				
				#if defined ARAGON_CREDITS
				set_user_credits(id, get_user_credits(id) - 30);
				#endif
				
				ChatColor(id, "!g[Furien] !nYou bought !tDual Katana !nfor !t25 credits");
			}
		}
	}
	
	menu_destroy(szMenu);
	return PLUGIN_HANDLED;
}

public AntiFurienShopHandler(id, szMenu, item)
{
	if(item == MENU_EXIT || !is_user_alive(id))
	{
		return PLUGIN_HANDLED;
	}
	
	static credits;
	new data[6], szName[64];
	new access, callback;
	menu_item_getinfo(szMenu, item, access, data, charsmax(data), szName, charsmax(szName), callback);
	new key = str_to_num(data);
	
	switch(key)
	{
		case 1:
		{
			#if defined ASKHANAR_CREDITS
			credits = fcs_get_user_credits(id);
			#endif
			
			#if defined ARAGON_CREDITS
			credits = get_user_credits(id);
			#endif
			
			if(credits < 5)
			{
				ChatColor(id, "!g[AntiFurien] !nYou don't have enough credits to buy !t50 HP");
				return PLUGIN_HANDLED;
			}
			
			if(get_user_health(id) >= 200)	//250 Health
			{	
				ChatColor(id, "!g[AntiFurien] !nYou have reached your maximum !tHealth");
				return PLUGIN_HANDLED;
			}
			
			else
			{
				//Add Health
				set_user_health(id, min(get_user_health(id) + 50, 200));
				
				//Sound
				emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
				
				//Set/Get User Credits
				#if defined ASKHANAR_CREDITS
				fcs_set_user_credits(id, fcs_get_user_credits(id) - 5);
				#endif
				
				#if defined ARAGON_CREDITS
				set_user_credits(id, get_user_credits(id) - 5);
				#endif
				
				ChatColor(id, "!g[AntiFurien] !nYou bought !t50 HP !nfor !t5 credits");
			}
		}
		
		case 2:
		{
			#if defined ASKHANAR_CREDITS
			credits = fcs_get_user_credits(id);
			#endif
			
			#if defined ARAGON_CREDITS
			credits = get_user_credits(id);
			#endif
			
			if(credits < 5)
			{
				ChatColor(id, "!g[AntiFurien] !nYou don't have enough credits to buy !t50 AP");
				return PLUGIN_HANDLED;
			}
			
			if(get_user_armor(id) >= 200)	//200 Armor
			{
				ChatColor(id, "!g[AntiFurien] !nYou have reached your maximum !tArmor");
				return PLUGIN_HANDLED;
			}
			
			else
			{
				//Add Armor
				set_user_armor(id, min(get_user_armor(id) + 50, 200));
				
				//Sound
				emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
				
				//Set/Get User Credits
				#if defined ASKHANAR_CREDITS
				fcs_set_user_credits(id, fcs_get_user_credits(id) - 5);
				#endif
				
				#if defined ARAGON_CREDITS
				set_user_credits(id, get_user_credits(id) - 5);
				#endif
				
				ChatColor(id, "!g[AntiFurien] !nYou bought !t50 AP !nfor !t5 credits");
			}
		}
		
		case 3:
		{
			#if defined ASKHANAR_CREDITS
			credits = fcs_get_user_credits(id);
			#endif
			
			#if defined ARAGON_CREDITS
			credits = get_user_credits(id);
			#endif
			
			if(credits < 10)
			{
				ChatColor(id, "!g[AntiFurien] !nYou don't have enough credits to buy !tHE Grenade");
				return PLUGIN_HANDLED;
			}
			
			if(user_has_weapon(id, CSW_HEGRENADE))
			{
				ChatColor(id, "!g[AntiFurien] !nYou have already a !tHE Grenade");
				return PLUGIN_HANDLED;
			}
			
			else
			{
				//Give HE Grenade
				give_item(id, "weapon_hegrenade");
				
				//Set/Get User Credits
				#if defined ASKHANAR_CREDITS
				fcs_set_user_credits(id, fcs_get_user_credits(id) - 10);
				#endif
				
				#if defined ARAGON_CREDITS
				set_user_credits(id, get_user_credits(id) - 10);
				#endif
				
				ChatColor(id, "!g[AntiFurien] !nYou bought !tHE Grenade !nfor !t10 credits");
			}
		}
		
		case 4:
		{
			#if defined ASKHANAR_CREDITS
			credits = fcs_get_user_credits(id);
			#endif
			
			#if defined ARAGON_CREDITS
			credits = get_user_credits(id);
			#endif
			
			if(credits < 15)
			{
				ChatColor(id, "!g[AntiFurien] !nYou don't have enough credits to buy !tNo Flash");
				return PLUGIN_HANDLED;
			}
			
			if(g_HaveNoFlash[id] == true)
			{
				ChatColor(id, "!g[Furien] !nYou have already a !tNo Flash");
				return PLUGIN_HANDLED;
			}
			
			else
			{
				//Give No Flash
				g_HaveNoFlash[id] = true;
				
				//Sound
				emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
				
				//Set/Get User Credits
				#if defined ASKHANAR_CREDITS
				fcs_set_user_credits(id, fcs_get_user_credits(id) - 15);
				#endif
				
				#if defined ARAGON_CREDITS
				set_user_credits(id, get_user_credits(id) - 15);
				#endif
				
				ChatColor(id, "!g[AntiFurien] !nYou bought !tNo Flash !nfor !t15 credits");
			}
		}
		
		case 5:
		{	
			#if defined ASKHANAR_CREDITS
			credits = fcs_get_user_credits(id);
			#endif
			
			#if defined ARAGON_CREDITS
			credits = get_user_credits(id);
			#endif
			
			if(credits < 20)
			{
				ChatColor(id, "!g[AntiFurien] !nYou don't have enough credits to buy !tPack Energy");
				return PLUGIN_HANDLED;
			}
			
			if(g_HavePackEnergy[id] == true)
			{
				ChatColor(id, "!g[AntiFurien] !nYou have already a !tPack Energy");
				return PLUGIN_HANDLED;
			}
			
			if(g_HaveAnimalsPet[id] == true)
			{
				return PLUGIN_HANDLED;
			}
			
			else
			{
				//Add Effects
				ShakeScreen(id, 0.9);
				
				//Fade Screen
				FadeScreen(id, 0.5, 110, 250, 110, 100);
				
				//Set Health/Armor
				set_user_armor(id, 200);
				set_user_health(id, 200);
				
				//Set Boolean Pack Enegry
				g_HavePackEnergy[id] = true;
				
				//Sound
				emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
				
				//Set/Get User Credits
				#if defined ASKHANAR_CREDITS
				fcs_set_user_credits(id, fcs_get_user_credits(id) - 20);
				#endif
				
				#if defined ARAGON_CREDITS
				set_user_credits(id, get_user_credits(id) - 20);
				#endif
				
				ChatColor(id, "!g[AntiFurien] !nYou bought !tPack Energy !nfor !t20 credits");
			}
		}
		
		case 6:
		{
			#if defined ASKHANAR_CREDITS
			credits = fcs_get_user_credits(id);
			#endif
			
			#if defined ARAGON_CREDITS
			credits = get_user_credits(id);
			#endif
			
			if(credits < 10)
			{
				ChatColor(id, "!g[AntiFurien] !nYou don't have enough credits to buy !tDefuse Kit");
				return PLUGIN_HANDLED;
			}
			
			if(g_HaveDefuseKit[id] == true)
			{
				ChatColor(id, "!g[AntiFurien] !nYou have already a !tDefuse Kit");
				return PLUGIN_HANDLED;
			}
			
			else
			{
				//Give Defuse Kit
				g_HaveDefuseKit[id] = true;
				cs_set_user_defuse(id, 1);
				
				//Sound
				emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
				
				//Set/Get User Credits
				#if defined ASKHANAR_CREDITS
				fcs_set_user_credits(id, fcs_get_user_credits(id) - 10);
				#endif
				
				#if defined ARAGON_CREDITS
				set_user_credits(id, get_user_credits(id) - 10);
				#endif
				
				ChatColor(id, "!g[AntiFurien] !nYou bought !tDefuse Kit !nfor !t10 credits");
			}
		}
		
		case 7:
		{
			#if defined ASKHANAR_CREDITS
			credits = fcs_get_user_credits(id);
			#endif
			
			#if defined ARAGON_CREDITS
			credits = get_user_credits(id);
			#endif
			
			if(credits < 35)
			{
				ChatColor(id, "!g[AntiFurien] !nYou don't have enough credits to buy !tAnimals Pet");
				return PLUGIN_HANDLED;
			}
			
			if(item_have[id])
			{
				ChatColor(id, "!g[AntiFurien] !nYou have already a !tPet!");
				return PLUGIN_HANDLED;
			}
	
			if(g_HavePackEnergy[id] == true)
			{
				return PLUGIN_HANDLED;
			}
			
			else
			{
				//Fade Screen
				FadeScreen(id, 0.5, 0, 0, 150, 50);
				
				//Set Boolean
				g_HaveAnimalsPet[id] = true;
				
				// Create Pet
				create_pet(id);
				
				//Sound
				emit_sound(id, CHAN_ITEM, PICK_AMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
				
				//Set/Get User Credits
				#if defined ASKHANAR_CREDITS
				fcs_set_user_credits(id, fcs_get_user_credits(id) - 35);
				#endif
				
				#if defined ARAGON_CREDITS
				set_user_credits(id, get_user_credits(id) - 35);
				#endif
				
				ChatColor(id, "!g[AntiFurien] !nYou bought !tAnimals Pet !nfor !t35 credits");
			}
		}
	}
	
	menu_destroy(szMenu);
	return PLUGIN_HANDLED;
}

public Event_DeathMsg()
{
	new iVictim = read_data(2);
	
	g_HaveNoFlash[iVictim] = false;
	g_HaveHorseAxe[iVictim] = false;
	g_HaveDualKatana[iVictim] = false;
	
	if(item_have[iVictim])
	{
		kill_pet(iVictim);
		item_have[iVictim] = 0;
	}
               
	if(get_user_team(iVictim) == 2)
	{
		item_have[iVictim] = 0;
	}
       
	if(g_has_speed[iVictim])
	{
		g_has_speed[iVictim] = false;
	}
}

public FM_Think_hook(ent)
{
	for(new i = 0; i <= maxplayers; i++)
	{
		if(ent == item_pet)
		{
			static Float:origin[3];
			static Float:origin2[3];
			static Float:velocity[3];
			pev(ent,pev_origin,origin2);
			get_offset_origin_body(i,Float:{50.0,0.0,0.0},origin);
                       
			if(get_distance_f(origin,origin2) > 300.0)
			{
				set_pev(ent,pev_origin,origin);
			}
                       
			else if(get_distance_f(origin,origin2) > 80.0)
			{
				get_speed_vector(origin2,origin,250.0,velocity);
				set_pev(ent,pev_velocity,velocity);
				
				if(pev(ent,pev_sequence) != pet_run || pev(ent,pev_framerate) != pet_run_speed)
				{
					set_pev(ent,pev_sequence,pet_run);
					set_pev(ent,pev_gaitsequence,pet_run);
					set_pev(ent,pev_framerate,pet_run_speed);
				}
			}
                       
			else if(get_distance_f(origin,origin2) < 75.0)
			{
				if(pev(ent,pev_sequence) != pet_idle || pev(ent,pev_framerate) != pet_idle_speed)
				{
					set_pev(ent,pev_sequence,pet_idle);
					set_pev(ent,pev_gaitsequence,pet_idle);
					set_pev(ent,pev_framerate,pet_idle_speed);
				}
				
				set_pev(ent,pev_velocity,Float:{0.0,0.0,0.0});
			}
			
			pev(i,pev_origin,origin);
			origin[2] = origin2[2];
			entity_set_aim(ent,origin);                    
			set_pev(ent,pev_nextthink,1.0);
			break;
		}
	}
}

public FM_PlayerPreThink_hook(id)
{
	if (!is_user_alive(id))
		return;
       
	if(allowed_leap(id))
	{
		static Float:velocity[3];
		velocity_by_aim(id, 500, velocity);
               
		velocity[2] = 300.0;
               
		set_pev(id, pev_velocity, velocity);
               
		item_leaptime[id] = get_gametime();
	}
}

public allowed_leap(id)
{      
	if(!item_have[id])
	{
		return false;
	}
       
	if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80)
	{
		return false;
	}
       
	static buttons;
	buttons = pev(id, pev_button);
       
	if (!is_user_bot(id) && (!(buttons & IN_JUMP) || !(buttons & IN_DUCK)))
	{
		return false;
	}
       
	if (get_gametime() - item_leaptime[id] < 3)
	{
		return false;
	}
       
	return true;
}
 
public is_a_player(ent)
{
	if(ent > 0 && ent < 33)
	{
		return true;
	}
       
	return false;
}
 
public remove_pet(ent)
{
	if(pev_valid(ent))
	{
		fm_remove_entity(ent);
	}
}

public kill_pet(id)
{
	if(pev_valid(item_pet[id]))
	{
		set_pev(item_pet[id],pev_sequence,pet_die);
		set_pev(item_pet[id],pev_gaitsequence,pet_die);
		set_pev(item_pet[id],pev_framerate,1.0);
               
		set_pev(item_pet[id],PET_FLAG,PET_KILLED);
               
		fm_drop_to_floor(item_pet[id]);
               
		item_have[id] = 0;
		g_has_speed[id] = false;
	}
	
	item_pet[id] = 0;
}

public create_pet(id)
{
	item_pet[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString,"info_target"));
	set_pev(item_pet[id],pev_classname,"zp_bat");
               
	engfunc(EngFunc_SetModel,item_pet[id],pet_model);
               
	new Float:origin[3];
	pev(id,pev_origin,origin);                      
               
	set_pev(item_pet[id],pev_origin,origin);
	set_pev(item_pet[id],pev_solid,SOLID_TRIGGER);
	set_pev(item_pet[id],pev_movetype,MOVETYPE_FLY);
	set_pev(item_pet[id],pev_owner,33);
	set_pev(item_pet[id],pev_nextthink,1.0);
	set_pev(item_pet[id],pev_sequence,0);
	set_pev(item_pet[id],pev_gaitsequence,0);
	set_pev(item_pet[id],pev_framerate,1.0);
               
	set_pev(item_pet[id], pev_renderfx, kRenderFxGlowShell);
	set_pev(item_pet[id], pev_rendercolor, Float:{0.0, 0.0, 200.0});
               
	fm_set_user_gravity(id,player_gravity);
               
	set_user_health(id, 200);
	set_user_armor(id, 200);
               
	engfunc(EngFunc_EmitSound,item_pet[id],CHAN_AUTO,pet_sounds[random_num(0,sizeof pet_sounds - 1)],1.0, 1.2, 0, PITCH_NORM);
               
	item_have[id] = 1;
	g_has_speed[id] = true;
}

public Event_CurrentWeapon(id)
{
	if(g_HaveDualKatana[id] && get_user_weapon(id) == CSW_KNIFE)
	{
		set_pev(id, pev_viewmodel2, DualKatanaModel_V);
		set_pev(id, pev_weaponmodel2, DualKatanaModel_P);
	}
	
	if(g_HaveHorseAxe[id] && get_user_weapon(id) == CSW_KNIFE)
	{
		set_pev(id, pev_viewmodel2, HorseAxeModel_V);
		set_pev(id, pev_weaponmodel2, HorseAxeModel_P);
	}
}

public fw_EmitSounds(const id, const channel, const sample[])
{
	if(is_user_alive(id))
	{
		if(g_HaveDualKatana[id])
		{
			for(new i = 0; i < sizeof DualKatana_SoundList; i++)
			{
				if(equal(sample, KatanaKnife_SoundList))
				{
					emit_sound(id, channel, DualKatana_SoundList, 1.0, ATTN_NORM, 0, PITCH_NORM);
					return FMRES_SUPERCEDE;
				}
			}
		}
		
		if(g_HaveHorseAxe[id])
		{
			for(new i = 0; i < sizeof HorseAxe_SoundList; i++)
			{
				if(equal(sample, HorseAxeKnife_SoundList))
				{
					emit_sound(id, channel, HorseAxe_SoundList, 1.0, ATTN_NORM, 0, PITCH_NORM);
					return FMRES_SUPERCEDE;
				}
			}
		}
	}

	return FMRES_IGNORED;
}

public Player_TakeDamage(iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits)
{
	if(iInflictor == iAttacker && is_user_valid(iAttacker) && g_HaveHorseAxe[iAttacker] && is_user_connected(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE)
	{
		SetHamParamFloat(4, fDamage * 2.2);
		return HAM_HANDLED;
	}
	
	if(iInflictor == iAttacker && is_user_valid(iAttacker) && g_HaveDualKatana[iAttacker] && is_user_connected(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE )
	{
		SetHamParamFloat(4, fDamage * 2.0);
		return HAM_HANDLED;
	}
	
	return HAM_IGNORED;
}

public ShakeScreen(id, const Float:seconds)
{
	message_begin(MSG_ONE, get_user_msgid("ScreenShake"), {0, 0, 0}, id);
	write_short(floatround(4096.0 * seconds, floatround_round));
	write_short(floatround(4096.0 * seconds, floatround_round));
	write_short(1<<13);
	message_end();
}

public FadeScreen(id, const Float:seconds, const red, const green, const blue, const alpha)
{      
	message_begin(MSG_ONE, get_user_msgid("ScreenFade"), _, id);
	write_short(floatround(4096.0 * seconds, floatround_round));
	write_short(floatround(4096.0 * seconds, floatround_round));
	write_short(0x0000);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	write_byte(alpha);
	message_end( );
}

public Event_Flash(id)
{
	if(is_user_connected(id) && g_HaveNoFlash[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();
		
		ShakeScreen(id, 5.0);
		client_cmd(id, "mp3 play sound/%s", FLASH_SOUND);
		set_task(7.0, "StoppedSound", id);
	}
}

public StoppedSound(id)
{
	client_cmd(id, "mp3 stop sound/%s", FLASH_SOUND);
}

// Get entity's speed (from fakemeta_util)
stock fm_get_speed(entity)
{
	static Float:velocity[3];
	pev(entity, pev_velocity, velocity);
       
	return floatround(vector_length(velocity));
}

stock get_offset_origin_body(ent,const Float:offset[3],Float:origin[3])
{
	if(!pev_valid(ent))
	{
		return 0;
	}
       
	new Float:angle[3];
	pev(ent,pev_angles,angle);
       
	pev(ent,pev_origin,origin);
       
	origin[0] += floatcos(angle[1],degrees) * offset[0];
	origin[1] += floatsin(angle[1],degrees) * offset[0];
       
	origin[1] += floatcos(angle[1],degrees) * offset[1];
	origin[0] += floatsin(angle[1],degrees) * offset[1];
       
	return 1;
}
 
stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3])
{
	new_velocity[0] = origin2[0] - origin1[0];
	new_velocity[1] = origin2[1] - origin1[1];
	new_velocity[2] = origin2[2] - origin1[2];
	new Float:num = floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]));
	new_velocity[0] *= num;
	new_velocity[1] *= num;
	new_velocity[2] *= num;
       
	return 1;
}
 
stock entity_set_aim(ent,const Float:origin2[3],bone=0)
{
	if(!pev_valid(ent))
		return 0;
       
	static Float:origin[3];
	origin[0] = origin2[0];
	origin[1] = origin2[1];
	origin[2] = origin2[2];
       
	static Float:ent_origin[3], Float:angles[3];
       
	if(bone)
	{
		engfunc(EngFunc_GetBonePosition,ent,bone,ent_origin,angles);
	}
	
	else
	{
		pev(ent,pev_origin,ent_origin);
	}
       
	origin[0] -= ent_origin[0];
	origin[1] -= ent_origin[1];
	origin[2] -= ent_origin[2];
       
	static Float:v_length;
	v_length = vector_length(origin);
       
	static Float:aim_vector[3];
	aim_vector[0] = origin[0] / v_length;
	aim_vector[1] = origin[1] / v_length;
	aim_vector[2] = origin[2] / v_length;
       
	static Float:new_angles[3];
	vector_to_angle(aim_vector,new_angles);
       
	new_angles[0] *= -1;
       
	if(new_angles[1]>180.0) new_angles[1] -= 360;
	if(new_angles[1]<-180.0) new_angles[1] += 360;
	if(new_angles[1]==180.0 || new_angles[1]==-180.0) new_angles[1]=-179.999999;
       
	set_pev(ent,pev_angles,new_angles);
	set_pev(ent,pev_fixangle,1);
       
	return 1;
}

stock ChatColor(const id, const input[], any:...)
{
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
       
	replace_all(msg, 190, "!g", "^4"); // Green Color
	replace_all(msg, 190, "!n", "^1"); // Default Color
	replace_all(msg, 190, "!t", "^3"); // Team Color
	replace_all(msg, 190, "!t2", "^0"); // Team2 Color

	if (id) players[0] = id; else get_players(players, count, "ch"); {
		for (new i = 0; i < count; i++) {
			if (is_user_connected(players)) {
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
				write_byte(players[i]);
				write_string(msg);
				message_end();
			}
		}
        }
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/


Sau poate la pet e problema, uitati si .sma de la pet :
| Afiseaza codul
/* Plugin generated by AMXX-Studio */
 
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <hamsandwich>
#include <fun>


#define PLUGIN "Furien: Bat"
#define VERSION "1.0"
#define AUTHOR "Sn!ff3r"

native get_user_credits ( id );
native set_user_credits ( id, credits );


#define fm_precache_model(%1)           engfunc(EngFunc_PrecacheModel,%1)
#define fm_precache_sound(%1)           engfunc(EngFunc_PrecacheSound,%1)
#define fm_remove_entity(%1)            engfunc(EngFunc_RemoveEntity, %1)
#define fm_drop_to_floor(%1)            engfunc(EngFunc_DropToFloor,%1)
#define fm_find_ent_by_class(%1,%2)     engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
#define fm_set_user_gravity(%1,%2)      set_pev(%1,pev_gravity,%2)
 
#define PET_FLAG                        pev_flTimeStepSound
#define PET_KILLED                      389
 
static const pet_model[] = "models/stukabat.mdl"
static const pet_sounds[][] = { "bullchicken/bc_die1.wav", "bullchicken/bc_die2.wav", "bullchicken/bc_die3.wav", "bullchicken/bc_idle1.wav", "bullchicken/bc_pain3.wav" }
static const pet_idle = 13
static const pet_run = 13
static const pet_die = 5
static const Float:pet_idle_speed = 0.3
static const Float:pet_run_speed = 10.0
static const Float:player_gravity = 0.65
 
new item_pet[33]
new item_have[33]
new item_at_spawn[33]
new Float:item_leaptime[33]
new bool:g_has_speed[33]
 
new maxplayers, g_msgSayText
 
public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR)
       
        register_event("DeathMsg","DeathMsg","a")
        register_event("HLTV","HLTV", "a","1=0", "2=0")
       
        register_forward(FM_Think,"FM_Think_hook")
        register_forward(FM_PlayerPreThink, "FM_PlayerPreThink_hook")
       
        RegisterHam(Ham_Spawn, "player", "player_spawn", 1)    
        //RegisterHam(Ham_Touch, "info_target", "player_touch")
       
        register_clcmd("say /pet", "buypet")
        register_clcmd("say_team /pet", "buypet")
       
        maxplayers = get_maxplayers()
        g_msgSayText = get_user_msgid("SayText")
}
 
public plugin_natives()
        register_native("set_user_pet", "native_set_pet", 1)
       
public native_set_pet(id)
        buypet(id)
 
public plugin_precache()
{
        new i = 0
       
        for(i = 0; i < sizeof pet_sounds; i++)
                fm_precache_sound(pet_sounds[i])
       
        fm_precache_model(pet_model)
}
 
public HLTV()
{
        new entid = -1
        while((entid = fm_find_ent_by_class(entid, "zp_bat")))
        {
                if(pev(entid,PET_FLAG) == PET_KILLED)
                {
                        fm_remove_entity(entid)
                }              
        }      
}
 
public DeathMsg()
{
        new id = read_data(2)
       
        if(item_have[id])
        {
                kill_pet(id)
                item_have[id] = 0
        }
               
        if(cs_get_user_team(id) == CS_TEAM_T)
                item_have[id] = 0
       
        if(g_has_speed[id])
                g_has_speed[id] = false
}
 
public buypet(id)
{
        if (!is_user_alive(id))
        {
                client_printcolor(id, "^4[AntiFurien]^1 You must be alive to enter shop!");
                return PLUGIN_HANDLED;
        }
 
        if (cs_get_user_team(id) != CS_TEAM_CT)
        {
                return PLUGIN_HANDLED;
        }
       
        if (!item_have[id])
        {      
                if (get_user_credits(id) >= 20)
                {
                        set_user_credits(id, get_user_credits(id) - 20);
                        client_printcolor(id, "^4[AntiFurien]^1 You bought^3 Pet^1 for^3 20 credits");
                        create_pet(id)
                }else
                        client_printcolor(id, "^4[AntiFurien]^1 You don't have enough credits to buy^3 Pet");
        }else
                        client_printcolor(id, "^4[AntiFurien]^1 You have already a^3 Pet!");
               
        return PLUGIN_CONTINUE;
}
 
public kill_pet(id)
{
        if(pev_valid(item_pet[id]))
        {
                set_pev(item_pet[id],pev_sequence,pet_die)
                set_pev(item_pet[id],pev_gaitsequence,pet_die)
                set_pev(item_pet[id],pev_framerate,1.0)
               
                set_pev(item_pet[id],PET_FLAG,PET_KILLED)
               
                fm_drop_to_floor(item_pet[id])
               
                item_have[id] = 0
                g_has_speed[id] = false
        }      
        item_pet[id] = 0
}
 
public player_spawn(player)
{
        if(is_user_alive(player))
        {
                if (cs_get_user_team(player) != CS_TEAM_CT)
                {
                        kill_pet(player)
                        item_have[player] = 0
                }
                if(item_have[player])
                {
                        fm_set_user_gravity(player, player_gravity)
                        set_user_health(player, 200)
                        set_user_armor(player, 200)
                        g_has_speed[player] = true
                }
                else if(item_at_spawn[player])
                {
                        create_pet(player)
                        item_at_spawn[player] = 0
                        g_has_speed[player] = true
                }
        }
}
 
public create_pet(id)
{
        if(item_have[id])
        {
                client_printcolor(id, "^4[Ultimate Shop]^1 Detii deja un^3 pet.")
                return PLUGIN_HANDLED
        }
        else if(!is_user_alive(id))
        {
                client_printcolor(id, "^4[Ultimate Shop]^1 Petul iti va aparea runda viitoare.")
                item_at_spawn[id] = 1
                return PLUGIN_HANDLED
        }      
        else
        {
                item_pet[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString,"info_target"))
                set_pev(item_pet[id],pev_classname,"zp_bat")
               
                engfunc(EngFunc_SetModel,item_pet[id],pet_model)
               
                new Float:origin[3]
                pev(id,pev_origin,origin)                      
               
                set_pev(item_pet[id],pev_origin,origin)
                set_pev(item_pet[id],pev_solid,SOLID_TRIGGER)
                set_pev(item_pet[id],pev_movetype,MOVETYPE_FLY)
                set_pev(item_pet[id],pev_owner,33)
                set_pev(item_pet[id],pev_nextthink,1.0)
                set_pev(item_pet[id],pev_sequence,0)
                set_pev(item_pet[id],pev_gaitsequence,0)
                set_pev(item_pet[id],pev_framerate,1.0)
               
                set_pev(item_pet[id], pev_renderfx, kRenderFxGlowShell)
                set_pev(item_pet[id], pev_rendercolor, Float:{0.0, 0.0, 200.0})
               
                fm_set_user_gravity(id,player_gravity)
               
                set_user_health(id, 200)
                set_user_armor(id, 200)
               
                engfunc(EngFunc_EmitSound,item_pet[id],CHAN_AUTO,pet_sounds[random_num(0,sizeof pet_sounds - 1)],1.0, 1.2, 0, PITCH_NORM)              
               
                item_have[id] = 1
                g_has_speed[id] = true
        }
        return PLUGIN_HANDLED
}
 
public FM_Think_hook(ent)
{
        for(new i = 0; i <= maxplayers; i++)
        {
                if(ent == item_pet[i])
                {
                        static Float:origin[3]
                        static Float:origin2[3]
                        static Float:velocity[3]
                        pev(ent,pev_origin,origin2)
                        get_offset_origin_body(i,Float:{50.0,0.0,0.0},origin)
                       
                        if(get_distance_f(origin,origin2) > 300.0)
                        {
                                set_pev(ent,pev_origin,origin)
                        }
                       
                        else if(get_distance_f(origin,origin2) > 80.0)
                        {
                                get_speed_vector(origin2,origin,250.0,velocity)
                                set_pev(ent,pev_velocity,velocity)
                                if(pev(ent,pev_sequence) != pet_run || pev(ent,pev_framerate) != pet_run_speed)
                                {
                                        set_pev(ent,pev_sequence,pet_run)
                                        set_pev(ent,pev_gaitsequence,pet_run)
                                        set_pev(ent,pev_framerate,pet_run_speed)
                                }
                        }
                       
                        else if(get_distance_f(origin,origin2) < 75.0)
                        {
                                if(pev(ent,pev_sequence) != pet_idle || pev(ent,pev_framerate) != pet_idle_speed)
                                {
                                        set_pev(ent,pev_sequence,pet_idle)
                                        set_pev(ent,pev_gaitsequence,pet_idle)
                                        set_pev(ent,pev_framerate,pet_idle_speed)
                                }
                                set_pev(ent,pev_velocity,Float:{0.0,0.0,0.0})
                        }
                        pev(i,pev_origin,origin)
                        origin[2] = origin2[2]
                        entity_set_aim(ent,origin)                     
                        set_pev(ent,pev_nextthink,1.0)
                        break
                }
        }
}
 
public FM_PlayerPreThink_hook(id)
{
        if (!is_user_alive(id))
                return
       
        if(allowed_leap(id))
        {
                static Float:velocity[3]
                velocity_by_aim(id, 500, velocity)
               
                velocity[2] = 300.0
               
                set_pev(id, pev_velocity, velocity)
               
                item_leaptime[id] = get_gametime()
        }
}
 
public allowed_leap(id)
{      
        if(!item_have[id])
                return false
       
        if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80)
                return false
       
        static buttons
        buttons = pev(id, pev_button)
       
        if (!is_user_bot(id) && (!(buttons & IN_JUMP) || !(buttons & IN_DUCK)))
                return false
       
        if (get_gametime() - item_leaptime[id] < 3)
                return false
       
        return true
}
 
public is_a_player(ent)
{
        if(ent > 0 && ent < 33)
                return true
       
        return false
}
 
public remove_pet(ent)
{
        if(pev_valid(ent))
                fm_remove_entity(ent)
}
 
// Get entity's speed (from fakemeta_util)
stock fm_get_speed(entity)
{
        static Float:velocity[3]
        pev(entity, pev_velocity, velocity)
       
        return floatround(vector_length(velocity));
}
stock get_offset_origin_body(ent,const Float:offset[3],Float:origin[3])
{
        if(!pev_valid(ent))
                return 0;
       
        new Float:angle[3]
        pev(ent,pev_angles,angle)
       
        pev(ent,pev_origin,origin)
       
        origin[0] += floatcos(angle[1],degrees) * offset[0]
        origin[1] += floatsin(angle[1],degrees) * offset[0]
       
        origin[1] += floatcos(angle[1],degrees) * offset[1]
        origin[0] += floatsin(angle[1],degrees) * offset[1]
       
        return 1;
}
 
stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3])
{
        new_velocity[0] = origin2[0] - origin1[0]
        new_velocity[1] = origin2[1] - origin1[1]
        new_velocity[2] = origin2[2] - origin1[2]
        new Float:num = floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
        new_velocity[0] *= num
        new_velocity[1] *= num
        new_velocity[2] *= num
       
        return 1;
}
 
stock entity_set_aim(ent,const Float:origin2[3],bone=0)
{
        if(!pev_valid(ent))
                return 0;
       
        static Float:origin[3]
        origin[0] = origin2[0]
        origin[1] = origin2[1]
        origin[2] = origin2[2]
       
        static Float:ent_origin[3], Float:angles[3]
       
        if(bone)
                engfunc(EngFunc_GetBonePosition,ent,bone,ent_origin,angles)
        else
                pev(ent,pev_origin,ent_origin)
       
        origin[0] -= ent_origin[0]
        origin[1] -= ent_origin[1]
        origin[2] -= ent_origin[2]
       
        static Float:v_length
        v_length = vector_length(origin)
       
        static Float:aim_vector[3]
        aim_vector[0] = origin[0] / v_length
        aim_vector[1] = origin[1] / v_length
        aim_vector[2] = origin[2] / v_length
       
        static Float:new_angles[3]
        vector_to_angle(aim_vector,new_angles)
       
        new_angles[0] *= -1
       
        if(new_angles[1]>180.0) new_angles[1] -= 360
        if(new_angles[1]<-180.0) new_angles[1] += 360
        if(new_angles[1]==180.0 || new_angles[1]==-180.0) new_angles[1]=-179.999999
       
        set_pev(ent,pev_angles,new_angles)
        set_pev(ent,pev_fixangle,1)
       
        return 1;
}
 
stock client_printcolor(id, const input[], any:...)
{
        static iPlayersNum[32], iCount; iCount = 1
        static szMsg[191]
       
        vformat(szMsg, charsmax(szMsg), input, 3)
       
        replace_all(szMsg, 190, "/g", "^4") // green txt
        replace_all(szMsg, 190, "/y", "^1") // orange txt
        replace_all(szMsg, 190, "/ctr", "^3") // team txt
        replace_all(szMsg, 190, "/w", "^0") // team txt
       
        if(id) iPlayersNum[0] = id
        else get_players(iPlayersNum, iCount, "ch")
               
        for (new i = 0; i < iCount; i++)
        {
                if (is_user_connected(iPlayersNum[i]))
                {
                        message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, iPlayersNum[i])
                        write_byte(iPlayersNum[i])
                        write_string(szMsg)
                        message_end()
                }
        }
}
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests