Hooking an event only blocks the event, and the event is more or less only "data describing what happened", but not the actual set of functions that handles ending the round, setting humiliation state on the losers, setting a timer to reset the map, etc.
Of course, some events also do things with that data, for example, player_hurt's damageamount is sent back to clients and that controls what hitnumbers you see above people's heads. player_healonhit works the same way. Things like the attacker index, inflictor, patient, or victim control who's head the marker appears above.
In any case, my surrender button doesn't block round winning, it merely forces the opposite team to win a frame before the capturing team wins.
PHP Code:
/*
Used to initialize the following:
- CVARs
- Hooks
*/
public OnPluginStart()
{
HookEvent("teamplay_round_start", evRoundStart); // Whatever people have told you, this hook actually does work in arena.
HookEvent("teamplay_point_captured", evCapped);
}
/*
If some jackass caps...
*/
public Action:evCapped(Handle:hEvent, const String:sName[], bool:bDontBroadcast)
{
if (!g_bEnabled)
{
return Plugin_Continue;
}
new iTeam = GetEventInt(hEvent, "team");
if (iTeam > TEAM_SPEC && CheckAlivePlayers() <= GetConVarInt(FindConVar("hale_point_alive")))
{
ForceTeamWin(iTeam == TEAM_RED ? TEAM_BLU : TEAM_RED); // You can set the winner to TEAM_SPEC to force a stalemate
}
else
{
// SetControlPoint(false);
decl String:cappers[MAXPLAYERS+1] = "";
if (GetEventString(hEvent,"cappers", cappers, MAXPLAYERS)>0)
{
new len = strlen(cappers);
for(new i=0;i<len;i++)
{
//new iClient = cappers[i];
ForcePlayerSuicide(cappers[i]);
// CPrintToChatAll("{olive}[VSH]{default} %N captured the Surrender button. For Shame.");
// if(iClient>0 && iClient<=MaxClients && IsClientInGame(iClient))
// {
// // do what you want, 'cause a pirate is free
// }
}
}
}
CreateTimer(6.0, tOnCap, _, TIMER_FLAG_NO_MAPCHANGE);
return Plugin_Continue;
}
__________________