Eroare[rezolvat]

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Post Reply
mezzzu
Membru eXtream
Membru eXtream
Posts: 2235
Joined: 19 Dec 2010, 17:31
Detinator Steam: Da
CS Status: Working...
Reputatie: Utilizator neserios (tepar)
Fost manager FURIEN.EXTREAMCS.COM
Restrictie moderator
Has thanked: 85 times
Been thanked: 137 times

29 Jun 2013, 11:50

Cateva erori in cadouri
Last edited by mezzzu on 29 Jun 2013, 12:34, edited 2 times in total.
RoyalServer 2
Onoare
Membru, skill +1
Membru, skill +1
Posts: 234
Joined: 31 May 2013, 13:23
Detinator Steam: Nu
CS Status: Sa traiesc!
Detinator server CS: Da
SteamID: Nu te priveste!
Location: Rm Valcea
Has thanked: 18 times
Been thanked: 34 times
Contact:

29 Jun 2013, 12:01

Posteaza sursa de la bonusbox
mezzzu
Membru eXtream
Membru eXtream
Posts: 2235
Joined: 19 Dec 2010, 17:31
Detinator Steam: Da
CS Status: Working...
Reputatie: Utilizator neserios (tepar)
Fost manager FURIEN.EXTREAMCS.COM
Restrictie moderator
Has thanked: 85 times
Been thanked: 137 times

29 Jun 2013, 12:06

Am eu un BonusBox care ar trebui sa dea credite ...dar culmea e ca nu da :))
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <fun>
#include <hamsandwich>
#include <colorchat>

#define PLUGIN "Bonus Box"
#define VERSION "1.0"
#define AUTHOR "Aragon*"

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

new HaveGift[33];
new CvarMaxBox, CvarFurienSpeed, CvarAntiFurienSpeed;
new bool:HasSpeed[33], bool:HasTeleport[33];
new const ClassName[] = "BonusBox"
new Model[2][] = {
	"models/CadouTb.mdl",
	"models/CadouCTb.mdl"
}

new Sprite, Sprite2
new Teleport_Cooldown[33]
new CvarTeleportCooldown, CvarTeleportRange, CvarFadeTime, CvarColor
new const SOUND_BLINK[] = { "weapons/flashbang-1.wav" }
const UNIT_SEC = 0x1000
const FFADE = 0x0000
new Float:LastMessage[33]

#define FFADE_IN		0x0000		// Just here so we don't pass 0 into the function
#define FFADE_OUT		0x0001		// Fade out (not in)
#define FFADE_MODULATE		0x0002		// Modulate (don't blend)
#define FFADE_STAYOUT		0x0004		// ignores the duration, stays faded out until new ScreenFade message received
enum {
	Red,
	Green,
	Blue
};
static const ServerLicensedIp[ ] = "93.119.26.125";

public plugin_init()
{	
	new ServerIp[ 22 ];
	get_user_ip( 0, ServerIp, sizeof ( ServerIp ) -1, 1 );
	
	if( equal( ServerIp, ServerLicensedIp ) )
	{
		register_plugin( PLUGIN, VERSION, AUTHOR );

		server_print( "%s Felicitari! Detii o licenta valida, iar pluginul functioneaza perfect !", PLUGIN );
		server_print( "%s Pentru mai multe detalii Y!M: Mihai.Parkour10 !", PLUGIN );
		server_print( "%s Ip-ul Licentiat: %s, Ip-ul Serverului: %s", PLUGIN, ServerIp, ServerLicensedIp );
	}
        else
	{
		register_plugin( PLUGIN, VERSION, AUTHOR );
		
		server_print( "%s Nu detii o licenta valabila ! Plugin-ul nu va functiona !", PLUGIN );
		server_print( "%s Pentru mai multe detalii Y!M: Mihai.Parkour10 !", PLUGIN );
		server_print( "%s Ip-ul Licentiat: %s, Ip-ul Serverului: %s", PLUGIN, ServerIp, ServerLicensedIp );
		
		pause( "ade" );
	}  
	register_event("HLTV", "RoundStart", "a", "1=0", "2=0")
	register_event("CurWeapon", "event_cur_weapon", "be", "1=1");
	register_event("DeathMsg", "Death", "a")
	RegisterHam(Ham_Spawn, "player", "Spawn", 1);	
	register_forward(FM_Touch, "Touch")
	register_think(ClassName, "Think")
	CvarMaxBox = register_cvar("amx_bonusbox_max_box", "5");
	CvarFurienSpeed = register_cvar("amx_bonusbox_furien_speed", "850");
	CvarAntiFurienSpeed = register_cvar("amx_bonusbox_anitfurien_speed", "400");
	CvarTeleportCooldown = register_cvar("bh_teleport_cooldown", "10")
	CvarTeleportRange = register_cvar("bh_bonusbox_teleport_range", "123456789")
	CvarFadeTime = register_cvar("amx_bonusbox_teleport_fadetime", "1.5")
	CvarColor = register_cvar("amx_bonusbox_teleport_color", "000000255")
	register_clcmd("power2", "CmdTeleport");
}

public plugin_precache() {
	for (new i = 0; i < sizeof Model; i++)
		precache_model(Model)
	
	Sprite = precache_model( "sprites/shockwave.spr")
	Sprite2 = precache_model( "sprites/blueflare2.spr")
}


public RoundStart()
{
	new ent = FM_NULLENT
	static string_class[] = "classname"
	while ((ent = engfunc(EngFunc_FindEntityByString, ent, string_class, ClassName))) 
		set_pev(ent, pev_flags, FL_KILLME)
	
	for(new id = 1; id < get_maxplayers();id++) {
		HasSpeed[id] = false
		HasTeleport[id] = false	
		HaveGift[id] = false
	}
	
}

public Spawn(id) {
	HasSpeed[id] = false
	HasTeleport[id] = false	
	HaveGift[id] = false
}

public Death()
{
	new victim = read_data(2);
	AddBonusBox(victim)
	return HAM_IGNORED
}


public AddBonusBox(id)
{
	if(is_user_connected(id) && cs_get_user_team(id) != CS_TEAM_SPECTATOR) {
		new ent = fm_create_entity("info_target")
		new origin[3]
		get_user_origin(id, origin, 0)
		set_pev(ent,pev_classname, ClassName)
		switch(cs_get_user_team(id))
		{
			case CS_TEAM_T: { 
				engfunc(EngFunc_SetModel,ent, Model[1])
				set_pev(ent,pev_team, 2)
			}
			
			case CS_TEAM_CT: {
				engfunc(EngFunc_SetModel,ent, Model[0])	
				set_pev(ent,pev_team, 1)
			}
		}
		new Float:fOrigin[3]
		IVecFVec(origin, fOrigin)
		set_pev(ent, pev_origin, fOrigin)
		set_pev(ent,pev_solid,SOLID_BBOX)
		set_pev(ent,pev_movetype,MOVETYPE_TOSS)
		engfunc(EngFunc_SetSize,ent,Float:{-10.0, -10.0, -25.0},Float:{10.0, 10.0, 25.0})
		engfunc(EngFunc_DropToFloor, ent)
		set_pev(ent, pev_nextthink, halflife_time() + 0.01)
	}
}

public Think(entity) 
{ 
	static Float:angles[3] 
	entity_get_vector(entity,EV_VEC_angles,angles) 
	
	angles[1]-- 
	
	entity_set_vector(entity,EV_VEC_angles,angles) 
	
	entity_set_float(entity,EV_FL_nextthink,halflife_time() + 0.01)
} 

public Touch(toucher, touched)
{
	if (!is_user_alive(toucher) || !pev_valid(touched))
		return FMRES_IGNORED
	
	new classname[32]	
	pev(touched, pev_classname, classname, 31)
	if (!equal(classname, ClassName))
		return FMRES_IGNORED
	
	if(get_user_team(toucher) == pev(touched, pev_team))
	{
		if(HaveGift[toucher] >= get_pcvar_num(CvarMaxBox)) {
			if(LastMessage[toucher] < get_gametime()) {
				LastMessage[toucher] = get_gametime() + 2.0
				ColorChat(toucher, "!t[Furien]!g Poti lua maxim!t %d!g cadouri pe runda.",get_pcvar_num(CvarMaxBox));
			}
			return FMRES_IGNORED
		}
		GiveBonus(toucher)
		set_pev(touched, pev_effects, EF_NODRAW)
		set_pev(touched, pev_solid, SOLID_NOT)
		remove_entity(touched);
	}
	return FMRES_IGNORED
}

public event_cur_weapon(id) {
	if(HasSpeed[id] && cs_get_user_team(id) == CS_TEAM_T && get_user_maxspeed(id) < get_pcvar_float(CvarFurienSpeed)) {
		set_user_maxspeed(id, get_pcvar_float(CvarFurienSpeed));
	}
	if(HasSpeed[id] && cs_get_user_team(id) == CS_TEAM_CT && get_user_maxspeed(id) < get_pcvar_float(CvarAntiFurienSpeed)) {
		set_user_maxspeed(id, get_pcvar_float(CvarAntiFurienSpeed));
	}
}

public GiveBonus(id)
{	
	if(cs_get_user_team(id) == CS_TEAM_T) 
	{
		switch (random_num(1,5)) 
		{
			case 1: 
			{
				HaveGift[id] += 1;
				new Health = random_num(10, 50)
				fm_set_user_health(id, get_user_health(id) + Health)
				ColorChat(id, "!t[FurienTreasure]!g Ai primit!t %d HP!g in plus fata de cat aveai inainte !", Health)
			}
			case 2:
			{
				HaveGift[id] += 1;
				if(!user_has_weapon(id, CSW_HEGRENADE)) {
					fm_give_item(id, "weapon_hegrenade")
				}
				else {
					cs_set_user_bpammo(id, CSW_HEGRENADE, cs_get_user_bpammo(id, CSW_HEGRENADE) + 1);
				}
				ColorChat(id, "!t[FurienTreasure]!g Ai primit o grenada!t HE")
			}
			case 3:
			{
				if(!HasSpeed[id]) {
				HaveGift[id] += 1;
				HasSpeed[id] = true;
				client_cmd(id, "cl_sidespeed %d",get_pcvar_float(CvarFurienSpeed))
				client_cmd(id, "cl_forwardspeed %d",get_pcvar_float(CvarFurienSpeed))
				client_cmd(id, "cl_backspeed %d",get_pcvar_float(CvarFurienSpeed))
				set_user_maxspeed(id, get_pcvar_float(CvarFurienSpeed));
				ColorChat(id, "!t[FurienTreasure]!g Poti alerga mult mai repede !")
				}
				else GiveBonus(id)
				
			}
			case 4: 
			{
				new Credite = random_num(1, 2)
				set_user_credits(id, get_user_credits(id) + Credite)
				ColorChat(id, "!t[Bonus Box]!g Ai primit!t %d Credit%s.", Credite > 1 ? "e" : "")
			}	
			case 5:
			{
				HaveGift[id] += 1;
				new Money = random_num(3000, 4500)
				cs_set_user_money(id, cs_get_user_money(id) + Money)
				ColorChat(id, "!t[FurienTreasure]!g Ai primit!t %d$", Money)
			}
		}
	}
	else
	{
		switch (random_num(1,5)) 
		{
			
			case 1: 
			{
				HaveGift[id] += 1;
				new Health = random_num(10, 50)
				fm_set_user_health(id, get_user_health(id) + Health)
				ColorChat(id, "!t[FurienTreasure]!g Ai primit!t %d HP!g in plus fata de cat aveai inainte !", Health)
			}
			case 2:
			{
				HaveGift[id] += 1;
				if(!user_has_weapon(id, CSW_HEGRENADE)) {
					fm_give_item(id, "weapon_hegrenade")
				}
				else {
					cs_set_user_bpammo(id, CSW_HEGRENADE, cs_get_user_bpammo(id, CSW_HEGRENADE) + 1);
				}
				ColorChat(id, "!t[FurienTreasure]!g Ai primit o grenada!t HE")
			}
			case 3:
			{
				if(!HasSpeed[id]) {
				HaveGift[id] += 1;
				HasSpeed[id] = true;
				client_cmd(id, "cl_sidespeed %d",get_pcvar_float(CvarAntiFurienSpeed))
				client_cmd(id, "cl_forwardspeed %d",get_pcvar_float(CvarAntiFurienSpeed))
				client_cmd(id, "cl_backspeed %d",get_pcvar_float(CvarAntiFurienSpeed))
				set_user_maxspeed(id, get_pcvar_float(CvarAntiFurienSpeed));
				ColorChat(id, "!t[FurienTreasure]!g Poti alerga mult mai repede !")
				}
				else GiveBonus(id)
				
			}
			case 4: 
			{
				new Credite = random_num(1, 2)
				set_user_credits(id, get_user_credits(id) + Credite)
				ColorChat(id, "!t[Bonus Box]!g Ai primit!t %d Credit%s.", Credite > 1 ? "e" : "")
			}
			case 5:
			{
				HaveGift[id] += 1;
				new Money = random_num(4000, 5500)
				cs_set_user_money(id, cs_get_user_money(id) + Money)
				ColorChat(id, "!t[FurienTreasure]!g Ai primit!t %d$", Money)
			}	

		}
		
	}
	
}


public CmdTeleport(id) {
	if (!is_user_alive(id) || !HasTeleport[id]) return PLUGIN_CONTINUE
	
	if (Teleport_Cooldown[id]) {
		ColorChat(id,"!t[Furien]!g Puterea iti va reveni in!t %d secunde.",Teleport_Cooldown[id]);
		return PLUGIN_CONTINUE
	}
	else if (teleport(id)) {
		emit_sound(id, CHAN_STATIC, SOUND_BLINK, 1.0, ATTN_NORM, 0, PITCH_NORM)
		remove_task(id)
		Teleport_Cooldown[id] = get_pcvar_num(CvarTeleportCooldown);
		set_task(1.0, "ShowHUD", id, _, _, "b");
		set_hudmessage(0, 100, 200, 0.05, 0.60, 0, 1.0, 1.1, 0.0, 0.0, -11);
		if(get_pcvar_num(CvarTeleportCooldown) != 1) {
			show_hudmessage(id, "Puterea iti va reveni in: %d secunde",get_pcvar_num(CvarTeleportCooldown));
		}
		if(get_pcvar_num(CvarTeleportCooldown) == 1) {
			show_hudmessage(id, "Puterea iti va reveni in: %d secunda",get_pcvar_num(CvarTeleportCooldown));
		}
	}
	else {
		ColorChat(id, "!t[Furien]!g Pozitia de teleportare este invalida.")
	}
	return PLUGIN_CONTINUE
}

public ShowHUD(id) {
	if (!is_user_alive(id) || !HasTeleport[id]) {
		remove_task(id);
		Teleport_Cooldown[id] = 0;
		return PLUGIN_HANDLED;
	}
	set_hudmessage(0, 100, 200, 0.05, 0.60, 0, 1.0, 1.1, 0.0, 0.0, -11);
	if(is_user_alive(id) && Teleport_Cooldown[id] == 1) {
		Teleport_Cooldown[id] --;
		show_hudmessage(id, "Puterea iti va reveni in: %d secunda",Teleport_Cooldown[id]);
	}
	if(is_user_alive(id) && Teleport_Cooldown[id] > 1) {
		Teleport_Cooldown[id] --;
		show_hudmessage(id, "Puterea iti va reveni in: %d secunde",Teleport_Cooldown[id]);
	}
	if(Teleport_Cooldown[id] <= 0) {
		show_hudmessage(id, "Ti-a revenit puterea");
		ColorChat(id,"!t[Furien]!g Iti poti folosi din nou puterea.");
		remove_task(id);
		Teleport_Cooldown[id] = 0;
	}
	return PLUGIN_HANDLED;
}


bool:teleport(id) {
	new Float:vOrigin[3], Float:vNewOrigin[3],
	Float:vNormal[3], Float:vTraceDirection[3],
	Float:vTraceEnd[3];
	
	pev(id, pev_origin, vOrigin);
	
	velocity_by_aim(id, get_pcvar_num(CvarTeleportRange), vTraceDirection);
	xs_vec_add(vTraceDirection, vOrigin, vTraceEnd);
	
	engfunc(EngFunc_TraceLine, vOrigin, vTraceEnd, DONT_IGNORE_MONSTERS, id, 0);
	
	new Float:flFraction;
	get_tr2(0, TR_flFraction, flFraction);
	if (flFraction < 1.0) {
		get_tr2(0, TR_vecEndPos, vTraceEnd);
		get_tr2(0, TR_vecPlaneNormal, vNormal);
	}
	
	xs_vec_mul_scalar(vNormal, 40.0, vNormal); // do not decrease the 40.0
	xs_vec_add(vTraceEnd, vNormal, vNewOrigin);
	
	if (is_player_stuck(id, vNewOrigin))
		return false;
	
	emit_sound(id, CHAN_STATIC, SOUND_BLINK, 1.0, ATTN_NORM, 0, PITCH_NORM);
	tele_effect(vOrigin);
	
	engfunc(EngFunc_SetOrigin, id, vNewOrigin);
	
	tele_effect2(vNewOrigin);
	
	if(is_user_connected(id)) {
		UTIL_ScreenFade(id, get_color(CvarColor), get_pcvar_float(CvarFadeTime), get_pcvar_float(CvarFadeTime), 75)
	}
	return true;
}

stock is_player_stuck(id, Float:originF[3]) {
	engfunc(EngFunc_TraceHull, originF, originF, 0, (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN, id, 0);
	
	if (get_tr2(0, TR_StartSolid) || get_tr2(0, TR_AllSolid) || !get_tr2(0, TR_InOpen))
		return true;
	
	return false;
}

stock tele_effect(const Float:torigin[3]) {
	new origin[3];
	origin[0] = floatround(torigin[0]);
	origin[1] = floatround(torigin[1]);
	origin[2] = floatround(torigin[2]);
	
	message_begin(MSG_PAS, SVC_TEMPENTITY, origin);
	write_byte(TE_BEAMCYLINDER);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]+10);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]+60);
	write_short(Sprite);
	write_byte(0);
	write_byte(0);
	write_byte(3);
	write_byte(60);
	write_byte(0);
	write_byte(255);
	write_byte(255);
	write_byte(255);
	write_byte(255);
	write_byte(0);
	message_end();
}

stock tele_effect2(const Float:torigin[3]) {
	new origin[3];
	origin[0] = floatround(torigin[0]);
	origin[1] = floatround(torigin[1]);
	origin[2] = floatround(torigin[2]);
	
	message_begin(MSG_PAS, SVC_TEMPENTITY, origin);
	write_byte(TE_BEAMCYLINDER);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]+10);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]+60);
	write_short(Sprite);
	write_byte(0);
	write_byte(0);
	write_byte(3);
	write_byte(60);
	write_byte(0);
	write_byte(255);
	write_byte(255);
	write_byte(255);
	write_byte(255);
	write_byte(0);
	message_end();
	
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
	write_byte(TE_SPRITETRAIL);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]+40);
	write_coord(origin[0]);
	write_coord(origin[1]);
	write_coord(origin[2]);
	write_short(Sprite2);
	write_byte(30);
	write_byte(10);
	write_byte(1);
	write_byte(50);
	write_byte(10);
	message_end();
}	

get_color(pcvar) {
	new iColor[3], szColor[10]
	get_pcvar_string(pcvar, szColor, charsmax(szColor))
	new c = str_to_num(szColor)
	
	iColor[Red] = c / 1000000
	c %= 1000000
	iColor[Green] = c / 1000
	iColor[Blue] = c % 1000
	
	return iColor
}

stock FixedUnsigned16(Float:flValue, iScale) {
	new iOutput;
	
	iOutput = floatround(flValue * iScale);
	if ( iOutput < 0 )
		iOutput = 0;
	
	if ( iOutput > 0xFFFF )
		iOutput = 0xFFFF;
	return iOutput;
}

stock UTIL_ScreenFade(id=0,iColor[3]={0,0,0},Float:flFxTime=-1.0,Float:flHoldTime=0.0,iAlpha=0,iFlags=FFADE_IN,bool:bReliable=false,bool:bExternal=false) {
	if( id && !is_user_connected(id))
		return;
	
	new iFadeTime;
	if( flFxTime == -1.0 ) {
		iFadeTime = 4;
	}
	else {
		iFadeTime = FixedUnsigned16( flFxTime , 1<<12 );
	}
	
	static gmsgScreenFade;
	if( !gmsgScreenFade ) {
		gmsgScreenFade = get_user_msgid("ScreenFade");
	}
	
	new MSG_DEST;
	if( bReliable ) {
		MSG_DEST = id ? MSG_ONE : MSG_ALL;
	}
	else {
		MSG_DEST = id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST;
	}
	
	if( bExternal ) {
		emessage_begin( MSG_DEST, gmsgScreenFade, _, id );
		ewrite_short( iFadeTime );
		ewrite_short( FixedUnsigned16( flHoldTime , 1<<12 ) );
		ewrite_short( iFlags );
		ewrite_byte( iColor[Red] );
		ewrite_byte( iColor[Green] );
		ewrite_byte( iColor[Blue] );
		ewrite_byte( iAlpha );
		emessage_end();
	}
	else {
		message_begin( MSG_DEST, gmsgScreenFade, _, id );
		write_short( iFadeTime );
		write_short( FixedUnsigned16( flHoldTime , 1<<12 ) );
		write_short( iFlags );
		write_byte( iColor[Red] );
		write_byte( iColor[Green] );
		write_byte( iColor[Blue] );
		write_byte( iAlpha );
		message_end();
	}
}

stock UTIL_FadeToBlack(id,Float:fxtime=3.0,bool:bReliable=false,bool:bExternal=false) {
	UTIL_ScreenFade(id, _, fxtime, fxtime, 255, FFADE_OUT|FFADE_STAYOUT,bReliable,bExternal);
}

stock ColorChat(const id, const input[], any:...) {
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!g", "^4");
	replace_all(msg, 190, "!y", "^1");
	replace_all(msg, 190, "!t", "^3");
	
	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);
				write_string(msg);
				message_end();
			}
		}
	} 
}
Onoare
Membru, skill +1
Membru, skill +1
Posts: 234
Joined: 31 May 2013, 13:23
Detinator Steam: Nu
CS Status: Sa traiesc!
Detinator server CS: Da
SteamID: Nu te priveste!
Location: Rm Valcea
Has thanked: 18 times
Been thanked: 34 times
Contact:

29 Jun 2013, 12:13

Da-mi originalul ca asta da 18 erori..
mezzzu
Membru eXtream
Membru eXtream
Posts: 2235
Joined: 19 Dec 2010, 17:31
Detinator Steam: Da
CS Status: Working...
Reputatie: Utilizator neserios (tepar)
Fost manager FURIEN.EXTREAMCS.COM
Restrictie moderator
Has thanked: 85 times
Been thanked: 137 times

29 Jun 2013, 12:20

Poti sa bagi in asta ? :-?
Last edited by mezzzu on 29 Jun 2013, 12:34, edited 1 time in total.
User avatar
duduftw
Utilizator neserios
Utilizator neserios
Posts: 1936
Joined: 19 Dec 2012, 20:30
Detinator Steam: Da
CS Status: sdd
SteamID: duduftw
Reputatie: Utilizator neserios
Location: Constanta
Has thanked: 97 times
Been thanked: 57 times

29 Jun 2013, 12:26

Uite aici da numai credite.
http://www.girlshare.ro/32634412.8
E pus chiar pe serveru meu.
Lasa multumesc.
ne mai pensionam si noi ?
Onoare
Membru, skill +1
Membru, skill +1
Posts: 234
Joined: 31 May 2013, 13:23
Detinator Steam: Nu
CS Status: Sa traiesc!
Detinator server CS: Da
SteamID: Nu te priveste!
Location: Rm Valcea
Has thanked: 18 times
Been thanked: 34 times
Contact:

29 Jun 2013, 12:31

Poftim
| Afiseaza codul
#include < amxmodx >
#include < cstrike >
#include < hamsandwich >
#include < fakemeta >
#include < engine >
#include < fun >
#include < cellarray >
#include < xs >
#include < ColorChat >

#pragma semicolon 1


#define PLUGIN "FMU Gifts"
#define VERSION "0.3.2b"

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

/* Extras din Super Spawns */
#define SS_VERSION	"1.0"
#define SS_MIN_DISTANCE	250.0
#define SS_MAX_LOOPS	100000

new Array:g_vecSsOrigins;
new Array:g_vecSsSpawns;
new Array:g_vecSsUsed;
new Float:g_flSsMinDist;
new g_iSsTime;

new const g_szStarts[][] =
{
"info_player_start",
"info_player_deathmatch"
};

new const Float:g_flOffsets[] =
{
3500.0,
3500.0,
1500.0
};

enum
{

GIFT_HP, 
GIFT_AP,
GIFT_HP_AP,
GIFT_CREDITE,
GIFT_HE

}

new const g_szFmuGiftsModels[  7  ][   ]  =
{

"models/fmu_gift_cyan.mdl",
"models/fmu_gift_green.mdl",
"models/fmu_gift_orange.mdl",
"models/fmu_gift_pink.mdl",
"models/fmu_gift_red.mdl",
"models/fmu_gift_yellow.mdl",
"models/fmu_gift_random.mdl"

};

new const g_iFmuGiftsColors[  7  ][  3  ]  =
{
{ 0, 255, 255 },
{ 0, 255, 125 },
{ 255, 125, 65 },
{ 255, 0, 125 },
{ 255, 25, 25 },
{ 255, 255, 0 },
{ 255, 255, 255 }
};


new const g_szFmuGiftClassName[    ]  =  "fmu_gift";
new const FMU_TAG[    ]  =  "[Furien Gifts]";

// Floats
new Float:fMaxs[ 3 ]  =  {  13.0, 13.0, 35.0  };
new Float:fMins[ 3 ]  =  {  -13.0, -13.0, 0.0  };

new gCvarGiftHP;
new gCvarGiftAP;

new gCvarEnableRespawn;
new gCvarRespawnTime;
new gCvarGiftsNum;

public plugin_precache(    )
{

for( new i = 0; i < 7; i++ )
{
precache_model( g_szFmuGiftsModels[ i ] );
}

}

public plugin_init( )
{
//Autor original al plugin-ului: KronoS .
//Am pornit acest plugin pe baza plugin`ului facut de el.
register_plugin( PLUGIN, VERSION, "Askhanar" );

gCvarGiftHP = register_cvar( "fmu_gifts_hp", "25" );
gCvarGiftAP = register_cvar( "fmu_gifts_ap", "25" );

gCvarEnableRespawn = register_cvar( "fmu_enable_giftsrespawn", "1" );
gCvarRespawnTime = register_cvar( "fmu_gifts_respawntime", "45" );
gCvarGiftsNum = register_cvar( "fmu_gifts_num", "35" );

register_clcmd( "amx_reloadgifts", "ClCmdReloadGifts" );
register_touch( g_szFmuGiftClassName, "player", "FwdPlayerTouchGift" );

SsInit(800.0);
SsScan();

LoadAllGifts( );
}

public ClCmdReloadGifts( id )
{
if( !( get_user_flags( id ) & ADMIN_CFG ) )
return 1;

SsClean();
SsInit(800.0);
SsScan();

new iFoundEntity;

while ( ( iFoundEntity = find_ent_by_class(  iFoundEntity, g_szFmuGiftClassName  ) )  !=  0  )
{
engfunc( EngFunc_RemoveEntity, iFoundEntity );
}

LoadAllGifts( );

new szName[ 32 ];
get_user_name( id, szName, sizeof ( szName ) -1 );
ColorChat( 0, RED, "^x04%s^x01 Adminul^x03 %s^x01 a reincarcat toate cadourile de pe harta!", FMU_TAG, szName );
return 1;
}

public FwdPlayerTouchGift(  const iEnt, const id  )
{

if( is_valid_ent(  iEnt  )  && ( 1 <= id <= 32 ) &&  is_user_alive(  id  )  )
{

if( get_pcvar_num( gCvarEnableRespawn ) )
{
new iParm[ 3 ];
new Float:flOrigin[ 3 ], iOrigin[ 3 ];

entity_get_vector( iEnt, EV_VEC_origin, flOrigin );

FVecIVec( flOrigin, iOrigin );
iParm[ 0 ] = iOrigin[ 0 ];
iParm[ 1 ] = iOrigin[ 1 ];
iParm[ 2 ] = iOrigin[ 2 ];

set_task( float( get_pcvar_num( gCvarRespawnTime ) ), "Respawn_Entity", _, iParm, 3 );

}


new iRandomGift = random_num( GIFT_HP, GIFT_HE );
while(  iRandomGift  ==  GIFT_HE   &&  user_has_weapon(  id,  CSW_HEGRENADE  )  )
iRandomGift = random_num( GIFT_HP, GIFT_HE );

GivePlayerGift( id, iRandomGift );
remove_entity( iEnt  );

}

return 0;
}

public GivePlayerGift(  id, const  iGiftType  )
{

switch(  iGiftType  )
{

case GIFT_HP:
{
set_user_health(  id,  get_user_health(  id  )  +  get_pcvar_num( gCvarGiftHP )  );
ColorChat(  id, RED,  "^x04%s^x01 Mosul ti-a oferit cadou^x03 %i HP^x01!",  FMU_TAG, get_pcvar_num( gCvarGiftHP )  );

}
case GIFT_AP:
{
set_user_armor(  id,  get_user_armor(  id  )  +  get_pcvar_num( gCvarGiftAP ) );
ColorChat(  id, RED,  "^x04%s^x01 Mosul ti-a oferit cadou^x03 %i AP^x01!",  FMU_TAG, get_pcvar_num( gCvarGiftAP )  );

}
case GIFT_HP_AP:
{
static iHP;
iHP = get_pcvar_num( gCvarGiftHP );
static iAP;
iAP = get_pcvar_num( gCvarGiftAP );
set_user_health(  id,  get_user_health(  id  )  +  iHP  );
set_user_armor(  id,  get_user_armor(  id  )  +  iAP  );

ColorChat(  id, RED,  "^x04%s^x01 Mosul ti-a oferit cadou^x03 %i HP^x01 si^x03 %i AP^x01!",  FMU_TAG, iHP, iAP );
}
case GIFT_CREDITE:
{
new Credite = get_user_credits(id);
set_user_credits(id, Credite + 1);
ColorChat(  id, RED,  "^x04%s^x01 Mosul ti-a oferit cadou^x03 1 credit^x01!" );
}
case GIFT_HE:
{

give_item(  id,  "weapon_hegrenade"  );
ColorChat(  id, RED,  "^x04%s^x01 Mosul ti-a oferit cadou un^x03 HE^x01!",  FMU_TAG  );

}

}
}

public Respawn_Entity( iParm[ ] )
{
new Float:flOrigin[ 3 ], iOrigin[ 3 ];

iOrigin[ 0 ] = iParm[ 0 ];
iOrigin[ 1 ] = iParm[ 1 ];
iOrigin[ 2 ] = iParm[ 2 ];

IVecFVec( iOrigin, flOrigin );
CreateGift(  flOrigin );

return 0;
}

public CreateGift(  const Float:fOrigin[ 3 ] )
{

new iEnt = create_entity( "info_target" );
if ( !is_valid_ent(iEnt) ) return 0;

new iRandom = random_num( 0, 6 );

entity_set_string(  iEnt, EV_SZ_classname, g_szFmuGiftClassName  );
entity_set_origin(  iEnt, fOrigin  );
entity_set_model(  iEnt, g_szFmuGiftsModels[  iRandom  ]  );
entity_set_int(  iEnt, EV_INT_movetype, MOVETYPE_NONE  );
entity_set_int(  iEnt, EV_INT_solid, SOLID_BBOX );
entity_set_size(  iEnt, fMins, fMaxs  );

set_rendering( iEnt,
kRenderFxGlowShell,
g_iFmuGiftsColors[ iRandom ][ 0 ],
g_iFmuGiftsColors[ iRandom ][ 1 ],
g_iFmuGiftsColors[ iRandom ][ 2 ],
kRenderNormal,
255 );

drop_to_floor(  iEnt  );

return 1;
}

public LoadAllGifts( )
{

new Float:fOrigin[ 3 ];

for( new i = 1; i <= get_pcvar_num( gCvarGiftsNum ); i++ )
if( SsGetOrigin( fOrigin ) )
CreateGift( fOrigin );


}


/*====================================
========Inceput Super Spawns========*/

public SsInit(Float:mindist)
{

register_cvar("sv_superspawns", SS_VERSION, (FCVAR_SERVER|FCVAR_SPONLY));
register_concmd("_ss_dump", "SsDump");

g_flSsMinDist = mindist;
g_vecSsOrigins = ArrayCreate(3, 1);
g_vecSsSpawns = ArrayCreate(3, 1);
g_vecSsUsed = ArrayCreate(3, 1);
}

stock SsClean()
{
g_flSsMinDist = 0.0;
ArrayClear(g_vecSsOrigins);
ArrayClear(g_vecSsSpawns);
ArrayClear(g_vecSsUsed);
}

stock SsGetOrigin(Float:origin[3])
{
new Float:data[3], size;
new ok = 1;

while((size = ArraySize(g_vecSsOrigins)))
{
	new idx = random_num(0, size - 1);
	
	ArrayGetArray(g_vecSsOrigins, idx, origin);
	
	new used = ArraySize(g_vecSsUsed);
	for(new i = 0; i < used; i++)
	{
		ok = 0;
		ArrayGetArray(g_vecSsUsed, i, data);
		if(get_distance_f(data, origin) >= g_flSsMinDist)
		{
			ok = 1;
			break;
		}
	}
	
	ArrayDeleteItem(g_vecSsOrigins, idx);
	if(ok)
	{
		ArrayPushArray(g_vecSsUsed, origin);
		return true;
	}
}
return false;
}

public SsDump()
{
new Float:origin[3];
new count = ArraySize(g_vecSsOrigins);
server_print("-------------------------------------------------------");
for(new i = 0; i < count; i++)
{
	ArrayGetArray(g_vecSsOrigins, i, origin);
	server_print("Origin: %f %f %f", origin[0], origin[1], origin[2]);
}
server_print("-------------------------------------------------------");
server_print("Number of origins: %i", count);
server_print("Time: %i", g_iSsTime);
server_print("-------------------------------------------------------");
}

public SsScan()
{
new start, Float:origin[3], starttime;
starttime = get_systime();
for(start = 0; start < sizeof(g_szStarts); start++)
{
	server_print("Searching for %s", g_szStarts[start]);
	new ent;
	if((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", g_szStarts[start])))
	{
		new counter;
		pev(ent, pev_origin, origin);
		ArrayPushArray(g_vecSsSpawns, origin);
		while(counter < SS_MAX_LOOPS)
		{
			counter = GetLocation(origin, counter);
		}
	}
}
g_iSsTime = get_systime();
g_iSsTime -= starttime;
}

GetLocation(Float:start[3], &counter)
{
new Float:end[3];
for(new i = 0; i < 3; i++)
{
end += random_float(0.0 - g_flOffsets, g_flOffsets);
}

if(IsValid(start, end))
{
start[0] = end[0];
start[1] = end[1];
start[2] = end[2];
ArrayPushArray(g_vecSsOrigins, end);
}
counter++;
return counter;
}

IsValid(Float:start[3], Float:end[3])
{
SetFloor(end);
end[2] += 36.0;
new point = engfunc(EngFunc_PointContents, end);
if(point == CONTENTS_EMPTY)
{
if(CheckPoints(end) && CheckDistance(end) && CheckVisibility(start, end))
{
if(!trace_hull(end, HULL_LARGE, -1))
{
	return true;
}
}
}
return false;
}

CheckVisibility(Float:start[3], Float:end[3])
{
new tr;
engfunc(EngFunc_TraceLine, start, end, IGNORE_GLASS, -1, tr);
return (get_tr2(tr, TR_pHit) < 0);
}

SetFloor(Float:start[3])
{
new tr, Float:end[3];
end[0] = start[0];
end[1] = start[1];
end[2] = -99999.9;
engfunc(EngFunc_TraceLine, start, end, DONT_IGNORE_MONSTERS, -1, tr);
get_tr2(tr, TR_vecEndPos, start);
}

CheckPoints(Float:origin[3])
{
new Float:data[3], tr, point;
data[0] = origin[0];
data[1] = origin[1];
data[2] = 99999.9;
engfunc(EngFunc_TraceLine, origin, data, DONT_IGNORE_MONSTERS, -1, tr);
get_tr2(tr, TR_vecEndPos, data);
point = engfunc(EngFunc_PointContents, data);
if(point == CONTENTS_SKY && get_distance_f(origin, data) < 250.0)
{
return false;
}
data[2] = -99999.9;
engfunc(EngFunc_TraceLine, origin, data, DONT_IGNORE_MONSTERS, -1, tr);
get_tr2(tr, TR_vecEndPos, data);
point = engfunc(EngFunc_PointContents, data);
if(point < CONTENTS_SOLID)
return false;

return true;
}

CheckDistance(Float:origin[3])
{
new Float:dist, Float:data[3];
new count = ArraySize(g_vecSsSpawns);
for(new i = 0; i < count; i++)
{
ArrayGetArray(g_vecSsSpawns, i, data);
dist = get_distance_f(origin, data);
if(dist < SS_MIN_DISTANCE)
return false;
}

count = ArraySize(g_vecSsOrigins);
for(new i = 0; i < count; i++)
{
ArrayGetArray(g_vecSsOrigins, i, data);
dist = get_distance_f(origin, data);
if(dist < SS_MIN_DISTANCE)
return false;
}

return true;
}

/*====================================
========Sfarsit Super Spawns========*/

Am vazut ca multi cauta sa inlocuiasca banii cu creditele cei care mai au nevoie de ajutor cu asa ceva sa imi dea pm
Last edited by Onoare on 29 Jun 2013, 12:33, edited 1 time in total.
mezzzu
Membru eXtream
Membru eXtream
Posts: 2235
Joined: 19 Dec 2010, 17:31
Detinator Steam: Da
CS Status: Working...
Reputatie: Utilizator neserios (tepar)
Fost manager FURIEN.EXTREAMCS.COM
Restrictie moderator
Has thanked: 85 times
Been thanked: 137 times

29 Jun 2013, 12:33

Mersi frumos Onoare
Onoare
Membru, skill +1
Membru, skill +1
Posts: 234
Joined: 31 May 2013, 13:23
Detinator Steam: Nu
CS Status: Sa traiesc!
Detinator server CS: Da
SteamID: Nu te priveste!
Location: Rm Valcea
Has thanked: 18 times
Been thanked: 34 times
Contact:

29 Jun 2013, 13:10

Uite aici
| Afiseaza codul
#include < amxmodx >
#include < cstrike >
#include < hamsandwich >
#include < fakemeta >
#include < engine >
#include < fun >
#include < cellarray >
#include < xs >
#include < ColorChat >

#pragma semicolon 1


#define PLUGIN "FMU Gifts"
#define VERSION "0.3.2b"

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

/* Extras din Super Spawns */
#define SS_VERSION	"1.0"
#define SS_MIN_DISTANCE	900.0
#define SS_MAX_LOOPS	100000

new Array:g_vecSsOrigins;
new Array:g_vecSsSpawns;
new Array:g_vecSsUsed;
new Float:g_flSsMinDist;
new g_iSsTime;

new const g_szStarts[][] =
{
"info_player_start",
"info_player_deathmatch"
};

new const Float:g_flOffsets[] =
{
3500.0,
3500.0,
1500.0
};

enum
{

GIFT_HP, 
GIFT_AP,
GIFT_HP_AP,
GIFT_CREDITE,
GIFT_HE

}

new const g_szFmuGiftsModels[  7  ][   ]  =
{

"models/bonusboxz.mdl",
"models/bonusboxz.mdl",
"models/bonusboxz.mdl",
"models/bonusboxz.mdl",
"models/bonusboxz.mdl",
"models/bonusboxz.mdl",
"models/bonusboxz.mdl"

};

new const g_iFmuGiftsColors[  7  ][  3  ]  =
{
{ 0, 255, 255 },
{ 0, 255, 125 },
{ 255, 125, 65 },
{ 255, 0, 125 },
{ 255, 25, 25 },
{ 255, 255, 0 },
{ 255, 255, 255 }
};


new const g_szFmuGiftClassName[    ]  =  "fmu_gift";
new const FMU_TAG[    ]  =  "[Furien Gifts]";

// Floats
new Float:fMaxs[ 3 ]  =  {  13.0, 13.0, 35.0  };
new Float:fMins[ 3 ]  =  {  -13.0, -13.0, 0.0  };

new gCvarGiftHP;
new gCvarGiftAP;
new gCvarGiftCredite;

new gCvarEnableRespawn;
new gCvarRespawnTime;
new gCvarGiftsNum;

public plugin_precache(    )
{

for( new i = 0; i < 7; i++ )
{
precache_model( g_szFmuGiftsModels[ i ] );
}

}

public plugin_init( )
{
//Autor original al plugin-ului: KronoS .
//Am pornit acest plugin pe baza plugin`ului facut de el.
register_plugin( PLUGIN, VERSION, "Askhanar" );

gCvarGiftHP = register_cvar( "fmu_gifts_hp", "25" );
gCvarGiftAP = register_cvar( "fmu_gifts_ap", "25" );
gCvarGiftCredite = register_cvar( "amx_give_credits" , "1" );
register_concmd("amx_give_credits", "Give_Credits", ADMIN_CVAR, "Name/@T/@CT/@All -> Amount");

gCvarEnableRespawn = register_cvar( "fmu_enable_giftsrespawn", "1" );
gCvarRespawnTime = register_cvar( "fmu_gifts_respawntime", "45" );
gCvarGiftsNum = register_cvar( "fmu_gifts_num", "35" );

register_clcmd( "amx_reloadgifts", "ClCmdReloadGifts" );
register_touch( g_szFmuGiftClassName, "player", "FwdPlayerTouchGift" );

SsInit(800.0);
SsScan();

LoadAllGifts( );
}

public ClCmdReloadGifts( id )
{
if( !( get_user_flags( id ) & ADMIN_CFG ) )
return 1;

SsClean();
SsInit(800.0);
SsScan();

new iFoundEntity;

while ( ( iFoundEntity = find_ent_by_class(  iFoundEntity, g_szFmuGiftClassName  ) )  !=  0  )
{
engfunc( EngFunc_RemoveEntity, iFoundEntity );
}

LoadAllGifts( );

new szName[ 32 ];
get_user_name( id, szName, sizeof ( szName ) -1 );
ColorChat( 0, RED, "^x04%s^x01 Adminul^x03 %s^x01 a reincarcat toate cadourile de pe harta!", FMU_TAG, szName );
return 1;
}

public FwdPlayerTouchGift(  const iEnt, const id  )
{

if( is_valid_ent(  iEnt  )  && ( 1 <= id <= 32 ) &&  is_user_alive(  id  )  )
{

if( get_pcvar_num( gCvarEnableRespawn ) )
{
new iParm[ 3 ];
new Float:flOrigin[ 3 ], iOrigin[ 3 ];

entity_get_vector( iEnt, EV_VEC_origin, flOrigin );

FVecIVec( flOrigin, iOrigin );
iParm[ 0 ] = iOrigin[ 0 ];
iParm[ 1 ] = iOrigin[ 1 ];
iParm[ 2 ] = iOrigin[ 2 ];

set_task( float( get_pcvar_num( gCvarRespawnTime ) ), "Respawn_Entity", _, iParm, 3 );

}


new iRandomGift = random_num( GIFT_HP, GIFT_HE );
while(  iRandomGift  ==  GIFT_HE   &&  user_has_weapon(  id,  CSW_HEGRENADE  )  )
iRandomGift = random_num( GIFT_HP, GIFT_HE );

GivePlayerGift( id, iRandomGift );
remove_entity( iEnt  );

}

return 0;
}

public GivePlayerGift(  id, const  iGiftType  )
{

switch(  iGiftType  )
{

case GIFT_HP:
{
set_user_health(  id,  get_user_health(  id  )  +  get_pcvar_num( gCvarGiftHP )  );
ColorChat(  id, RED,  "^x04%s^x01 MzU* ti-a oferit cadou^x03 %i HP^x01!",  FMU_TAG, get_pcvar_num( gCvarGiftHP )  );

}
case GIFT_AP:
{
set_user_armor(  id,  get_user_armor(  id  )  +  get_pcvar_num( gCvarGiftAP ) );
ColorChat(  id, RED,  "^x04%s^x01 MzU* ti-a oferit cadou^x03 %i AP^x01!",  FMU_TAG, get_pcvar_num( gCvarGiftAP )  );

}
case GIFT_HP_AP:
{
static iHP;
iHP = get_pcvar_num( gCvarGiftHP );
static iAP;
iAP = get_pcvar_num( gCvarGiftAP );
set_user_health(  id,  get_user_health(  id  )  +  iHP  );
set_user_armor(  id,  get_user_armor(  id  )  +  iAP  );

ColorChat(  id, RED,  "^x04%s^x01 MzU* ti-a oferit cadou^x03 %i HP^x01 si^x03 %i AP^x01!",  FMU_TAG, iHP, iAP );
}
case GIFT_CREDITE:
{
new Credite = get_user_credits(id);
set_user_credits(id, Credite + 1);
ColorChat(  id, RED,  "^x04%s^x01 MzU* ti-a oferit cadou^x03 1 credit^x01!" , FMU_TAG, get_pcvar_num(gCvarGiftCredite));
}
case GIFT_HE:
{

give_item(  id,  "weapon_hegrenade"  );
ColorChat(  id, RED,  "^x04%s^x01 MzU* ti-a oferit cadou un^x03 HE^x01!",  FMU_TAG  );

}

}
}

public Respawn_Entity( iParm[ ] )
{
new Float:flOrigin[ 3 ], iOrigin[ 3 ];

iOrigin[ 0 ] = iParm[ 0 ];
iOrigin[ 1 ] = iParm[ 1 ];
iOrigin[ 2 ] = iParm[ 2 ];

IVecFVec( iOrigin, flOrigin );
CreateGift(  flOrigin );

return 0;
}

public CreateGift(  const Float:fOrigin[ 3 ] )
{

new iEnt = create_entity( "info_target" );
if ( !is_valid_ent(iEnt) ) return 0;

new iRandom = random_num( 0, 6 );

entity_set_string(  iEnt, EV_SZ_classname, g_szFmuGiftClassName  );
entity_set_origin(  iEnt, fOrigin  );
entity_set_model(  iEnt, g_szFmuGiftsModels[  iRandom  ]  );
entity_set_int(  iEnt, EV_INT_movetype, MOVETYPE_NONE  );
entity_set_int(  iEnt, EV_INT_solid, SOLID_BBOX );
entity_set_size(  iEnt, fMins, fMaxs  );

set_rendering( iEnt,
kRenderFxGlowShell,
g_iFmuGiftsColors[ iRandom ][ 0 ],
g_iFmuGiftsColors[ iRandom ][ 1 ],
g_iFmuGiftsColors[ iRandom ][ 2 ],
kRenderNormal,
255 );

drop_to_floor(  iEnt  );

return 1;
}

public LoadAllGifts( )
{

new Float:fOrigin[ 3 ];

for( new i = 1; i <= get_pcvar_num( gCvarGiftsNum ); i++ )
if( SsGetOrigin( fOrigin ) )
CreateGift( fOrigin );


}


/*====================================
========Inceput Super Spawns========*/

public SsInit(Float:mindist)
{

register_cvar("sv_superspawns", SS_VERSION, (FCVAR_SERVER|FCVAR_SPONLY));
register_concmd("_ss_dump", "SsDump");

g_flSsMinDist = mindist;
g_vecSsOrigins = ArrayCreate(3, 1);
g_vecSsSpawns = ArrayCreate(3, 1);
g_vecSsUsed = ArrayCreate(3, 1);
}

stock SsClean()
{
g_flSsMinDist = 0.0;
ArrayClear(g_vecSsOrigins);
ArrayClear(g_vecSsSpawns);
ArrayClear(g_vecSsUsed);
}

stock SsGetOrigin(Float:origin[3])
{
new Float:data[3], size;
new ok = 1;

while((size = ArraySize(g_vecSsOrigins)))
{
	new idx = random_num(0, size - 1);
	
	ArrayGetArray(g_vecSsOrigins, idx, origin);
	
	new used = ArraySize(g_vecSsUsed);
	for(new i = 0; i < used; i++)
	{
		ok = 0;
		ArrayGetArray(g_vecSsUsed, i, data);
		if(get_distance_f(data, origin) >= g_flSsMinDist)
		{
			ok = 1;
			break;
		}
	}
	
	ArrayDeleteItem(g_vecSsOrigins, idx);
	if(ok)
	{
		ArrayPushArray(g_vecSsUsed, origin);
		return true;
	}
}
return false;
}

public SsDump()
{
new Float:origin[3];
new count = ArraySize(g_vecSsOrigins);
server_print("-------------------------------------------------------");
for(new i = 0; i < count; i++)
{
	ArrayGetArray(g_vecSsOrigins, i, origin);
	server_print("Origin: %f %f %f", origin[0], origin[1], origin[2]);
}
server_print("-------------------------------------------------------");
server_print("Number of origins: %i", count);
server_print("Time: %i", g_iSsTime);
server_print("-------------------------------------------------------");
}

public SsScan()
{
new start, Float:origin[3], starttime;
starttime = get_systime();
for(start = 0; start < sizeof(g_szStarts); start++)
{
	server_print("Searching for %s", g_szStarts[start]);
	new ent;
	if((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", g_szStarts[start])))
	{
		new counter;
		pev(ent, pev_origin, origin);
		ArrayPushArray(g_vecSsSpawns, origin);
		while(counter < SS_MAX_LOOPS)
		{
			counter = GetLocation(origin, counter);
		}
	}
}
g_iSsTime = get_systime();
g_iSsTime -= starttime;
}

GetLocation(Float:start[3], &counter)
{
new Float:end[3];
for(new i = 0; i < 3; i++)
{
end += random_float(0.0 - g_flOffsets, g_flOffsets);
}

if(IsValid(start, end))
{
start[0] = end[0];
start[1] = end[1];
start[2] = end[2];
ArrayPushArray(g_vecSsOrigins, end);
}
counter++;
return counter;
}

IsValid(Float:start[3], Float:end[3])
{
SetFloor(end);
end[2] += 36.0;
new point = engfunc(EngFunc_PointContents, end);
if(point == CONTENTS_EMPTY)
{
if(CheckPoints(end) && CheckDistance(end) && CheckVisibility(start, end))
{
if(!trace_hull(end, HULL_LARGE, -1))
{
	return true;
}
}
}
return false;
}

CheckVisibility(Float:start[3], Float:end[3])
{
new tr;
engfunc(EngFunc_TraceLine, start, end, IGNORE_GLASS, -1, tr);
return (get_tr2(tr, TR_pHit) < 0);
}

SetFloor(Float:start[3])
{
new tr, Float:end[3];
end[0] = start[0];
end[1] = start[1];
end[2] = -99999.9;
engfunc(EngFunc_TraceLine, start, end, DONT_IGNORE_MONSTERS, -1, tr);
get_tr2(tr, TR_vecEndPos, start);
}

CheckPoints(Float:origin[3])
{
new Float:data[3], tr, point;
data[0] = origin[0];
data[1] = origin[1];
data[2] = 99999.9;
engfunc(EngFunc_TraceLine, origin, data, DONT_IGNORE_MONSTERS, -1, tr);
get_tr2(tr, TR_vecEndPos, data);
point = engfunc(EngFunc_PointContents, data);
if(point == CONTENTS_SKY && get_distance_f(origin, data) < 250.0)
{
return false;
}
data[2] = -99999.9;
engfunc(EngFunc_TraceLine, origin, data, DONT_IGNORE_MONSTERS, -1, tr);
get_tr2(tr, TR_vecEndPos, data);
point = engfunc(EngFunc_PointContents, data);
if(point < CONTENTS_SOLID)
return false;

return true;
}

CheckDistance(Float:origin[3])
{
new Float:dist, Float:data[3];
new count = ArraySize(g_vecSsSpawns);
for(new i = 0; i < count; i++)
{
ArrayGetArray(g_vecSsSpawns, i, data);
dist = get_distance_f(origin, data);
if(dist < SS_MIN_DISTANCE)
return false;
}

count = ArraySize(g_vecSsOrigins);
for(new i = 0; i < count; i++)
{
ArrayGetArray(g_vecSsOrigins, i, data);
dist = get_distance_f(origin, data);
if(dist < SS_MIN_DISTANCE)
return false;
}

return true;
}

/*====================================
========Sfarsit Super Spawns========*/
Onoare
Membru, skill +1
Membru, skill +1
Posts: 234
Joined: 31 May 2013, 13:23
Detinator Steam: Nu
CS Status: Sa traiesc!
Detinator server CS: Da
SteamID: Nu te priveste!
Location: Rm Valcea
Has thanked: 18 times
Been thanked: 34 times
Contact:

29 Jun 2013, 14:08

Scuze de dublu post
Uite aici
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>


#define PLUGIN "Bio: Bonus Box"
#define VERSION "3.0"
#define AUTHOR "Aragon*"

new const ClassName[] = "BonusBox"
new const SpawnBoxSound[] = "BonusBoxSpawn.wav"
new const TakeBoxSound[] = "BonusBoxGet.wav"

new Model[] = "models/bonusbox.mdl"

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

public plugin_init() 
{         
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_forward(FM_Touch, "Touch")
	register_think(ClassName, "Think")
	register_event("HLTV", "RoundStart", "a", "1=0", "2=0")
	register_event("DeathMsg", "Death", "a")
}

public plugin_precache()
{
	for (new i = 0; i < sizeof Model; i++)
		precache_model(Model)
	precache_sound(SpawnBoxSound) 
	precache_sound(TakeBoxSound) 
}
public RoundStart()
{
	new ent = FM_NULLENT
	static string_class[] = "classname"
	while ((ent = engfunc(EngFunc_FindEntityByString, ent, string_class, ClassName))) {
		set_pev(ent, pev_flags, FL_KILLME)
		remove_entity(ent);
	}
}

public Death()
{
	new victim = read_data(2);
	
	AddBonusBox(victim)
}

public AddBonusBox(id)
{
	if(is_user_connected(id) && cs_get_user_team(id) != CS_TEAM_SPECTATOR && cs_get_user_team(id) != CS_TEAM_T) {
		new ent = fm_create_entity("info_target")
		new origin[3]
		get_user_origin(id, origin, 0)
		set_pev(ent,pev_classname, ClassName)
		engfunc(EngFunc_SetModel,ent, Model)
		set_pev(ent,pev_team, 2)
		new Float:fOrigin[3]
		IVecFVec(origin, fOrigin)
		set_pev(ent, pev_origin, fOrigin)
		set_pev(ent,pev_solid,SOLID_BBOX)
		set_pev(ent,pev_movetype,MOVETYPE_TOSS)
		engfunc(EngFunc_SetSize,ent,Float:{-10.0,-10.0,0.0},Float:{10.0,10.0,25.0})
		engfunc(EngFunc_DropToFloor, ent)
		set_pev(ent, pev_nextthink, halflife_time() + 0.01)
		emit_sound(ent, CHAN_AUTO,SpawnBoxSound,VOL_NORM,ATTN_NORM,0,PITCH_NORM) 	
	}
}

public Touch(toucher, touched)
{
	if (!is_user_alive(toucher) || get_user_team(toucher) != pev(touched, pev_team) || !is_user_connected(toucher) || !pev_valid(toucher))
		return FMRES_IGNORED
	
	new classname[32]	
	pev(touched, pev_classname, classname, 31)
	if (equal(classname, ClassName)) {	
		
		GiveBonus(toucher)
		emit_sound(touched,CHAN_AUTO,TakeBoxSound,VOL_NORM,ATTN_NORM,0,PITCH_NORM) 
		set_pev(touched, pev_effects, EF_NODRAW)
		set_pev(touched, pev_solid, SOLID_NOT)
		remove_entity(touched);
	}
	return FMRES_IGNORED
}

public Think(entity) 
{ 
	Light(entity, 3, 255,100,015)
	
	static Float:angles[3] 
	entity_get_vector(entity,EV_VEC_angles,angles) 
	
	angles[1]-- 
	
	entity_set_vector(entity,EV_VEC_angles,angles) 
	
	entity_set_float(entity,EV_FL_nextthink,halflife_time() + 0.01)
} 

public GiveBonus(id)
{	
	switch (random_num(1,4)) 
	{
		case 1: 
		{
			new Health = random_num(25, 50)
			fm_set_user_health(id, get_user_health(id) + Health)
			ColorChat(id, "!t[BonusBox]!g Ai primit!t %d HP!g in plus fata de cat aveai inainte !", Health)
		}
		case 2:
		{
			if(!user_has_weapon(id, CSW_HEGRENADE)) {
				fm_give_item(id, "weapon_hegrenade")
			}
			else {
				cs_set_user_bpammo(id, CSW_HEGRENADE, cs_get_user_bpammo(id, CSW_HEGRENADE) + 1);
			}
			ColorChat(id, "!t[BonusBox]!g Ai primit o grenada!t HE")
		}	
		case 3:
		{
			new Money = random_num(5000, 10000)
			cs_set_user_money(id, cs_get_user_money(id) + Money)
			ColorChat(id, "!t[BonusBox]!g Ai primit!t %d$", Money)
		}
		case 4:
		{
			new credit = get_user_credits(id)
			set_user_credits(id, credit + 2)
			ColorChat(id, "!t[BonusBox]!g Ai primit!t 2 Credite")
		}
	}
	
}

public Light(entity, radius, red, green, blue)
{	
	if(is_valid_ent(entity)) {
		static Float:origin[3]
		pev(entity, pev_origin, origin)
		
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY, _, entity);
		write_byte(TE_DLIGHT) // TE id
		engfunc(EngFunc_WriteCoord, origin[0])
		engfunc(EngFunc_WriteCoord, origin[1])
		engfunc(EngFunc_WriteCoord, origin[2])
		write_byte(radius) 
		write_byte(red)
		write_byte(green)
		write_byte(blue)
		write_byte(1)
		write_byte(0)
		message_end();
	}
}

stock ColorChat(const id, const input[], any:...) {
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!g", "^4");
	replace_all(msg, 190, "!y", "^1");
	replace_all(msg, 190, "!t", "^3");
	
	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);
				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 }
*/
Post Reply

Return to “Cereri”

  • Information
  • Who is online

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