Fixed build scripts for OS X 10.7 build slave.
3 * =============================================================================
4 * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
5 * =============================================================================
7 * This file is part of the SourceMod/SourcePawn SDK.
9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License, version 3.0, as published by the
11 * Free Software Foundation.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 * You should have received a copy of the GNU General Public License along with
19 * this program. If not, see <http://www.gnu.org/licenses/>.
21 * As a special exception, AlliedModders LLC gives you permission to link the
22 * code of this program (as well as its derivative works) to "Half-Life 2," the
23 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
24 * by the Valve Corporation. You must obey the GNU General Public License in
25 * all respects for all other code used. Additionally, AlliedModders LLC grants
26 * this exception to all derivative works. AlliedModders LLC defines further
27 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
28 * or <http://www.sourcemod.net/license.php>.
33 #if defined _clients_included
36 #define _clients_included
39 * Network flow directions.
43 NetFlow_Outgoing = 0, /**< Outgoing traffic */
44 NetFlow_Incoming, /**< Incoming traffic */
45 NetFlow_Both, /**< Both values added together */
49 * MAXPLAYERS is not the same as MaxClients.
50 * MAXPLAYERS is a hardcoded value as an upper limit. MaxClients changes based on the server.
52 * Both GetMaxClients() and MaxClients are only available once the map is loaded, and should
53 * not be used in OnPluginStart().
56 #define MAXPLAYERS 65 /**< Maximum number of players SourceMod supports */
57 #define MAX_NAME_LENGTH 32 /**< Maximum buffer required to store a client name */
59 public const MaxClients; /**< Maximum number of players the server supports (dynamic) */
62 * Called on client connection. If you return true, the client will be allowed in the server.
63 * If you return false (or return nothing), the client will be rejected. If the client is
64 * rejected by this forward or any other, OnClientDisconnect will not be called.
66 * Note: Do not write to rejectmsg if you plan on returning true. If multiple plugins write
67 * to the string buffer, it is not defined which plugin's string will be shown to the client,
68 * but it is guaranteed one of them will.
70 * @param client Client index.
71 * @param rejectmsg Buffer to store the rejection message when the connection is refused.
72 * @param maxlen Maximum number of characters for rejection buffer.
73 * @return True to validate client's connection, false to refuse it.
75 forward bool:OnClientConnect(client, String:rejectmsg[], maxlen);
78 * Called once a client successfully connects. This callback is paired with OnClientDisconnect.
80 * @param client Client index.
83 forward OnClientConnected(client);
86 * Called when a client is entering the game.
88 * Whether a client has a steamid is undefined until OnClientAuthorized
89 * is called, which may occur either before or after OnClientPutInServer.
90 * Similarly, use OnClientPostAdminCheck() if you need to verify whether
91 * connecting players are admins.
93 * GetClientCount() will include clients as they are passed through this
94 * function, as clients are already in game at this point.
96 * @param client Client index.
99 forward OnClientPutInServer(client);
102 * Called when a client is disconnecting from the server.
104 * @param client Client index.
107 forward OnClientDisconnect(client);
110 * Called when a client is disconnected from the server.
112 * @param client Client index.
115 forward OnClientDisconnect_Post(client);
118 * Called when a client is sending a command.
120 * As of SourceMod 1.3, the client is guaranteed to be in-game.
121 * Use command listeners (console.inc) for more advanced hooks.
123 * @param client Client index.
124 * @param args Number of arguments.
127 forward Action:OnClientCommand(client, args);
130 * Called whenever the client's settings are changed.
132 * @param client Client index.
135 forward OnClientSettingsChanged(client);
138 * Called when a client receives a Steam ID. The state of a client's
139 * authorization as an admin is not guaranteed here. Use
140 * OnClientPostAdminCheck() if you need a client's admin status.
142 * This is called by bots, but the ID will be "BOT".
144 * @param client Client index.
145 * @param auth Client auth string.
148 forward OnClientAuthorized(client, const String:auth[]);
151 * Called once a client is authorized and fully in-game, but
152 * before admin checks are done. This can be used to override
153 * the default admin checks for a client. You should only use
154 * this for overriding; use OnClientPostAdminCheck() instead
155 * if you want notification.
157 * Note: If handled/blocked, PostAdminCheck must be signalled
158 * manually via NotifyPostAdminCheck().
160 * This callback is gauranteed to occur on all clients, and always
161 * after each OnClientPutInServer() call.
163 * @param client Client index.
164 * @return Plugin_Handled to block admin checks.
166 forward Action:OnClientPreAdminCheck(client);
169 * Called directly before OnClientPostAdminCheck() as a method to
170 * alter administrative permissions before plugins perform final
171 * post-connect operations.
173 * In general, do not use this function unless you are specifically
174 * attempting to change access permissions. Use OnClientPostAdminCheck()
175 * instead if you simply want to perform post-connect authorization
178 * See OnClientPostAdminCheck() for more information.
180 * @param client Client index.
183 forward OnClientPostAdminFilter(client);
186 * Called once a client is authorized and fully in-game, and
187 * after all post-connection authorizations have been performed.
189 * This callback is gauranteed to occur on all clients, and always
190 * after each OnClientPutInServer() call.
192 * @param client Client index.
195 forward OnClientPostAdminCheck(client);
198 * This function will be deprecated in a future release. Use the MaxClients variable instead.
200 * Returns the maximum number of clients allowed on the server. This may
201 * return 0 if called before OnMapStart(), and thus should not be called
202 * in OnPluginStart().
204 * You should not globally cache the value to GetMaxClients() because it can change from
205 * SourceTV or TF2's arena mode. Use the "MaxClients" dynamic variable documented at the
208 * @return Maximum number of clients allowed.
210 native GetMaxClients();
213 * Returns the client count put in the server.
215 * @param inGameOnly If false connecting players are also counted.
216 * @return Client count in the server.
218 native GetClientCount(bool:inGameOnly=true);
221 * Returns the client's name.
223 * @param client Player index.
224 * @param name Buffer to store the client's name.
225 * @param maxlen Maximum length of string buffer (includes NULL terminator).
226 * @return True on success, false otherwise.
227 * @error If the client is not connected an error will be thrown.
229 native bool:GetClientName(client, String:name[], maxlen);
232 * Retrieves a client's IP address.
234 * @param client Player index.
235 * @param name Buffer to store the client's ip address.
236 * @param maxlen Maximum length of string buffer (includes NULL terminator).
237 * @param remport Remove client's port from the ip string (true by default).
238 * @return True on success, false otherwise.
239 * @error If the client is not connected or the index is invalid.
241 native bool:GetClientIP(client, String:ip[], maxlen, bool:remport=true);
244 * Retrieves a client's authentication string (SteamID).
246 * @param client Player index.
247 * @param auth Buffer to store the client's auth string.
248 * @param maxlen Maximum length of string buffer (includes NULL terminator).
249 * @return True on success, false otherwise.
250 * @error If the client is not connected or the index is invalid.
252 native bool:GetClientAuthString(client, String:auth[], maxlen);
255 * Retrieves a client's user id, which is an index incremented for every client
256 * that joins the server.
258 * @param client Player index.
259 * @return User id of the client.
260 * @error If the client is not connected or the index is invalid.
262 native GetClientUserId(client);
265 * Returns if a certain player is connected.
267 * @param client Player index.
268 * @return True if player is connected to the server, false otherwise.
270 native bool:IsClientConnected(client);
273 * Returns if a certain player has entered the game.
275 * @param client Player index (index does not have to be connected).
276 * @return True if player has entered the game, false otherwise.
277 * @error Invalid client index.
279 native bool:IsClientInGame(client);
282 * Returns if a client is in the "kick queue" (i.e. the client will be kicked
283 * shortly and thus they should not appear as valid).
285 * @param client Player index (must be connected).
286 * @return True if in the kick queue, false otherwise.
287 * @error Invalid client index.
289 native bool:IsClientInKickQueue(client);
292 * Backwards compatibility stock - use IsClientInGame
293 * @deprecated Renamed to IsClientInGame
295 #pragma deprecated Use IsClientInGame() instead
296 stock bool:IsPlayerInGame(client)
298 return IsClientInGame(client);
302 * Returns if a certain player has been authenticated.
304 * @param client Player index.
305 * @return True if player has been authenticated, false otherwise.
307 native bool:IsClientAuthorized(client);
310 * Returns if a certain player is a fake client.
312 * @param client Player index.
313 * @return True if player is a fake client, false otherwise.
315 native bool:IsFakeClient(client);
318 * Returns if a certain player is the SourceTV bot.
320 * @param client Player index.
321 * @return True if player is the SourceTV bot, false otherwise.
323 native bool:IsClientSourceTV(client);
326 * Returns if a certain player is the Replay bot.
328 * @param client Player index.
329 * @return True if player is the Replay bot, false otherwise.
331 native bool:IsClientReplay(client);
334 * Returns if a certain player is an observer/spectator.
336 * @param client Player index.
337 * @return True if player is an obverser, false otherwise.
339 native bool:IsClientObserver(client);
342 * Returns if the client is alive or dead.
344 * Note: This function was originally in SDKTools and was moved to core.
346 * @param client Player's index.
347 * @return True if the client is alive, false otherwise.
348 * @error Invalid client index, client not in game, or no mod support.
350 native bool:IsPlayerAlive(client);
353 * Retrieves values from client replicated keys.
355 * @param client Player's index.
356 * @param key Key string.
357 * @param value Buffer to store value.
358 * @param maxlen Maximum length of valve (UTF-8 safe).
359 * @return True on success, false otherwise.
360 * @error Invalid client index, or client not connected.
362 native bool:GetClientInfo(client, const String:key[], String:value[], maxlen);
365 * Retrieves a client's team index.
367 * @param client Player's index.
368 * @return Team index the client is on (mod specific).
369 * @error Invalid client index, client not in game, or no mod support.
371 native GetClientTeam(client);
374 * Sets a client's AdminId.
376 * @param client Player's index.
377 * @param id AdminId to set. INVALID_ADMIN_ID removes admin permissions.
378 * @param temp True if the id should be freed on disconnect.
380 * @error Invalid client index, client not connected, or bogus AdminId.
382 native SetUserAdmin(client, AdminId:id, bool:temp=false);
385 * Retrieves a client's AdminId.
387 * @param client Player's index.
388 * @return AdminId of the client, or INVALID_ADMIN_ID if none.
389 * @error Invalid client index, or client not connected.
391 native AdminId:GetUserAdmin(client);
394 * Sets access flags on a client. If the client is not an admin,
395 * a temporary, anonymous AdminId is given.
397 * @param client Player's index.
398 * @param ... Flags to set on the client.
400 * @error Invalid client index, or client not connected.
402 native AddUserFlags(client, AdminFlag:...);
405 * Removes flags from a client. If the client is not an admin,
406 * this has no effect.
408 * @param client Player's index.
409 * @param ... Flags to remove from the client.
411 * @error Invalid client index, or client not connected.
413 native RemoveUserFlags(client, AdminFlag:...);
416 * Sets access flags on a client using bits instead of flags. If the
417 * client is not an admin, and flags not 0, a temporary, anonymous AdminId is given.
419 * @param client Player's index.
420 * @param flags Bitstring of flags to set on client.
423 native SetUserFlagBits(client, flags);
426 * Returns client access flags. If the client is not an admin,
427 * the result is always 0.
429 * @param client Player's index.
431 * @error Invalid client index, or client not connected.
433 native GetUserFlagBits(client);
436 * Returns whether a user can target another user.
437 * This is a helper function for CanAdminTarget.
439 * @param client Player's index.
440 * @param target Target player's index.
441 * @return True if target is targettable by the player, false otherwise.
442 * @error Invalid or unconnected player indexers.
444 native bool:CanUserTarget(client, target);
447 * Runs through the Core-defined admin authorization checks on a player.
448 * Has no effect if the player is already an admin.
450 * Note: This function is based on the internal cache only.
452 * @param client Client index.
453 * @return True if access was changed, false if it did not.
454 * @error Invalid client index or client not in-game AND authorized.
456 native bool:RunAdminCacheChecks(client);
459 * Signals that a player has completed post-connection admin checks.
460 * Has no effect if the player has already had this event signalled.
462 * Note: This must be sent even if no admin id was assigned.
464 * @param client Client index.
466 * @error Invalid client index or client not in-game AND authorized.
468 native NotifyPostAdminCheck(client);
471 * Creates a fake client.
473 * @param name Name to use.
474 * @return Client index on success, 0 otherwise.
476 native CreateFakeClient(const String:name[]);
479 * Sets a convar value on a fake client.
481 * @param client Client index.
482 * @param cvar ConVar name.
483 * @param value ConVar value.
485 * @error Invalid client index, client not connected,
486 * or client not a fake client.
488 native SetFakeClientConVar(client, const String:cvar[], const String:value[]);
491 * Returns the client's health.
493 * @param client Player's index.
494 * @return Health value.
495 * @error Invalid client index, client not in game, or no mod support.
497 native GetClientHealth(client);
500 * Returns the client's model name.
502 * @param client Player's index.
503 * @param model Buffer to store the client's model name.
504 * @param maxlen Maximum length of string buffer (includes NULL terminator).
506 * @error Invalid client index, client not in game, or no mod support.
508 native GetClientModel(client, String:model[], maxlen);
511 * Returns the client's weapon name.
513 * @param client Player's index.
514 * @param weapon Buffer to store the client's weapon name.
515 * @param maxlen Maximum length of string buffer (includes NULL terminator).
517 * @error Invalid client index, client not in game, or no mod support.
519 native GetClientWeapon(client, String:weapon[], maxlen);
522 * Returns the client's max size vector.
524 * @param client Player's index.
525 * @param vec Destination vector to store the client's max size.
527 * @error Invalid client index, client not in game, or no mod support.
529 native GetClientMaxs(client, Float:vec[3]);
532 * Returns the client's min size vector.
534 * @param client Player's index.
535 * @param vec Destination vector to store the client's min size.
537 * @error Invalid client index, client not in game, or no mod support.
539 native GetClientMins(client, Float:vec[3]);
542 * Returns the client's position angle.
544 * @param client Player's index.
545 * @param ang Destination vector to store the client's position angle.
547 * @error Invalid client index, client not in game, or no mod support.
549 native GetClientAbsAngles(client, Float:ang[3]);
552 * Returns the client's origin vector.
554 * @param client Player's index.
555 * @param vec Destination vector to store the client's origin vector.
557 * @error Invalid client index, client not in game, or no mod support.
559 native GetClientAbsOrigin(client, Float:vec[3]);
562 * Returns the client's armor.
564 * @param client Player's index.
565 * @return Armor value.
566 * @error Invalid client index, client not in game, or no mod support.
568 native GetClientArmor(client);
571 * Returns the client's death count.
573 * @param client Player's index.
574 * @return Death count.
575 * @error Invalid client index, client not in game, or no mod support.
577 native GetClientDeaths(client);
580 * Returns the client's frag count.
582 * @param client Player's index.
583 * @return Frag count.
584 * @error Invalid client index, client not in game, or no mod support.
586 native GetClientFrags(client);
589 * Returns the client's send data rate in bytes/sec.
591 * @param client Player's index.
593 * @error Invalid client index, client not in game, or fake client.
595 native GetClientDataRate(client);
598 * Returns if a client is timing out
600 * @param client Player's index.
601 * @return True if client is timing out, false otherwise.
602 * @error Invalid client index, client not in game, or fake client.
604 native bool:IsClientTimingOut(client);
607 * Returns the client's connection time in seconds.
609 * @param client Player's index.
610 * @return Connection time.
611 * @error Invalid client index, client not in game, or fake client.
613 native Float:GetClientTime(client);
616 * Returns the client's current latency (RTT), more accurate than GetAvgLatency but jittering.
618 * @param client Player's index.
619 * @param flow Traffic flowing direction.
620 * @return Latency, or -1 if network info is not available.
621 * @error Invalid client index, client not in game, or fake client.
623 native Float:GetClientLatency(client, NetFlow:flow);
626 * Returns the client's average packet latency in seconds.
628 * @param client Player's index.
629 * @param flow Traffic flowing direction.
630 * @return Latency, or -1 if network info is not available.
631 * @error Invalid client index, client not in game, or fake client.
633 native Float:GetClientAvgLatency(client, NetFlow:flow);
636 * Returns the client's average packet loss, values go from 0 to 1 (for percentages).
638 * @param client Player's index.
639 * @param flow Traffic flowing direction.
640 * @return Average packet loss, or -1 if network info is not available.
641 * @error Invalid client index, client not in game, or fake client.
643 native Float:GetClientAvgLoss(client, NetFlow:flow);
646 * Returns the client's average packet choke, values go from 0 to 1 (for percentages).
648 * @param client Player's index.
649 * @param flow Traffic flowing direction.
650 * @return Average packet loss, or -1 if network info is not available.
651 * @error Invalid client index, client not in game, or fake client.
653 native Float:GetClientAvgChoke(client, NetFlow:flow);
656 * Returns the client's data flow in bytes/sec.
658 * @param client Player's index.
659 * @param flow Traffic flowing direction.
661 * @error Invalid client index, client not in game, or fake client.
663 native Float:GetClientAvgData(client, NetFlow:flow);
666 * Returns the client's average packet frequency in packets/sec.
668 * @param client Player's index.
669 * @param flow Traffic flowing direction.
670 * @return Packet frequency.
671 * @error Invalid client index, client not in game, or fake client.
673 native Float:GetClientAvgPackets(client, NetFlow:flow);
676 * Translates an userid index to the real player index.
678 * @param userid Userid value.
679 * @return Client value.
680 * @error Returns 0 if invalid userid.
682 native GetClientOfUserId(userid);
685 * Disconnects a client from the server as soon as the next frame starts.
687 * Note: Originally, KickClient() was immediate. The delay was introduced
688 * because despite warnings, plugins were using it in ways that would crash.
689 * The new safe version can break cases that rely on immediate disconnects,
690 * but ensures that plugins do not accidentally cause crashes.
692 * If you need immediate disconnects, use KickClientEx().
694 * Note: IsClientInKickQueue() will return true before the kick occurs.
696 * @param client Client index.
697 * @param format Optional formatting rules for disconnect reason.
698 * Note that a period is automatically appended to the string by the engine.
699 * @param ... Variable number of format parameters.
701 * @error Invalid client index, or client not connected.
703 native KickClient(client, const String:format[]="", any:...);
706 * Immediately disconnects a client from the server.
708 * Kicking clients from certain events or callbacks may cause crashes. If in
709 * doubt, create a short (0.1 second) timer to kick the client in the next
712 * @param client Client index.
713 * @param format Optional formatting rules for disconnect reason.
714 * Note that a period is automatically appended to the string by the engine.
715 * @param ... Variable number of format parameters.
717 * @error Invalid client index, or client not connected.
719 native KickClientEx(client, const String:format[]="", any:...);
722 * Changes a client's team through the mod's generic team changing function.
723 * On CS:S, this will kill the player.
725 * @param client Client index.
726 * @param team Mod-specific team index.
728 * @error Invalid client index, client not connected, or lack of
731 native ChangeClientTeam(client, team);
734 * Returns the clients unique serial identifier.
736 * @return Serial number.
738 native GetClientSerial(client);
741 * Returns the client index by its serial number.
743 * @return Client index, or 0 for invalid serial.
745 native GetClientFromSerial(serial);