PDA

View Full Version : [REQ][HL2DM] Spawnprotection


Tockra
12-05-2011, 14:41
Hey Guys,

Im looking for a spawnprotection in HL2DM, which protect you until you press one button.
The protection should make you immortal.
It should be a spawnprotection and a rank abuse protection in one. (Because afk players)

Yours T.

Impact123
12-05-2011, 16:15
Well, the problem is there are not much listed events for HL2DM.
This plugin gives you godmode when you die and removes it as soon as you move.
I don't know if the godmode get's reset on spawn, whether i know if this works (Don't have this game installed).
You need to test.
What do you mean with rank abuse?


#include <sourcemod>
#pragma semicolon 1

new bool:iInProtection[MAXPLAYERS+1];

public Plugin:myinfo =
{
name = "New Plugin",
author = "Unknown",
description = "<- Description ->",
version = "1.0",
url = "<- URL ->"
}




public OnPluginStart()
{
HookEvent("player_death", OnPlayerDeath);
}




public Action:OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if(client >0 && IsClientConnected(client) && IsClientInGame(client))
{
SetEntProp(client, Prop_Data, "m_takedamage", 0, 1);
iInProtection[client] = true;
}
}




public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
if(client >0 && IsClientConnected(client) && IsClientInGame(client) && iInProtection[client])
{
SetEntProp(client, Prop_Data, "m_takedamage", 2, 1);
iInProtection[client] = false;
}
}


Just compile it with the Web Compiler (http://www.sourcemod.net/compiler.php)

Yours sincerely
Impact

Tockra
12-05-2011, 17:52
OKay thank you, i will test it.

PS: Where i find the existing events and functions, to writte own sourcemod plugins?

Tockra
12-06-2011, 05:25
No it doesnt run :(