Raised This Month: $51 Target: $400
 12% 

[CSS] Evil Deagle


Post New Thread Reply   
 
Thread Tools Display Modes
sinblaster
Grim Reaper
Join Date: Feb 2010
Location: Australia
Old 02-09-2010 , 23:18   Re: [CSS] Evil Deagle
Reply With Quote #21

- EvilDeagle.smx into /cstrike/addons/sourcemod/plugins

- /cstrike/cfg/server.cfg \ sm_evildeagle 1

- Reset server

- Folder created \ EMPTY.

I obviously have no idea, its been 4 years since I touched the back end of a game server and when I did it was all mani. I am lost. Anyone got a step by step idiots guide?

Great plugin, It's on |DtK| Deathmatch server and is enjoyed by everyone, simple and most effective. Bravo on a great add-on dude. ;)

§INBLA§T3R.

Last edited by sinblaster; 02-09-2010 at 23:22. Reason: 1
sinblaster is offline
meng
Veteran Member
Join Date: Oct 2005
Location: us
Old 02-09-2010 , 23:32   Re: [CSS] Evil Deagle
Reply With Quote #22

@§INBLA§T3R

Once the plugin is loaded, you have to save spawn points. Go to locations in the map that you would like the deagle to spawn, then use "sm_evildeagle_sp". That will save the spawn point. Once you have saved one (or how ever many you want), enable the plugin and you should be good to go. You only have to do this once for any different map you wish it to be enabled on.
__________________
.
[ 1 Dumerils Boa | 1 Cali King ]...
.
I'm a lil' spirituous.

Last edited by meng; 02-09-2010 at 23:41.
meng is offline
Send a message via Yahoo to meng
meng
Veteran Member
Join Date: Oct 2005
Location: us
Old 02-09-2010 , 23:40   Re: [CSS] Evil Deagle
Reply With Quote #23

Quote:
Originally Posted by Xp3r7 View Post
I got a suggestion.

Can we get a cvar that lets admins to see the spawn points and/or an option to let server opps decide if just admins can see the spawn points or everyone.

Maybe:

sm_evildeagle_seesp 1/2
1 = only admins
2 = everyone

Also a way to delete spawn points from in-game somehow would be awesome!
Those are good ideas. Showing spawn points (especially to only certain players) would require a hefty bit of coding considering the simple nature of the plugin. May not be worth it. You really should be able to remove spawn points though. I'll have to start thinking about it. Thx again.
__________________
.
[ 1 Dumerils Boa | 1 Cali King ]...
.
I'm a lil' spirituous.
meng is offline
Send a message via Yahoo to meng
sinblaster
Grim Reaper
Join Date: Feb 2010
Location: Australia
Old 02-10-2010 , 04:57   Re: [CSS] Evil Deagle
Reply With Quote #24

meng that was really great of you to answer me so quickly. Mate I am very appreciative for you're help. Thank you.

§INBLA§T3R

Last edited by sinblaster; 02-10-2010 at 06:35. Reason: I can't spwell lol
sinblaster is offline
Xp3r7
SourceMod Donor
Join Date: Jul 2006
Old 02-10-2010 , 20:47   Re: [CSS] Evil Deagle
Reply With Quote #25

Quote:
Originally Posted by meng View Post
Those are good ideas. Showing spawn points (especially to only certain players) would require a hefty bit of coding considering the simple nature of the plugin. May not be worth it. You really should be able to remove spawn points though. I'll have to start thinking about it. Thx again.
Ok man, cant wait to see what you do!

Only reason I say to see spawns is that I have the spawnpoint command in my admin menu for upper admins to add spawns and Id like to see where the spawns are before adding more cause I dont know where all the locations are on 1 map or even if there are any spawns at all.

Im sure others have the spawnpoint command in their admin menu as well.
__________________
Xp3r7 is offline
Send a message via MSN to Xp3r7
Arson
BANNED
Join Date: Jan 2005
Old 03-11-2010 , 07:00   Re: [CSS] Evil Deagle
Reply With Quote #26

] sm_evildeagle_sp
Unknown command: sm_evildeagle_sp


] rcon sm_evildeagle_sp
L 03/11/2010 - 06:02:45: [SM] Native "CloseHandle" reported: Handle 0 is invalid (error 4)
L 03/11/2010 - 06:02:45: [SM] Displaying call stack trace for plugin "EvilDeagle.smx":
L 03/11/2010 - 06:02:45: [SM] [0] Line 151, EvilDeagle.sp::CommandSavePos()
L 03/11/2010 - 06:02:45: rcon from "": command "sm_evildeagle_sp"

Last edited by Arson; 03-11-2010 at 07:05.
Arson is offline
Arson
BANNED
Join Date: Jan 2005
Old 03-11-2010 , 15:30   Re: [CSS] Evil Deagle
Reply With Quote #27

Meng,

I got it working by creating the folder/mapname.cfg (blank) on my computer then put it on manually since there was a problem with creating it. Also did the code differently.

Code:
/*

	Evil Deagle.

*/

#include <sourcemod>
#include <sdktools>

#define PLUGIN_VERSION "1.2"

public Plugin:myinfo = 
{
	name = "Evil Deagle",
	author = "meng",
	version = PLUGIN_VERSION,
	description = "special deagle for CSS",
	url = ""
};

new bool:enabled;
new Handle:ED_spawns;
new Handle:CvarEfxColor;
new Handle:CvarRecoilMul;
new Float:RecoilMul;
new EDdc;
new EDindex;
new EDpwner;
new Float:LastEDpwnerPos[3];
new WeaponParent;
new iClip1;
new RingColor[4];
new BeamSprite;
new HaloSprite;
new GlowSprite;
new bool:EndEDH;
new String:mapcfgpath[PLATFORM_MAX_PATH];

public OnPluginStart()
{
	/* offsets */
	WeaponParent = FindSendPropOffs("CBaseCombatWeapon", "m_hOwnerEntity");
	iClip1 = FindSendPropOffs("CBaseCombatWeapon", "m_iClip1");

	/* convars */
	CreateConVar("sm_evildeagle_version", PLUGIN_VERSION, "Evil Deagle Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
	CvarEfxColor = CreateConVar("sm_evildeagle_efxcolor", "0");
	CvarRecoilMul = CreateConVar("sm_evildeagle_recoil", "400");
	HookConVarChange(CvarRecoilMul, OnSettingChanged);

	/* admin cmds */
	RegAdminCmd("sm_evildeagle", EDControl, ADMFLAG_BAN);
	RegAdminCmd("sm_evildeagle_sp", CommandSavePos, ADMFLAG_BAN);

	/* create the plugins cfg dir if it doesn't exist already */
	decl String:configspath[PLATFORM_MAX_PATH];
	BuildPath(Path_SM, configspath, sizeof(configspath), "configs/evildeagle");
	if (!DirExists(configspath))
		CreateDirectory(configspath, 0x0265);

	/* adt array for saving spawn positions */
	ED_spawns = CreateArray(3);

	/* hook events */
	HookEvent("round_start", EventRoundStart, EventHookMode_PostNoCopy);
	HookEvent("weapon_fire", EventWeaponFire);
	HookEvent("player_hurt", EventPlayerHurt);
	HookEvent("player_death", EventPlayerDeath);
	HookEvent("round_end", EventRoundEnd, EventHookMode_PostNoCopy);
}

public OnMapStart()
{
	/* get map and read its cfg */
	decl String:map[64];
	GetCurrentMap(map, sizeof(map));
	BuildPath(Path_SM, mapcfgpath, sizeof(mapcfgpath), "configs/evildeagle/%s.cfg", map);
	ReadConfig();

	/* precache needed materials */
	BeamSprite = PrecacheModel("materials/sprites/laser.vmt");
	HaloSprite = PrecacheModel("materials/sprites/halo01.vmt");
	
	if (!FileExists(mapcfgpath))
	{
		new Handle:fh = OpenFile(mapcfgpath, "w+");
		CloseHandle(fh);
	}
}

public OnConfigsExecuted()
{
	if (GetConVarInt(CvarEfxColor))
	{
		RingColor = {150, 125, 0, 255};
		GlowSprite = PrecacheModel("sprites/yellowglow1.vmt");
	}
	else
	{
		RingColor = {255, 25, 15, 255};
		GlowSprite = PrecacheModel("sprites/redglow3.vmt");
	}
	RecoilMul = -1.0*GetConVarFloat(CvarRecoilMul);
}

public OnSettingChanged(Handle:convar, const String:oldValue[], const String:newValue[])
{
	if (convar == CvarRecoilMul)
		RecoilMul = -1.0*StringToFloat(newValue);
}

/* map end, clear the spawn points array */
public OnMapEnd(){ClearArray(ED_spawns);}

/* admin command handler to turn the plugin on/off */
public Action:EDControl(client, args)
{
	if (args != 1)
	{
		ReplyToCommand(client, "[SM] Usage: sm_evildeagle <0/1>");
		return Plugin_Handled;
	}
	decl String:info[8], Switch;
	GetCmdArg(1, info, sizeof(info)); Switch = StringToInt(info);
	switch (Switch)
	{
		case 0:
		{
			enabled = false;
			ReplyToCommand(client, "[Evil Deagle] Plugin DISABLED");
		}
		 /* if enabling, make sure we have stored e.d. spawns, if not, dont enable */
		case 1:
		{
			if (GetArraySize(ED_spawns) < 1)
			{
				enabled = false;
				ReplyToCommand(client, "[Evil Deagle] No saved spawn positions. Plugin DISABLED");
			}
			else
			{
				enabled = true;
				ReplyToCommand(client, "[Evil Deagle] Plugin ENABLED");
			}
		}
	}
	return Plugin_Handled;
}

/* admin command handler for saving e.d. spawn positions */
public Action:CommandSavePos(client, args)
{
	/* if the map cfg file doesn't exist, create it */
	
	/* open the map file and store the new keyvalues entry */
	new Handle:kv = CreateKeyValues("EDSP");
	new arraysize = GetArraySize(ED_spawns);
	decl Float:vec[3], String:buff[8];
	GetClientAbsOrigin(client, vec);
	Format(buff, sizeof(buff), "sp%d", arraysize+1);
	if (FileToKeyValues(kv, mapcfgpath))
	{
		KvSetVector(kv, buff, vec);
		KeyValuesToFile(kv, mapcfgpath);
		PushArrayArray(ED_spawns, _:vec);
		ReplyToCommand(client, "[Evil Deagle] Spawn position saved! New total: %d", arraysize+1);
	}
	else
		ReplyToCommand(client, "[Evil Deagle] Error saving spawn position. Missing map config file.");
	CloseHandle(kv);
	return Plugin_Handled;
}

/* read the map keyvalues file and store the positions in the adt array */
ReadConfig()
{
	new Handle:kv = CreateKeyValues("EDSP");
	if (FileToKeyValues(kv, mapcfgpath))
	{
		new num = 1;
		decl String:buff[8], Float:vec[3];
		Format(buff, sizeof(buff), "sp%d", num);
		KvGetVector(kv, buff, vec);
		while (vec[0] != 0.0)
		{
			PushArrayArray(ED_spawns, vec);
			num++;
			Format(buff, sizeof(buff), "sp%d", num);
			KvGetVector(kv, buff, vec);
		}
	}
	CloseHandle(kv);
	if (GetArraySize(ED_spawns) < 1)
		enabled = false;
}

/* round_start. initialize, create point_hurt, start e.d. handler */
public EventRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
	if (enabled)
	{
		EndEDH = false;
		EDindex = -1;
		EDpwner = -1;
		LastEDpwnerPos[0] = 0.0;
		new entity = CreateEntityByName("point_hurt");
		if (DispatchSpawn(entity))
			EDdc = entity;
		else
			EDdc = -1;
		CreateTimer(1.0, EDHandler, INVALID_HANDLE, TIMER_REPEAT);
	}
}

/* round_end. set bool so the e.d. handler stops itself */
public EventRoundEnd(Handle:event, const String:name[], bool:dontBroadcast){EndEDH = true;}

SpawnNewED(spott)
{
	new entity = CreateEntityByName("weapon_deagle");
	DispatchSpawn(entity);
	decl Float:vec[3];
	switch (spott)
	{
		case 0: /* spawn from saved positions */
		{
			new arraysize = GetArraySize(ED_spawns);
			GetArrayArray(ED_spawns, GetRandomInt(0, arraysize-1), vec);
		}
		case 1: /* spawn at last owners position */
			vec = LastEDpwnerPos;
	}
	TeleportEntity(entity, vec, NULL_VECTOR, NULL_VECTOR);
	SetEntData(entity, iClip1, 1);
	EDindex = entity;
}

/* the e.d. handler. a repeating timer that makes sure its still in the game, keeps track of who owns it
and makes sure it has the correct ammo count */
public Action:EDHandler(Handle:timer)
{
	static owner, iAmmo, Float:EDvec[3];
	if (EndEDH) 
		return Plugin_Stop;
	if (!IsValidEntity(EDindex))
	{
		SpawnNewED(LastEDpwnerPos[0] == 0.0 ? 0 : 1);
		return Plugin_Continue;
	}
	if ((owner = GetEntDataEnt2(EDindex, WeaponParent)) != -1)
	{
		EDpwner = owner;
		if (GetEntData(EDindex, iClip1) > 1)
			SetEntData(EDindex, iClip1, 1);
		iAmmo = FindDataMapOffs(owner, "m_iAmmo")+(1*4);
		if (GetEntData(owner, iAmmo)  > 1)
			SetEntData(owner, iAmmo, 0);
	}
	else
	{
		EDpwner = -1;
		if (GetEntData(EDindex, iClip1) < 1)
			SetEntData(EDindex, iClip1, 1);
		GetEntPropVector(EDindex, Prop_Data, "m_vecOrigin", EDvec);
		TE_SetupGlowSprite(EDvec, GlowSprite, 1.0, 0.7, 217);
		TE_SendToAll();
		EDvec[2] += 3;
		TE_SetupBeamRingPoint(EDvec, 8.0, 36.0, BeamSprite, HaloSprite, 0, 10, 1.0, 7.0, 1.0, RingColor, 7, 0);
		TE_SendToAll();
	}
	return Plugin_Continue;
}

/* if the e.d. is fired, give it another bullet. */
public EventWeaponFire(Handle:event,const String:name[],bool:dontBroadcast)
{
	if (enabled)
	{
		new client = GetClientOfUserId(GetEventInt(event, "userid"));
		if (client == EDpwner)
		{
			decl String:weapon[16];
			GetEventString(event, "weapon", weapon, sizeof(weapon));
			if (StrEqual(weapon, "deagle"))
			{
				new c_iAmmo = FindDataMapOffs(client, "m_iAmmo")+(1*4);
				SetEntData(client, c_iAmmo, 1);
				if (GetEntData(EDindex, iClip1) == 1)
					CreateTimer(0.01, Recoil, client);
			}
		}
	}
}

/* using a timer for the recoil effect, otherwise it seems to hurt accuracy */
public Action:Recoil(Handle:timer, any:client)
{
	static Float:PlayerAng[3], Float:PlayerVel[3], Float:Push[3];
	GetClientEyeAngles(client, PlayerAng);
	GetEntPropVector(client, Prop_Data, "m_vecVelocity", PlayerVel);
	PlayerAng[0] *= -1.0;
	PlayerAng[0] = DegToRad(PlayerAng[0]);
	PlayerAng[1] = DegToRad(PlayerAng[1]);
	Push[0] = RecoilMul*Cosine(PlayerAng[0])*Cosine(PlayerAng[1])+PlayerVel[0];
	Push[1] = RecoilMul*Cosine(PlayerAng[0])*Sine(PlayerAng[1])+PlayerVel[1];
	Push[2] = RecoilMul*Sine(PlayerAng[0])+PlayerVel[2]; 
	TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, Push);
}

/* if hurt by the e.d., kill. */
public EventPlayerHurt(Handle:event,const String:name[],bool:dontBroadcast)
{
	if (enabled)
	{
		new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
		if (attacker && attacker == EDpwner)
		{
			decl String:weapon[16];
			GetEventString(event, "weapon", weapon, sizeof(weapon));
			if (StrEqual(weapon, "deagle"))
			{
				if (IsValidEntity(EDdc))
				{
					new victim = GetClientOfUserId(GetEventInt(event,"userid"));
					/* teleporting the point hurt entity to the attacker position
					creates a great physics push on the victim in the correct direction */
					decl Float:attackerPos[3];
					GetClientAbsOrigin(attacker, attackerPos);
					TeleportEntity(EDdc, attackerPos, NULL_VECTOR, NULL_VECTOR);
					DispatchKeyValue(victim, "targetname", "hurt");
					DispatchKeyValue(EDdc, "DamageTarget", "hurt");
					DispatchKeyValue(EDdc, "Damage", "317");
					DispatchKeyValue(EDdc, "DamageType", "0");
					AcceptEntityInput(EDdc, "Hurt", attacker);
					DispatchKeyValue(victim, "targetname", "nohurt");
				}
				else
					LogError("Invalid EDdc");
			}
		}
	}
}

/* if the e.d. owner died, store position incase the e.d. handler needs to spawn a new e.d.. */
public EventPlayerDeath(Handle:event,const String:name[],bool:dontBroadcast)
{
	if (enabled)
	{
		new client = GetClientOfUserId(GetEventInt(event,"userid"));
		if (client == EDpwner)
			GetClientAbsOrigin(client, LastEDpwnerPos);
	}
}
Arson is offline
meng
Veteran Member
Join Date: Oct 2005
Location: us
Old 03-11-2010 , 16:28   Re: [CSS] Evil Deagle
Reply With Quote #28

You are correct sir!. This plugin needs to be updated. There is a few other problems floating around in there. Update coming soon. I will fix the keyvalues and hopefully implement some new features for saving/removing spawn positions. Current method is a lot like a dull steak knife.
__________________
.
[ 1 Dumerils Boa | 1 Cali King ]...
.
I'm a lil' spirituous.
meng is offline
Send a message via Yahoo to meng
Arson
BANNED
Join Date: Jan 2005
Old 03-11-2010 , 16:42   Re: [CSS] Evil Deagle
Reply With Quote #29

=)

The way I put it there fixes the loading issue, so anyone who wants it on now can use that for now.
Arson is offline
meng
Veteran Member
Join Date: Oct 2005
Location: us
Old 03-12-2010 , 16:57   Re: [CSS] Evil Deagle
Reply With Quote #30

Plugin updated. New version 1.3

Almost completely rewritten. Fixed incorrect usage of keyvalues. Added tools to the SM menu. Various optimizing / code cleanup. Note, configs generated by version 1.2 will NOT work with 1.3. Sorry about that but the changes were needed to fix some issues and include new spawn position tools.
__________________
.
[ 1 Dumerils Boa | 1 Cali King ]...
.
I'm a lil' spirituous.
meng is offline
Send a message via Yahoo to meng
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:14.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode