It seems Sourcemod doesn't mark the property as changed, bleh.
Use my stocks:
PHP Code:
/*
* Changes a team's score.
* Don't use this before OnMapStart().
*
* @param index Team Index.
* @param score Score value.
* @return True on success, false otherwise
*/
stock bool:Team_SetScore(index, score)
{
new edict = Team_GetEdict(index);
if (edict == -1) {
return false;
}
SetEntProp(edict, Prop_Send, "m_iScore", score);
ChangeEdictState(edict, GetEntSendPropOffs(edict, "m_iScore"));
return true;
}
/*
* Gets a team's edict (team_manager) Team Index.
* Don't call this before OnMapStart()
*
* @param edict Edict
* @return Team Index
*/
stock Team_EdictGetNum(edict)
{
return GetEntProp(edict, Prop_Send, "m_iTeamNum");
}
/*
* Gets a team's edict (team_manager)
* Don't call this before OnMapStart()
*
* @param index Team Index.
* @return Team edict or -1 if not found
*/
stock Team_GetEdict(index)
{
new maxEntities = GetMaxEntities();
for (new entity=MaxClients+1; entity < maxEntities; entity++) {
if (!IsValidEntity(entity)) {
continue;
}
if (!Entity_CheckClassName(entity, "team_manager", true)) {
continue;
}
if (Team_EdictGetNum(entity) == index) {
return entity;
}
}
return -1;
}
/*
* Checks if an entity matches a specific entity class.
*
* @param entity Entity Index.
* @param class Classname String.
* @return True if the classname matches, false otherwise.
*/
stock bool:Entity_CheckClassName(entity, const String:className[], partialMatch=false)
{
decl String:entity_className[64];
GetEdictClassname(entity, entity_className, sizeof(entity_className));
if (partialMatch) {
return (StrContains(entity_className, className) != -1);
}
return StrEqual(entity_className, className);
}
__________________