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

Solved [L4D2] SteamWorks Friendly Fire Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alcybery
Member
Join Date: Apr 2016
Old 07-22-2017 , 19:37   [L4D2] SteamWorks Friendly Fire Plugin
Reply With Quote #1

Hello
Can someone help me modify this plugin:
PHP Code:
public OnClientConnected(client)
{
    if (
IsValidPlayer(client) && !IsFakeClient(client))
    {
        
CPrintToChatAll("{olive}%N {default}is {blue}connecting{default} to the server"client);
    }
}

static 
bool:IsValidPlayer(client
{
    if (
client <= MaxClients)
        return 
true;
    return 
false;

to also show player's average friendly fire damage in L4D2.

I have modified version of Connect Announce that shows player's hours played, it has these code added to it:
PHP Code:
    if (StrContains(auth"STEAM") == 0)
    {
        
SteamWorks_RequestStats(client550);
    } 
and
PHP Code:
if (StrContains(rawmsg"{HOURS}") != -1
{
    
decl String:sGamePlayHours[32];
    new 
iGamePlaySeconds;
    if (!
SteamWorks_GetStatCell(client"Stat.TotalPlayTime.Total"iGamePlaySeconds))
    {
        
iGamePlaySeconds = -1;
    }
    
Format(sGamePlayHourssizeof(sGamePlayHours), "%.01f"iGamePlaySeconds >= ? (float(iGamePlaySeconds) / 3600.0) : -1.0);
    
ReplaceString(rawmsgsizeof(rawmsg), "{HOURS}"sGamePlayHours);

Name for friendly fire cell is Stat.FFDamageGame.Avg
I think that it's possible to use that code, but my programming knowledge isn't anywhere near that

Last edited by alcybery; 06-26-2018 at 13:22.
alcybery is offline
Deathknife
Senior Member
Join Date: Aug 2014
Old 07-22-2017 , 20:47   Re: SteamWorks Friendly Fire Plugin
Reply With Quote #2

Is this what you are looking for?
PHP Code:
if (StrContains(rawmsg"{FFDAMAGE}") != -1
{
    
decl String:sDamageDone[8];
    
float ffDamageDone;
    if (!
SteamWorks_GetStatFloat(client"Stat.FFDamageGame.Avg"ffDamageDone))
    {
        
ffDamageDone = -1;
    }
    
Format(sDamageDonesizeof(sDamageDone), "%.02f"ffDamageDone);
    
ReplaceString(rawmsgsizeof(rawmsg), "{FFDAMAGE}"sDamageDone);

__________________
Deathknife is offline
alcybery
Member
Join Date: Apr 2016
Old 07-22-2017 , 21:28   Re: SteamWorks Friendly Fire Plugin
Reply With Quote #3

Quote:
Originally Posted by Deathknife View Post
Is this what you are looking for?
PHP Code:
if (StrContains(rawmsg"{FFDAMAGE}") != -1
{
    
decl String:sDamageDone[8];
    
float ffDamageDone;
    if (!
SteamWorks_GetStatFloat(client"Stat.FFDamageGame.Avg"ffDamageDone))
    {
        
ffDamageDone = -1;
    }
    
Format(sDamageDonesizeof(sDamageDone), "%.02f"ffDamageDone);
    
ReplaceString(rawmsgsizeof(rawmsg), "{FFDAMAGE}"sDamageDone);

It looks like it's for Connect Announce plugin, but I wanted add ff info in the first plugin, one with OnClientConnected

Edit: Actually it seems to be better in Connect Announce message, so thanks for helping with that. Only thing is I get tag mismatch warning on ffDamageDone = -1; line, don't know if it's important or not.

Last edited by alcybery; 07-23-2017 at 16:17.
alcybery 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 02:15.


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