Simplify pre-check logic in ZTeleClient.
This commit is contained in:
		| @@ -129,30 +129,6 @@ bool:ZTeleClient(client, bool:force = false) | |||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     new bool:infected = InfectIsClientInfected(client); |  | ||||||
|      |  | ||||||
|     if (!force && ZTeleMustBeHuman(client)) |  | ||||||
|     { |  | ||||||
|         // Tell client they must be human to use this feature. |  | ||||||
|         TranslationPrintToChat(client, "Must be human"); |  | ||||||
|         return false; |  | ||||||
|     } |  | ||||||
|      |  | ||||||
|     if (!force && !infected && !ZTeleCanHumanTeleport()) |  | ||||||
|     { |  | ||||||
|         // Tell client that feature is restricted at this time. |  | ||||||
|         TranslationPrintToChat(client, "ZTele restricted human"); |  | ||||||
|         return false; |  | ||||||
|     } |  | ||||||
|      |  | ||||||
|     if (!force && ZTeleHasReachedLimit(client)) |  | ||||||
|     { |  | ||||||
|         // Tell client that they have already reached their limit. |  | ||||||
|         int maxTeleports = ZTeleGetClientLimit(client); |  | ||||||
|         TranslationPrintToChat(client, "ZTele max", maxTeleports); |  | ||||||
|         return false; |  | ||||||
|     } |  | ||||||
|      |  | ||||||
|     // If teleport is already in progress, then stop. |     // If teleport is already in progress, then stop. | ||||||
|     if (tZTele[client] != INVALID_HANDLE) |     if (tZTele[client] != INVALID_HANDLE) | ||||||
|     { |     { | ||||||
| @@ -164,15 +140,38 @@ bool:ZTeleClient(client, bool:force = false) | |||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     // If we are forcing, then teleport now and stop. |  | ||||||
|     if (force) |     if (force) | ||||||
|     { |     { | ||||||
|         // Teleport client to spawn. |         // Forcing teleport. | ||||||
|         ZTeleTeleportClient(client); |         ZTeleTeleportClient(client); | ||||||
|          |          | ||||||
|  |         // Skip everything else. | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     if (ZTeleMustBeHuman(client)) | ||||||
|  |     { | ||||||
|  |         // Tell client they must be human to use this feature. | ||||||
|  |         TranslationPrintToChat(client, "Must be human"); | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     new bool:infected = InfectIsClientInfected(client); | ||||||
|  |     if (!infected && !ZTeleCanHumanTeleport()) | ||||||
|  |     { | ||||||
|  |         // Tell client that feature is restricted at this time. | ||||||
|  |         TranslationPrintToChat(client, "ZTele restricted human"); | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     if (ZTeleHasReachedLimit(client)) | ||||||
|  |     { | ||||||
|  |         // Tell client that they have already reached their limit. | ||||||
|  |         int maxTeleports = ZTeleGetClientLimit(client); | ||||||
|  |         TranslationPrintToChat(client, "ZTele max", maxTeleports); | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |      | ||||||
|     // Get current location. |     // Get current location. | ||||||
|     GetClientAbsOrigin(client, g_vecZTeleOrigin[client]); |     GetClientAbsOrigin(client, g_vecZTeleOrigin[client]); | ||||||
|      |      | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user