Raised This Month: $ Target: $400
 0% 

[TF2] Arena capture point questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zeusington
Junior Member
Join Date: Aug 2015
Old 08-09-2015 , 01:07   [TF2] Arena capture point questions
Reply With Quote #1

I'm trying to make it to where you gain a buff when you cap the point instead of simply winning. Thus, questions!
1. Is there a way to block round wins? Is hooking + returning Plugin_Handled with teamplay_round_win the way to go?
2. Is there a way to get / set capture point progress? I know disabling the point resets the progress, but is there a means to directly modify it?

Last edited by Zeusington; 08-09-2015 at 01:08.
Zeusington is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 11-18-2015 , 09:10   Re: [TF2] Arena capture point questions
Reply With Quote #2

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"cappersMAXPLAYERS)>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.0tOnCap_TIMER_FLAG_NO_MAPCHANGE);

    return 
Plugin_Continue;

__________________
Chdata 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 11:46.


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