This repository was archived by the owner on Sep 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
nosoop edited this page Nov 11, 2018
·
3 revisions
Here are some examples of what Level KeyValues is capable of:
public Action LevelEntity_OnEntityKeysParsed(LevelEntityKeyValues entity) {
char classname[64];
entity.GetString("classname", classname, sizeof(classname));
// remove any spawn areas that don't have team numbers
// TF2 navigation meshes treat areas as the wrong team when they are present
if (StrEqual(classname, "info_player_teamspawn") && !entity.GetNum("TeamNum")) {
return Plugin_Stop;
}
// swap intel teams around
if (StrEqual(classname, "item_teamflag")) {
switch (entity.GetNum("TeamNum")) {
case TFTeam_Red: {
entity.Remove("TeamNum");
entity.AddNum("TeamNum", TFTeam_Blue);
}
case TFTeam_Blue: {
entity.Remove("TeamNum");
entity.AddNum("TeamNum", TFTeam_Red);
}
}
}
return Plugin_Continue;
}
public void LevelEntity_OnAllEntitiesParsed() {
LevelEntityKeyValues hostage = new LevelEntityKeyValues();
float origin[] = { 1376.0, 3168.0, -112.0 }, angles[] = { 0.0, 111.0, 0.0 };
hostage.AddVector("origin", origin);
hostage.AddNum("HostageType", 0);
hostage.AddVector("angles", angles);
hostage.AddString("classname", "hostage_entity");
LevelEntityList.Push(hostage);
delete hostage;
}