Raised This Month: $ Target: $400
 0% 

[OB] Change Team Score


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 04-08-2012 , 09:25   [OB] Change Team Score
Reply With Quote #1

Edit: https://forums.alliedmods.net/showthread.php?t=183257

The SetTeamScore native (m_iScore) allows you to change the score visually, but it doesn't get saved by the engine (as of OB) and will reset to its 'real' value after a round has ended.

Here is one method to change the real value:
Code:
/* Change a team's score by +/- amount of points. */ stock bool:Team_ApplyScore(team, points) {     // A player must exist on the team to modify its score.     new target;     for (new i = 1; i <= MaxClients; i++)     {         if (IsClientInGame(i) && GetClientTeam(i) == team)         {             target = i;             break;         }     }         if (!target)         return false;         // Create entity to modify score.     new entity = CreateEntityByName("game_score");     if (entity == -1)         return false;     decl String:sPoints[12];     IntToString(points, sPoints, sizeof(sPoints));     DispatchKeyValue(entity, "points", sPoints);     DispatchKeyValue(entity, "spawnflags", "3");     if (!DispatchSpawn(entity))         return false;         AcceptEntityInput(entity, "ApplyScore", target);     AcceptEntityInput(entity, "Kill");     return true; } stock bool:Team_SetScore(team, points) {     return Team_ApplyScore(team, points - GetTeamScore(team)); }

I'm sure there is a function that can be called that works better, but this will do for now.
__________________

Last edited by GoD-Tony; 04-20-2012 at 04:16.
GoD-Tony is offline
 



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 18:35.


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