Raised This Month: $ Target: $400
 0% 

print text when a hunter, somoker boomer spawns?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Austinbots
Member
Join Date: Jan 2010
Old 12-11-2010 , 21:40   print text when a hunter, somoker boomer spawns?
Reply With Quote #1

I want to print text on the hud when a hunter, boomer, or smoker spawns.

I would also like to print text on the hud when a horde spawns.

Can someone give me an example on how to do this?
Thanks.
Austinbots is offline
Samantha
SourceMod Donor
Join Date: Feb 2010
Location: Madagascar
Old 12-11-2010 , 23:51   Re: print text when a hunter, somoker boomer spawns?
Reply With Quote #2

In the last analysis relevant progression should facilitate activity based learning. That being said HookEntityOutput or Hook Entity Spawn using sdkhooks, would seem the most relevant solution to your issue.
__________________
"I give sopport and knolage in making extractions"
"MASTER(D) - dun0: are you mocing me?" -Master the grate

Plugins
Godmode Until Attack | No Block Team Filter
Extensions
Rcon Hooks
Samantha is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 12-12-2010 , 03:07   Re: print text when a hunter, somoker boomer spawns?
Reply With Quote #3

I would use the player_spawn event for special infected.
__________________
Silvers is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 12-12-2010 , 11:38   Re: print text when a hunter, somoker boomer spawns?
Reply With Quote #4

Quote:
Originally Posted by samantharp View Post
In the last analysis relevant progression should facilitate activity based learning.
What the hell?
__________________
FaTony is offline
Austinbots
Member
Join Date: Jan 2010
Old 12-14-2010 , 23:11   Re: print text when a hunter, somoker boomer spawns?
Reply With Quote #5

Quote:
Originally Posted by FaTony View Post
What the hell?
I think this means "figure it out yourself."
At least he included some hints at how to get it done.

Silvers,
"I would use the player_spawn event for special infected."


Ok i tried the following and all I get printed is player_spawn myname

I never get any messages about the specials.
PHP Code:
public OnPluginStart()
{
    
HookEvent("player_spawn"PlayerSpawnEvent);
}

public 
Action:PlayerSpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
    new 
String:clientname[64];
    new 
client GetClientOfUserId(GetEventInt(event,"userid"));
    
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i))
        {
            
GetClientName(clientclientnamesizeof(clientname));
            
PrintToChat(client"PlayerSpawnEvent Spawned: %s Player: %s"nameclientname);
        }
    }

Austinbots is offline
Mr. Zero
Veteran Member
Join Date: Jun 2009
Location: Denmark
Old 12-15-2010 , 00:34   Re: print text when a hunter, somoker boomer spawns?
Reply With Quote #6

player_spawn doesn't exist in L4D2, only in L4D. Don't know why Valve removed it.

When do you want to print the text?
When they spawn into the world, or spawn as ghosts?

If you want to print when they spawn as ghosts you could run a timer and check if they are alive and in ghost mode. Alternatively you could use Left 4 Downtown 2s L4D_OnEnterGhostState forward.

If you want when they spawn into the world, I guess you would have to run a timer and check their state.
PHP Code:
if (IsPlayerAlive(client) && GetEntProp(clientProp_Send"m_isGhost"1)) { player is spawned into the world 
Mr. Zero is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 12-15-2010 , 04:20   Re: print text when a hunter, somoker boomer spawns?
Reply With Quote #7

lol what? player_spawn is a generic source event, it does exist...

Austinbots: What are you doing looping through the clients in-game? The event returns the userID of the player just spawned, and it registers for survivors and infected...


PHP Code:
public OnPluginStart()
{
    
HookEvent("player_spawn"PlayerSpawnEvent);
}

public 
Action:PlayerSpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event,"userid"));
 
    
PrintToServer("PlayerSpawnEvent Spawned: %s Player: %N"nameclient);
    
PrintToChatAll("PlayerSpawnEvent Spawned: %s Player: %N"nameclient);

You were printing to the chat of the client who spawned also, wtf...

This works..
__________________
Silvers is offline
Austinbots
Member
Join Date: Jan 2010
Old 12-16-2010 , 03:14   Re: print text when a hunter, somoker boomer spawns?
Reply With Quote #8

Thanks for the help everyone.
I got it working.
You see orange text when the

smoker!
hunter!
boomer!
spitter!
jockey!
tank!

spawn.

This looks like it displays when they spawn in the map ready to engage, not when they are spawning in as a ghost.
PHP Code:
public Action:PlayerSpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
    new 
String:clientname[64];
    new 
clientID GetClientOfUserId(GetEventInt(event,"userid"));

    
GetClientName(clientIDclientnamesizeof(clientname));
    
PrintToChatAll("\x04 %s!",clientname);

Sometimes a "(1)" appears in front of the name.
Does this mean there are two of these specials in the map at the same time?

How do I keep from showing the human+bots spawning and only show the special spawning?

Finally, how do I add in showing when a horde spawns?
tx
Attached Thumbnails
Click image for larger version

Name:	c1m1_hotel0000.jpg
Views:	176
Size:	11.9 KB
ID:	79189  
Austinbots is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 12-16-2010 , 05:08   Re: print text when a hunter, somoker boomer spawns?
Reply With Quote #9

PHP Code:
public Action:PlayerSpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
    new 
String:clientname[64];
    new 
clientID GetClientOfUserId(GetEventInt(event,"userid"));
    if( 
GetClientTeam(client) == // Check they are Infected Team
    
{
        
GetClientName(clientIDclientnamesizeof(clientname));
        
PrintToChatAll("\x04 %s!",clientname);
    }

Yeah the (1) means there are multiple. You want to stop showing the message if the Special is a bot? Use IsFakeClient()
__________________
Silvers is offline
Austinbots
Member
Join Date: Jan 2010
Old 12-17-2010 , 13:48   Re: print text when a hunter, somoker boomer spawns?
Reply With Quote #10

Quote:
Originally Posted by Austinbots View Post
I would also like to print text on the hud when a horde spawns.
Silvers, thanks to you, have the specials part of this plug in working perfectly.

Do you have any ideas on how I would print a text message when a horde spawns?

Last edited by Austinbots; 12-17-2010 at 16:08.
Austinbots 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:39.


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