summaryrefslogtreecommitdiff
path: root/source/sourcemod/scripting/include/gokz.inc
diff options
context:
space:
mode:
Diffstat (limited to 'source/sourcemod/scripting/include/gokz.inc')
-rw-r--r--source/sourcemod/scripting/include/gokz.inc44
1 files changed, 43 insertions, 1 deletions
diff --git a/source/sourcemod/scripting/include/gokz.inc b/source/sourcemod/scripting/include/gokz.inc
index edbd896..6e41ed1 100644
--- a/source/sourcemod/scripting/include/gokz.inc
+++ b/source/sourcemod/scripting/include/gokz.inc
@@ -769,7 +769,49 @@ stock bool GetValidSpawn(float origin[3], float angles[3])
{
// Return true if the spawn found is truly valid (not in the ground or out of bounds)
bool foundValidSpawn;
- bool searchCT;
+ bool searchCT = false;
+ float spawnOrigin[3];
+ float spawnAngles[3];
+ int spawnEntity = -1;
+ while (!foundValidSpawn)
+ {
+ if (searchCT)
+ {
+ spawnEntity = FindEntityByClassname(spawnEntity, "info_player_counterterrorist");
+ }
+ else
+ {
+ spawnEntity = FindEntityByClassname(spawnEntity, "info_player_terrorist");
+ }
+
+ if (spawnEntity != -1)
+ {
+ GetEntPropVector(spawnEntity, Prop_Data, "m_vecOrigin", spawnOrigin);
+ GetEntPropVector(spawnEntity, Prop_Data, "m_angRotation", spawnAngles);
+ if (IsSpawnValid(spawnOrigin))
+ {
+ origin = spawnOrigin;
+ angles = spawnAngles;
+ foundValidSpawn = true;
+ }
+ }
+ else if (!searchCT)
+ {
+ searchCT = true;
+ }
+ else
+ {
+ break;
+ }
+ }
+ return foundValidSpawn;
+}
+
+stock bool GetValidSpawnCT(float origin[3], float angles[3])
+{
+ // Return true if the spawn found is truly valid (not in the ground or out of bounds)
+ bool foundValidSpawn;
+ bool searchCT = true;
float spawnOrigin[3];
float spawnAngles[3];
int spawnEntity = -1;