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

[Example] Changing player score


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
raydan
Senior Member
Join Date: Aug 2006
Old 12-20-2008 , 04:16   [Example] Changing player score
Reply With Quote #1

Here is the sample plugin to using "IncrementFragCount" to change player score. As we know, we can use "m_iFrags" or "m_iDeaths" to change score and death in game scoreboard, but you can't see updated data in server info.

In this example, you can add/set/reset scroe/death value in scorebaord and server info

PS: setting too high score/death value, scoreboard can't show correct value, but server info still display the real one.

Code:
RegConsoleCmd("add_score", add_5_score); // add 5 score
 RegConsoleCmd("add_death", add_5_death); // add 5 death
 
 RegConsoleCmd("reset_score", reset_score); //reset score to 0
 RegConsoleCmd("reset_death", reset_death); //reset death to 0
 
 RegConsoleCmd("set_score", set_score_to_4321); // set score to 4321
 RegConsoleCmd("set_death", set_death_to_4321); // set death to 4321
[IMG]http://img397.**************/img397/3369/omg12345scoreag2.jpg[/IMG]
Attached Files
File Type: txt weaponmodel.txt (1.4 KB, 387 views)
File Type: sp Get Plugin or Get Source (playerscore.sp - 1122 views - 2.6 KB)
raydan is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 12-20-2008 , 13:18   Re: [Example] Changing player score
Reply With Quote #2

Can't you just change m_iScore for players in CS:S?
bl4nk is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 12-20-2008 , 21:02   Re: [Example] Changing player score
Reply With Quote #3

I am thinking maybe that doesnt change it in the server window outside of game that he posted, so thats what this extention does. Not sure though.
__________________
CrimsonGT is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 12-21-2008 , 04:56   Re: [Example] Changing player score
Reply With Quote #4

Anything with new signatures is fun to play with
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
Forlix
Senior Member
Join Date: Dec 2008
Location: Hamburg, Germany
Old 01-11-2009 , 11:11   Re: [Example] Changing player score
Reply With Quote #5

Another solution, without all those "complicated" SDK calls:

Global variable:
PHP Code:
new game_score_index
On round_start:
PHP Code:
  game_score_index CreateEntityByName("game_score");
  
DispatchSpawn(game_score_index); 
When you want to update someones score (in this example decrease by one):

PHP Code:
      SetEntProp(clientProp_Data"m_iFrags"GetClientFrags(client)-1);
      
AcceptEntityInput(game_score_index"ApplyScore"clientgame_score_index); 
Works perfectly with CS:S and server query.
Of course you can also only use game_score to increase or decrease, but the way above is more flexible - you only need one entity, can set the scores to your hearts content, and then simply trigger an update.
Forlix is offline
Send a message via ICQ to Forlix Send a message via MSN to Forlix
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 06:37.


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