AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [TF2] Getting an Event's Information (https://forums.alliedmods.net/showthread.php?t=182972)

ILikePizza555 04-15-2012 18:15

[TF2] Getting an Event's Information
 
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.

TheAvengers2 04-15-2012 18:49

Re: [TF2] Getting an Event's Information
 
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.

ILikePizza555 04-15-2012 20:54

Re: [TF2] Getting an Event's Information
 
Quote:

Originally Posted by TheAvengers2 (Post 1689959)
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...


All times are GMT -4. The time now is 16:43.

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