PDA

View Full Version : Anti-Stuck plugin


zhelev81
06-05-2009, 08:54
I'm be glad if someone can create anti-stuck plugin,there is a problem on servers with 40 and over players servers that the players get stuck on spawn pretty often.Or maybe someone created it already but i did not find it ?

Tnx:wink:

almcaeobtac
06-05-2009, 09:11
Well, theres one on RP. Two actually. You can type /stuck to kill yourself, or type /push to push players out of the way. Which would you prefer?

zhelev81
06-05-2009, 09:15
I prefer to push players away ,kill is a crime :mrgreen: ,and is this plugin going to work on CS:S :)

tnx for the quick reply ,I hope will work :)

almcaeobtac
06-07-2009, 15:56
Alright here it is. Tell me if you find any errors.

Usage: /push in chat or push in console.

Info: It has a 5 second cooldown in between uses.


#include <sourcemod>
#include <sdktools>
#define PLUGIN_VERSION "1.1"

static Stamina[33];

public Plugin:myinfo =
{
name = "Player Push",
author = "Krim (Edited for general use by Alm)",
description = "Push players using /push",
version = PLUGIN_VERSION,
url = ""
}

public OnPluginStart()
{
CreateConVar("playerpush_version", PLUGIN_VERSION, "Player Push version", FCVAR_PLUGIN|FCVAR_NOTIFY);
RegConsoleCmd("push", PushPlayer);
}

public OnClientPutInServer(Client)
{
Stamina[Client] = 100;
CreateTimer(0.05, StaminaReturn, Client);
}

public Action:StaminaReturn(Handle:Timer, any:Client)
{
if(!IsClientConnected(Client) || !IsClientInGame(Client))
{
return Plugin_Handled;
}

if(!IsPlayerAlive(Client))
{
CreateTimer(0.05, StaminaReturn, Client);
return Plugin_Handled;
}

if(Stamina[Client] < 100)
{
Stamina[Client] += 1;
}

CreateTimer(0.05, StaminaReturn, Client);
return Plugin_Handled;
}

public Action:PushPlayer(Client, Args)
{
if(Client == 0)
{
return Plugin_Handled;
}

decl Ent;
Ent = GetClientAimTarget(Client, false);

if(Stamina[Client] < 100)
{
PrintToChat(Client, "[SM] You do not have enough stamina to push.");
return Plugin_Handled;
}

if(IsValidEdict(Ent) && IsValidEntity(Ent))
{
if(Ent > 0 && Ent <= GetMaxClients())
{
decl Float:ClientOrigin[3], Float:EntOrigin[3], Float:Dist;

GetClientAbsOrigin(Client, ClientOrigin);
GetClientAbsOrigin(Ent, EntOrigin);
Dist = GetVectorDistance(ClientOrigin, EntOrigin);

if(Dist <= 100)
{
decl Float:Push[3];
decl Float:EyeAngles[3];
GetClientEyeAngles(Client, EyeAngles);
Push[0] = (500.0 * Cosine(DegToRad(EyeAngles[1])));
Push[1] = (500.0 * Sine(DegToRad(EyeAngles[1])));
Push[2] = (-50.0 * Sine(DegToRad(EyeAngles[0])));
TeleportEntity(Ent, NULL_VECTOR, NULL_VECTOR, Push);
}
}
}

return Plugin_Handled;
}

zhelev81
06-07-2009, 20:51
I've restricted the "/" on my server ,can we use "!" instead pls ?

InflatableSoulmate
06-08-2009, 00:12
Because he registered the command with RegConsoleCmd, you should be able to use any of the following combinations to trigger the function:

In chat:
/push
/sm_push
!push
!sm_push

In console:
push
sm_push

zhelev81
06-08-2009, 06:18
Ok I'll try and post back ,but what i saw is the player don't move aside when i type !push in chat and i'm not stucked to anyone ,but on my zombie does because there is something integrated in the ZR. (mod)

I'll post back.

zhelev81
06-08-2009, 07:06
Nope is not working ,we got stucked and we type !push and nothing happened.Can you pls double check the script pls? :)

psychonic
06-08-2009, 08:26
Nope is not working ,we got stucked and we type !push and nothing happened.Can you pls double check the script pls? :)

No Steam, No Support

Edit:
I would also appreciate if you didn't send me angry PMs just because you still want to leech support on here.
What's your problem ? I don't ask you to do anything for me so don't shit over the forum just to get attention.I don't understand people like you ... live your life and don't be an asshole :grrr:

almcaeobtac
06-08-2009, 12:48
this should work (removed the stamina, it's not needed.)


#include <sourcemod>
#include <sdktools>
#define PLUGIN_VERSION "1.1"

public Plugin:myinfo =
{
name = "Player Push",
author = "Krim (Edited for general use by Alm)",
description = "Push players using /push",
version = PLUGIN_VERSION,
url = ""
}

public OnPluginStart()
{
CreateConVar("playerpush_version", PLUGIN_VERSION, "Player Push version", FCVAR_PLUGIN|FCVAR_NOTIFY);
RegConsoleCmd("push", PushPlayer);
}

public Action:PushPlayer(Client, Args)
{
if(Client == 0)
{
return Plugin_Handled;
}

decl Ent;
Ent = GetClientAimTarget(Client, false);

if(IsValidEdict(Ent) && IsValidEntity(Ent))
{
if(Ent > 0 && Ent <= GetMaxClients())
{
decl Float:ClientOrigin[3], Float:EntOrigin[3], Float:Dist;

GetClientAbsOrigin(Client, ClientOrigin);
GetClientAbsOrigin(Ent, EntOrigin);
Dist = GetVectorDistance(ClientOrigin, EntOrigin);

if(Dist <= 100)
{
decl Float:Push[3];
decl Float:EyeAngles[3];
GetClientEyeAngles(Client, EyeAngles);
Push[0] = (500.0 * Cosine(DegToRad(EyeAngles[1])));
Push[1] = (500.0 * Sine(DegToRad(EyeAngles[1])));
Push[2] = (-50.0 * Sine(DegToRad(EyeAngles[0])));
TeleportEntity(Ent, NULL_VECTOR, NULL_VECTOR, Push);
}
}
}

return Plugin_Handled;
}

Greyscale
06-13-2009, 01:31
I've actually created a module in ZR (not yet released) that automatically unsticks you if you are stuck within another player. No manual intervention required. I will release it as a standalone one of these days when I have time :)

CS:S*
06-13-2009, 08:15
I hope this thing will work ... never found something like this on the forum ... it's a need ;)

Schpraaankiii
03-05-2011, 21:18
I need a plugin exactly like this but for cstrike...
Can someone make it? :love: