You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 24, 2023. It is now read-only.
nosoop edited this page Nov 12, 2018
·
3 revisions
Here are some examples of what Level KeyValues is capable of:
// global forward that gets called after a block of key/value pairs comprising an entity is parsed// any return value other than Plugin_Stop will add the block to the level entity list to be serialized laterpublicActionLevelEntity_OnEntityKeysParsed(LevelEntityKeyValuesentity) {
charclassname[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 presentif (StrEqual(classname, "info_player_teamspawn") &&!entity.GetNum("TeamNum")) {
returnPlugin_Stop;
}
// swap intel teams and capture zones around// make sure you're on CTF first thoughif (StrEqual(classname, "item_teamflag") ||StrEqual(classname, "func_capturezone")) {
switch (entity.GetNum("TeamNum")) {
caseTFTeam_Red: {
entity.Remove("TeamNum");
entity.AddNum("TeamNum", TFTeam_Blue);
}
caseTFTeam_Blue: {
entity.Remove("TeamNum");
entity.AddNum("TeamNum", TFTeam_Red);
}
}
}
returnPlugin_Continue;
}
// global forward that gets called once all entity blocks are parsed, you may do things with the entire listpublicvoidLevelEntity_OnAllEntitiesParsed() {
LevelEntityKeyValueshostage=newLevelEntityKeyValues();
floatorigin[] = { 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);
deletehostage;
}