Raised This Month: $32 Target: $400
 8% 

[TF2] Getting an Event's Information


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ILikePizza555
Junior Member
Join Date: Mar 2012
Old 04-15-2012 , 18:15   [TF2] Getting an Event's Information
Reply With Quote #1

So I am trying to make a plugin that displays who is capping the point and I made this.

Code:
public OnPluginStart()
{
    HookEvent("teamplay_point_startcapture", Event_Point_Captured);
}

public Action:Event_Point_Captured(Handle:Event, const String:name[], bool:dontBroadcast)
{
    new String:Buffer[32];
    GetEventString(Event, "cappers", Buffer, 32); 
    
    PrintCenterTextAll( "%s: %s", "Cappers", Buffer[1]);
}
It compiles fine, only problem is that all it does is display "Cappers:" and thats it.

I'm really new to sourcepawn and ANY help would be greatly appreciated.
__________________
ILikePizza555 is offline
TheAvengers2
BANNED
Join Date: Jul 2011
Old 04-15-2012 , 18:49   Re: [TF2] Getting an Event's Information
Reply With Quote #2

Each character of the "cappers" string is a player index. Perhaps there's only one person capping? If that's the case, then Buffer[1] is likely a null byte. Try to do Buffer[0] instead.

Or perhaps it's storing the ascii character for the client index? If that's the case, then most client indexes wouldn't be printable. You'll need to use %d to print it as a number instead.

Last edited by TheAvengers2; 04-15-2012 at 18:58.
TheAvengers2 is offline
ILikePizza555
Junior Member
Join Date: Mar 2012
Old 04-15-2012 , 20:54   Re: [TF2] Getting an Event's Information
Reply With Quote #3

Quote:
Originally Posted by TheAvengers2 View Post
Each character of the "cappers" string is a player index. Perhaps there's only one person capping? If that's the case, then Buffer[1] is likely a null byte. Try to do Buffer[0] instead.

Or perhaps it's storing the ascii character for the client index? If that's the case, then most client indexes wouldn't be printable. You'll need to use %d to print it as a number instead.
Thanks, it worked! Now to do all the other stuff...
__________________
ILikePizza555 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 23:21.


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