Raised This Month: $ Target: $400
 0% 

How to get and increase player score?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pawemol12
Member
Join Date: Jun 2012
Location: Poland - Wojnowice
Old 07-22-2012 , 14:33   How to get and increase player score?
Reply With Quote #1

Hi,

In left4dead2 infected players have score. But i dont know how to get their score to plugin. I tried:
Code:
                new punkty = GetEntProp(client, Prop_Data, "m_Score");
                PrintToChat(client, "Twoje punkty: %i", punkty);
But doesnt work. I cant see this message in game. How to get player score?

Ps. I find this function:
GetClientInfo


But i dont know what write in second argument.

Last edited by Pawemol12; 07-22-2012 at 14:35.
Pawemol12 is offline
dyceman
Member
Join Date: Jul 2012
Old 07-22-2012 , 15:36   Re: How to get and increase player score?
Reply With Quote #2

I am not sure for LFD2 but for tf2 it is. I guess look for a function like this one.
TF2_SetPlayerResourceData(client,
TFResource_Score, 1)

Last edited by dyceman; 07-22-2012 at 15:37.
dyceman is offline
Pawemol12
Member
Join Date: Jun 2012
Location: Poland - Wojnowice
Old 07-22-2012 , 15:39   Re: How to get and increase player score?
Reply With Quote #3

I'm looking for function for l4d2, not TF2.
Pawemol12 is offline
dyceman
Member
Join Date: Jul 2012
Old 07-22-2012 , 15:50   Re: How to get and increase player score?
Reply With Quote #4

How about look at this person's plugin http://forums.alliedmods.net/showthread.php?p=1029519
dyceman is offline
Pawemol12
Member
Join Date: Jun 2012
Location: Poland - Wojnowice
Old 07-22-2012 , 16:29   Re: How to get and increase player score?
Reply With Quote #5

Hmm, I have a problem there as any to find.
Pawemol12 is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 07-22-2012 , 17:40   Re: How to get and increase player score?
Reply With Quote #6

Have you tried GetClientFrags already ?
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
Pawemol12
Member
Join Date: Jun 2012
Location: Poland - Wojnowice
Old 07-23-2012 , 12:52   Re: How to get and increase player score?
Reply With Quote #7

Doesnt work It always return 0
Pawemol12 is offline
WinterLady
Junior Member
Join Date: May 2023
Old 06-26-2023 , 00:57   Re: How to get and increase player score?
Reply With Quote #8

Quote:
Originally Posted by Pawemol12 View Post
Doesnt work It always return 0
Hi, I wanted to get infected score as well, and did a bit of testing. I know it's a very old post, but I'm posting what I found out just in case anyone's coming to this thread for the answer.

`GetClientFrags` gets the client's overall score in game (the one that shows in game info). it's calculated by # of SI kills minus some deaths-related factors. I don't know about all these factors, but the survivor death or suicide as an infected seems to be counted as -1. Since the only + factor is the SI kills, it's more based on the survivor side.

You can use `L4D_GetPlayerResourceData` in l4d_stocks.inc by "Mr. Zero" to get the infected score that shows when you press tab in game.
https://github.com/spumer/hardmod2/b...l4d_stocks.inc
PHP Code:
stock L4D_GetPlayerResourceData(clientL4DResourceType:type)
{
    if (!
IsClientConnected(client))
    {
        return -
1;
    }

    new 
offset FindSendPropInfo("CTerrorPlayerResource"L4DResourceName[type]);

    if (
offset 1)
    {
        return -
1;
    }

    new 
entity L4D_GetResourceEntity();

    if (
entity == -1)
    {
        return -
1;
    }

    return 
GetEntData(entityoffset + (client 4));

PHP Code:
#include <l4d_stocks>
L4D_GetPlayerResourceData(clientL4DResource_Score); 
The score is 0 if the client is currently on the survivor team. And you can probably use `L4D_SetPlayerResourceData` to set their infected score. Hope this helps!

Last edited by WinterLady; 06-26-2023 at 10:50.
WinterLady is offline
sorallll
Senior Member
Join Date: Oct 2018
Old 06-26-2023 , 04:53   Re: How to get and increase player score?
Reply With Quote #9

PHP Code:
#include <sdkhooks>
int m_iScore GetEntProp(GetPlayerResourceEntity(), Prop_Send"m_iScore"_client

Last edited by sorallll; 06-26-2023 at 07:21.
sorallll 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 09:47.


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