Raised This Month: $ Target: $400
 0% 

[L4D2] Player/Server Notification


Post New Thread Reply   
 
Thread Tools Display Modes
rek075
Member
Join Date: Oct 2009
Old 02-13-2010 , 17:30   Re: [L4D2] Player/Server Notification
Reply With Quote #11

Why not just add the disconnect function and team change function to the existing connect notification plugin nuwit posted? Looking at the code, it looks almost exactly the same... the first 22 lines anyway.
rek075 is offline
dirka_dirka
Veteran Member
Join Date: Nov 2009
Old 02-14-2010 , 10:17   Re: [L4D2] Player/Server Notification
Reply With Quote #12

Quote:
Originally Posted by Blu3star View Post
Now it spams all the bots connect/disconnect during play, when they die, and when they are spawned again. Including the infected.
yarp, need to check for bots so we dont see all that.. at least for the infected. it really sucks having the survivors know what they have to deal with.
dirka_dirka is offline
Blu3star
Member
Join Date: Jul 2009
Old 02-14-2010 , 13:47   Re: [L4D2] Player/Server Notification
Reply With Quote #13

just put
if(IsFakeClient(client))
return Plugin_Continue;
before announcing.
Blu3star is offline
kiwi87
Member
Join Date: Sep 2009
Old 02-14-2010 , 16:49   Re: [L4D2] Player/Server Notification
Reply With Quote #14

Quote:
Originally Posted by Blu3star View Post
just put
if(IsFakeClient(client))
return Plugin_Continue;
before announcing.
I tried,

case 1:
{
if(IsFakeClient(playerClient))
return Plugin_Continue;
PrintToChatAll("%N", playerClient)
}

warning 209: Function "Jointeam" should return a value.


Hm...testing

Last edited by kiwi87; 02-14-2010 at 16:53.
kiwi87 is offline
dirka_dirka
Veteran Member
Join Date: Nov 2009
Old 02-14-2010 , 16:58   Re: [L4D2] Player/Server Notification
Reply With Quote #15

for the team changing area kiwi, it isnt client, its playerClient

and it would be better to just put the whole switch inside:
if (!IsFakeClient(playerClient)) { SWITCH }
else { return Plugin_Continue; }

you could use what blu3star posted in the other 2 sections (onclientconnect and disconnect).
dirka_dirka is offline
Skyy
AlliedModders Donor
Join Date: Jan 2010
Location: Toronto, Canada
Old 02-16-2010 , 02:41   Re: [L4D2] Player/Server Notification
Reply With Quote #16

I've written a new batch of code... Uploading now.
Skyy is offline
Skyy
AlliedModders Donor
Join Date: Jan 2010
Location: Toronto, Canada
Old 02-16-2010 , 02:46   Re: [L4D2] Player/Server Notification
Reply With Quote #17

I've rewritten the code and removed bot notifications. Let me know your feelings.
Skyy is offline
psychonic

BAFFLED
Join Date: May 2008
Old 04-23-2010 , 20:47   Re: [L4D2] Player/Server Notification
Reply With Quote #18

Skyy, you need to add a check in the team change callback to make sure the client index is valid (IsClientInGame) else there is a chance for runtime errors.

Also, comments like these don't really belong in a plugin... this isn't the AMXX forum.

PHP Code:
//Buttsex and monkeys
//...Ignore that.
...
// I am such a fucking idiot.
// /Wrist 
psychonic is offline
kiwi87
Member
Join Date: Sep 2009
Old 05-03-2010 , 17:26   Re: [L4D2] Player/Server Notification
Reply With Quote #19

L 05/04/2010 - 05:25:42: [SM] Native "IsFakeClient" reported: Client index 0 is invalid
L 05/04/2010 - 05:25:42: [SM] Displaying call stack trace for plugin "playerinfo.smx":
L 05/04/2010 - 05:25:42: [SM] [0] Line 50, /home/groups/alliedmodders/forums/files/6/9/2/0/5/59842.attach::JoinTeam()


Any fix on this? Its spamming my dedi svr's console
kiwi87 is offline
dirka_dirka
Veteran Member
Join Date: Nov 2009
Old 05-03-2010 , 18:13   Re: [L4D2] Player/Server Notification
Reply With Quote #20

OnClientConnected is still commented out while OnClientDisconnect is what should be commented out. The primary reason to be using this plugin is wasted.

Its also rather spammy when people connect and join their team (they actually join 2 teams - spectator first).

I replaced OnClientConnected, OnClientDisconnect and JoinTeam with the following:
PHP Code:
public OnClientConnected(client)
{    
    if (
IsFakeClient(client)) return;
    
    
Joining[client] = false;
    
    
CSkipNextClient(client);
    
CPrintToChatAll("%sPlayer: {green}%N{default} has connected to the server."TAG_INFOclient);
}

public 
OnClientDisconnect(client)
{
    if (
IsFakeClient(client)) return;
    
    
Joining[client] = false;
    
/*     Don't need the disconnect - L4D2 already reports that.. Leaving this here for when Valve breaks yet another function.
    CSkipNextClient(client);
    CPrintToChatAll("%sPlayer: {green}%N{default} has disconnected from the server.", TAG_INFO, client);
*/
}

public 
JoinTeam(Handle:eventString:event_name[], bool:dontBroadcast)
{
    new 
playerClient GetClientOfUserId(GetEventInt(event"userid"));
    new 
clientTeam GetEventInt(event"team");
    
    if (!
playerClient) return;
    if (
IsFakeClient(playerClient)) return;
    
    new 
Handle:pack;
    
    if (
Joining[playerClient])        // If the player has just changed teams recently..
    
{
        
KillTimer(JoiningTimer[playerClient]);
        
JoiningTimer[playerClient] = CreateDataTimer(1.0AnnounceJoiningpack);
        
WritePackCell(packplayerClient);
        
WritePackCell(packclientTeam);
    }
    else                             
// This is the first team join the player has done..
    
{
        
Joining[playerClient] = true;
        
JoiningTimer[playerClient] = CreateDataTimer(1.0AnnounceJoiningpack);
        
WritePackCell(packplayerClient);
        
WritePackCell(packclientTeam);
    }

I also added this:
PHP Code:
#include <colors>
new bool:Joining[MAXPLAYERS+1];                    // No need to spam  join specator, join team when someone connects..
new Handle:JoiningTimer[MAXPLAYERS+1];            // Used to disable  joining specator team when someone connects.
#define TAG_INFO    "{lightgreen}[Join]{default} "

public Action:AnnounceJoining(Handle:timerHandle:pack)
{
    
ResetPack(pack);
    new 
playerClient ReadPackCell(pack);
    new 
clientTeam ReadPackCell(pack);
    
    if (!
Joining[playerClient]) return;
    
Joining[playerClient] = false;
    
    
CSkipNextClient(playerClient);  // No need to tell this person they  are joining a team.. they already know.
    
switch (clientTeam)
    {
        case 
TEAM_SPECTATORS:
        {
            
CPrintToChatAll("%sPlayer: {green}%N{default} has joined the  Spectators."TAG_INFOplayerClient);
        }
        case 
TEAM_SURVIVORS:
        {
            
CPrintToChatAll("%sPlayer: {green}%N{default} has joined the  Survivors."TAG_INFOplayerClient);
        }
        case 
TEAM_INFECTED:
        {
            
Joining[playerClient] = false;
            
            
CPrintToChatAll("%sPlayer: {green}%N{default} has joined the  Infected."TAG_INFOplayerClient);
        }
    }

It uses Colors.inc.. if you dont want to use that, replace the CPrintToChat's with PrintToChat's and remove the CSkipNextClient's. Also change the {lightgreen}, etcs to \x03's or just remove them if you dont want any color.

Anyway, it will wait 1 second after someone changes teams to report it. If they change again during that time, the first report wont show up. Cuts down on the connecting spam quite a bit (~33%). You also dont see your own messages (the CSkipNextClient lines), you already know when you change teams.


the error messages kiwi is getting, i believe results in the lack of this line:
Code:
if (!playerClient) return;
dirka_dirka 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 12:23.


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