This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

SetTeamScore


Post New Thread Reply   
 
Thread Tools Display Modes
-sang-
BANNED
Join Date: Jun 2009
Location: Russia
Old 01-17-2011 , 00:11   Re: SetTeamScore
Reply With Quote #11

Thanks! Now it works!
-sang- is offline
Experto
Member
Join Date: Jan 2008
Location: Brasil
Old 01-17-2011 , 19:54   Re: SetTeamScore
Reply With Quote #12

Please post your example ... I tried using the same code and could not ...

PHP Code:
bool:SetScoreTeam(indexscore)
{
 new 
edict GetEdictTeam(index);
 if (
edict == -1)
 {
  return 
false;
 }
 
SetEntProp(edictProp_Send"m_iScore"score);
 return 
true;
}
 
EdictGetNumTeam(edict)
{
 return 
GetEntProp(edictProp_Send"m_iTeamNum");
}
 
GetEdictTeam(index)
{
 new 
team_manager = -1;
 while ((
team_manager FindEntityByClassname(team_manager"team_manager")) != -1)
 {
  if (
EdictGetNumTeam(team_manager) == index)
  {
   return 
team_manager;
  }
 }
 return -
1;
}
 
SetScore()
{
 if (
GetConVarInt(astScoreType) == 1)
 {
  
SetScoreTeam(CS_TEAM_CT0);
  
SetScoreTeam(CS_TEAM_T0);
 }
 else if(
GetConVarInt(astScoreType) == 2)
 {
  
scoreCT GetTeamScore(CS_TEAM_CT);
  
scoreT GetTeamScore(CS_TEAM_T);
  
SetScoreTeam(CS_TEAM_CTscoreT);
  
SetScoreTeam(CS_TEAM_TscoreCT);
 }

Experto is offline
-sang-
BANNED
Join Date: Jun 2009
Location: Russia
Old 01-18-2011 , 03:25   Re: SetTeamScore
Reply With Quote #13

Quote:
bool:SetScoreTeam(index, score)
{
new edict = GetEdictTeam(index);
if (edict == -1)
{
return false;
}
SetEntProp(edict, Prop_Send, "m_iScore", score);
ChangeEdictState(edict, GetEntSendPropOffs(edict, "m_iScore"));
return true;
}

EdictGetNumTeam(edict)
{
return GetEntProp(edict, Prop_Send, "m_iTeamNum");
}

GetEdictTeam(index)
{
new team_manager = -1;
while ((team_manager = FindEntityByClassname(team_manager, "cs_team_manager")) != -1)
{
if (EdictGetNumTeam(team_manager) == index)
{
return team_manager;
}
}
return -1;
}
(Thanks to berni)

Last edited by -sang-; 01-18-2011 at 03:27.
-sang- is offline
Experto
Member
Join Date: Jan 2008
Location: Brasil
Old 01-18-2011 , 22:00   Re: SetTeamScore
Reply With Quote #14

Thanks!

It worked! But after the score went back to what it was before ...

Does anyone know why and explain how to avoid it?
Experto is offline
Deathly
New Member
Join Date: Jan 2011
Old 01-19-2011 , 02:44   Re: SetTeamScore
Reply With Quote #15

This happens because the TeamScore will be recalculated everytime it changes.

I dont know how to avoid it but maybe hook the events that change the TeamScore and modify it again
Deathly is offline
Master53
Veteran Member
Join Date: Dec 2009
Old 01-19-2011 , 10:57   Re: SetTeamScore
Reply With Quote #16

you could use "Player_Score" and set the game score

http://wiki.alliedmods.net/Generic_S...s#player_score
__________________
Master(d)



Master53 is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 01-24-2011 , 20:51   Re: SetTeamScore
Reply With Quote #17

The Function Team_SetName() is now part of SMLIB.
__________________
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
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 00:51.


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