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

[L4D2] Who throw vomitjar?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
init0
Junior Member
Join Date: Jan 2012
Old 03-18-2012 , 02:09   [L4D2] Who throw vomitjar?
Reply With Quote #1

I would like to see in the chat player nickname who throws a bile bomb. Is it possible?
init0 is offline
init0
Junior Member
Join Date: Jan 2012
Old 03-28-2012 , 22:27   Re: [L4D2] Who throw vomitjar?
Reply With Quote #2

I found event vomit_bomb_tank this is what I'm looking for, or is it just for the tank?
init0 is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 03-29-2012 , 08:04   Re: [L4D2] Who throw vomitjar?
Reply With Quote #3

sounds more like it might be an event for when the tank is biled? why don't you try what it's for? hook the event, get the user id and print out a message.

PHP Code:
#include <sourcemod>

public OnPluginStart()
{    
    
HookEvent("vomit_bomb_tank"VomitBombTankEvent);
}

public 
VomitBombTankEvent(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
 
    if (
client != && !IsFakeClient(client)) PrintToChatAll("Client %N biled something?"client);

Visual77 is offline
init0
Junior Member
Join Date: Jan 2012
Old 03-29-2012 , 09:35   Re: [L4D2] Who throw vomitjar?
Reply With Quote #4

Quote:
Originally Posted by Visual77 View Post
sounds more like it might be an event for when the tank is biled? why don't you try what it's for? hook the event, get the user id and print out a message.
I tried a similar code, but it really works only when a bile bomb thrown into the tank. I found a function with which it works as I need to:
PHP Code:
public OnPluginStart()
{
    
HookEvent("player_now_it"Event_NowVomit);
}

public 
Event_NowVomit(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
thrower GetClientOfUserId(GetEventInt(event"attacker"));
    new 
victim GetClientOfUserId(GetEventInt(event"userid"));
    if (
IsClientInGame(thrower) && !IsFakeClient(thrower) && IsClientInGame(victim) && !IsFakeClient(victim) && !GetEventBool(event"by_boomer"))
    {
    
decl String:thrower_name[MAX_NAME_LENGTH], String:victim_name[MAX_NAME_LENGTH];
    
GetClientName(throwerthrower_namesizeof(thrower_name));
    
GetClientName(victimvictim_namesizeof(victim_name));
    
PrintToChatAll("Player %s threw a bile bomb at %s!"thrower_namevictim_name);
    }

In any case, thanks for responding. Earlier I wrote only in PHP, please check my code. Sorry for my english, im using gtranslate.
init0 is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 03-29-2012 , 10:12   Re: [L4D2] Who throw vomitjar?
Reply With Quote #5

so you solved it then or? code seems fine but you really don't need the string and GetClientName. you could just do it this way, much cleaner.

perhaps also add a IsClientConnected check + a check for the client index, but maybe it's not needed in this case.

PHP Code:
    new thrower GetClientOfUserId(GetEventInt(event"attacker"));
    new 
victim GetClientOfUserId(GetEventInt(event"userid"));

    if (
IsClientInGame(thrower) && !IsFakeClient(thrower) && IsClientInGame(victim) && !IsFakeClient(victim) && !GetEventBool(event"by_boomer"))
    {
          
PrintToChatAll("Player %N threw a bile bomb at %N!"throwervictim);
    } 

Last edited by Visual77; 03-29-2012 at 10:14.
Visual77 is offline
init0
Junior Member
Join Date: Jan 2012
Old 03-29-2012 , 10:47   Re: [L4D2] Who throw vomitjar?
Reply With Quote #6

Visual77 thanks for correction. Yes, this code works as I described in the first message. What do you think it is ready for posting in New Plugins forum?
init0 is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 03-29-2012 , 11:02   Re: [L4D2] Who throw vomitjar?
Reply With Quote #7

yes if you want
Visual77 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 17:30.


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