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

[TF2] Capture point message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Master Cake
Junior Member
Join Date: May 2020
Location: Planet Earth
Old 08-24-2020 , 11:48   [TF2] Capture point message
Reply With Quote #1

Hello there! Can anybody explain me how to print capture point message with text like "<PlayerName> captured 1 point"? I mean message in the upper right corner (not chat message)
Master Cake is offline
SSheriFF
AlliedModders Donor
Join Date: May 2020
Location: Israel
Old 08-24-2020 , 11:57   Re: [TF2] Capture point message
Reply With Quote #2

Quote:
Originally Posted by Master Cake View Post
Hello there! Can anybody explain me how to print capture point message with text like "<PlayerName> captured 1 point"? I mean message in the upper right corner (not chat message)
Take a look at https://wiki.alliedmods.net/Team_For...point_captured
http://www.sourcemod.net/new-api/hal...tHudTextParams
http://www.sourcemod.net/new-api/halflife/ShowHudText
__________________
Taking small private requests (Free) and big private requests (Paid).
Contact me via Discord: WilDick#1524

My Plugins:
SSheriFF is offline
Master Cake
Junior Member
Join Date: May 2020
Location: Planet Earth
Old 08-25-2020 , 05:29   Re: [TF2] Capture point message
Reply With Quote #3

Ok but how can I make trigger to print such message?

If I make console command for this
Master Cake is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 08-26-2020 , 05:32   Re: [TF2] Capture point message
Reply With Quote #4

Event list "cappers" as multi-byte character. (\x01\x03\x08)

So in this example, I separate those characters, format to hex and finally format string to int value.
This only print in chat and server console.
PHP Code:

/*
    Event examples (net_showevents 2)
Server event "teamplay_point_captured", Tick 381359:
- "cp" = "0"
- "cpname" = "#Dustbowl_cap_1_A"
- "team" = "3"
- "cappers" = ""

Bacardi, Archimedes!, Kill Me captured First Cap, Stage One for team #3


Server event "teamplay_point_captured", Tick 389792:
- "cp" = "1"
- "cpname" = "#Dustbowl_cap_1_B"
- "team" = "3"
- "cappers" = ""

Bacardi, Archimedes!, Kill Me captured Second Cap, Stage One for team #3


Server event "teamplay_point_captured", Tick 397158:
- "cp" = "2"
- "cpname" = "#Dustbowl_cap_2_A"
- "team" = "3"
- "cappers" = ""

Bacardi, Archimedes! captured First Cap, Stage Two for team #3


Server event "teamplay_point_captured", Tick 400800:
- "cp" = "3"
- "cpname" = "#Dustbowl_cap_2_B"
- "team" = "3"
- "cappers" = ""

Bacardi, Archimedes! captured Second Cap, Stage Two for team #3


Server event "teamplay_point_captured", Tick 407082:
- "cp" = "4"
- "cpname" = "#Dustbowl_cap_3_A"
- "team" = "3"
- "cappers" = ""

Bacardi, Freakin' Unbelievable captured First Cap, Stage Three for team #3


Server event "teamplay_point_captured", Tick 410249:
- "cp" = "5"
- "cpname" = "#Dustbowl_cap_3_B"
- "team" = "3"
- "cappers" = ""

Bacardi, Freakin' Unbelievable, Archimedes! captured the Rocket, Final Cap for team #3

*/


public void OnPluginStart()
{
    
HookEvent("teamplay_point_captured"teamplay_point_captured);
}

public 
void teamplay_point_captured(Event eventchar[] namebool dontBroadcast)
{
    
char cappers[32];        // example, event output "cappers" string: \x01\x02\x03
    
char character[5];        // to store single multibyte char
    
int client_index;

    
char message[200];

    
event.GetString("cappers"capperssizeof(cappers));

    
int cappers_count strlen(cappers);
    
int[] cappers_array = new int[cappers_count]; // store client indexs
    
    
for(int x 0cappers_countx++)
    {
        
//Format(character, sizeof(character), "%c", cappers[x]);
        //Format(character, sizeof(character), "%02X", character);

        //client_index = StringToInt(character, 16); // hex base 16
        // updated 28.8.2020
        
client_index view_as<int>(cappers[x]);

        
Format(messagesizeof(message), "%s, %N"messageclient_index);
        
cappers_array[x] = client_index;
    }
    


    
PrintToChatAll("%s captured control point"message[2]);
    
    for(
int y 0cappers_county++)
    {
        
PrintToServer("%N"cappers_array[y]);
    }


Attached Thumbnails
Click image for larger version

Name:	event cappers.png
Views:	87
Size:	36.8 KB
ID:	183405  
__________________
Do not Private Message @me

Last edited by Bacardi; 08-28-2020 at 08:28. Reason: seems work with view_as<int>(cappers[x])
Bacardi is offline
Master Cake
Junior Member
Join Date: May 2020
Location: Planet Earth
Old 08-28-2020 , 06:59   Re: [TF2] Capture point message
Reply With Quote #5

Well thanks I will try it
Master Cake is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 10-24-2020 , 21:04   Re: [TF2] Capture point message
Reply With Quote #6

Here's a short plugin I made using the information posted above by Barcardi. The names of players who captured the point will be displayed in the server console. Any Human players who capture the point will be given a short 5 second buff and told via chat that they are receiving a buff for capturing the point.

The whole multibyte character didn't make much sense to me until I saw Barcardi illustrate it. Thanks Barcardi!
Attached Files
File Type: sp Get Plugin or Get Source (whocaptured.sp - 147 views - 2.3 KB)
PC Gamer is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-24-2020 , 21:16   Re: [TF2] Capture point message
Reply With Quote #7

Bacardi 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 09:29.


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