Page 1 of 1

[CSGO] Getting and setting player score

Posted: Mon Nov 13, 2017 1:40 am
by VinciT
I'm trying to change the score of a player (last column on the scoreboard), but I'm not sure how to do it.
Any ideas?

Re: [CSGO] Getting and setting player score

Posted: Mon Nov 13, 2017 1:50 am
by L'In20Cible
Player.kills/deaths

Syntax: Select all

player = Player(index)
player.kills = 0
player.deaths = 999
print(f'{player.name} is a noob, check the scoreboard!')

Re: [CSGO] Getting and setting player score

Posted: Mon Nov 13, 2017 2:19 am
by VinciT
Is there no way to directly change the score, without changing the player's kills?
When I change the player's assists, the score doesn't update, so I'm trying to correct that by changing the score itself.

Re: [CSGO] Getting and setting player score

Posted: Mon Nov 13, 2017 2:20 am
by L'In20Cible
What is your code?

Re: [CSGO] Getting and setting player score

Posted: Mon Nov 13, 2017 2:57 am
by VinciT
Here's the code:

Syntax: Select all

#assists_test.py
from players.entity import Player

from commands import CommandReturn
from commands.client import ClientCommand


@ClientCommand('add_assist')
def _add_assist(command, index):
player = Player(index)
player.assists += 1
return CommandReturn.BLOCK

Re: [CSGO] Getting and setting player score

Posted: Mon Nov 13, 2017 3:04 am
by satoon101
I know that the score is based off of kills and assists, but possibly also includes bomb detonations/defusals and hostage rescues. So, I'm not sure that modifying kills or assists would automatically change the score. I have looked into this a little, but I haven't figured out how to get/set the score in a plugin.

Re: [CSGO] Getting and setting player score

Posted: Mon Nov 13, 2017 3:35 am
by VinciT
I just found this in SourceMod. Although I'm not sure how to do the exact same thing in SP.