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

[L4D2] ledge_release


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NiceT
Junior Member
Join Date: Mar 2019
Old 03-30-2019 , 08:19   [L4D2] ledge_release
Reply With Quote #1

This plugin allow players release hand when they are hanging.

minHang = CreateConVar("min_Hang_time", "3.0", "the min time you need hold", CVAR_FLAGS, true, 0.0);
dropDmg = CreateConVar("drop_damage", "10.0", "damage when you drop", CVAR_FLAGS, true, 10.0);
CrouchJump = CreateConVar("the mode of release", "0", "[0] = hold crouch, [1] = hold jump", CVAR_FLAGS);


You have two choice:
if CrouchJump == 0, you can hold crouch button to release your hand.
if CrouchJump == 1, you can hold jump button to release your hand.


Are you lost patience to wait teammates' help when you are hanging?
Do you want do something for your team though you are hanging?
Maybe drop will hurt you but you will free and fight with your team rather than just look them been surrounded by zombies.
So you need this.
Attached Files
File Type: sp Get Plugin or Get Source (ledge_release.sp - 372 views - 6.5 KB)
File Type: smx ledge_release.smx (8.0 KB, 142 views)
NiceT is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 04-03-2019 , 12:58   Re: [L4D2] ledge_release
Reply With Quote #2

Thanks.

Possible, duplicate functionality: https://forums.alliedmods.net/showthread.php?p=813465

Also, code is almost identical. Did you forget about credits?

Your plugin cannot be searched via:
https://www.sourcemod.net/plugins.ph...tion=&search=1
because you put two words toghether "ledge_release".

Code:
#define MaxClients 24
Why? Client indeces can be more than 24. You will have array index out of range sooner or later in below code:

Code:
new clients = GetClientCount();
for (x = 1; x <= clients; x++)
Client indeces can be random (torn sequence), so you will miss some clients. Use:
Code:
for (x = 1; x <= MaxClients; x++)
Also, IsValidEntity is superfluous, included in IsClientInGame check.

OnPluginStart() is a bad place for CreateTimer + TIMER_REPEAT.
When round is lost, your timer will be invalidated and not re-loaded again. Best option to hook round_start event.
I also faced some problems with invalidating timer on sv_hibernate_when_empty 0 and not starting again OnPluginStart, but I don't remember exact settings.

Code:
HookEvent("round_end", EventRoundEnd, EventHookMode_Pre);
round_end doesn't happen on force change level. So OnMapEnd() is additionally should be used.
Also, it is not happen under some special circumstances. Personally I'm using:
Code:
HookEvent("round_end", 				Event_RoundEnd,		EventHookMode_Pre);
HookEvent("finale_win", 			Event_RoundEnd,		EventHookMode_Pre);
HookEvent("mission_lost", 			Event_RoundEnd,		EventHookMode_Pre);
HookEvent("map_transition", 		Event_RoundEnd,		EventHookMode_Pre);
for sure.
BTW, EventHookMode_Pre is not need for your case.

Code:
CreateTimer(1.0/TICKS, PlayerTimer, x, TIMER_REPEAT);
Since you don't use GetClientUserId as timer parameter and GetClientTeam check in callback,
it is highly possible that index took infected client as soon as survivor disconnected,
so you will query for netprop they even don't have.

Code:
new buttons = GetClientButtons(client);
You can use OnPlayerRunCmd() forward instead of waste CPU cycles.

Even, without it, you already have "player_ledge_grab" event, why waste CPU cycles when nobody hangs on the ledge. Use that event instead + "player_ledge_release" or above forward, see example here:
https://forums.alliedmods.net/showth...16564?p=916564

Code:
	new bIncap = GetEntProp(client, Prop_Send, "m_isIncapacitated");
	new bHang = GetEntProp(client, Prop_Send, "m_isHangingFromLedge");
Just curious, what cases we hang on ledge, but not incap?

Code:
client < MaxClients
should be client <= MaxClients
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
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 16:25.


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