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
__________________