From f91d659c6fff94685bb5252790eef0f07ba40d64 Mon Sep 17 00:00:00 2001 From: ErikMinekus Date: Sat, 21 May 2016 14:52:43 +0200 Subject: [PATCH] Update large includes for transitional syntax #1 (#510) --- plugins/include/clients.inc | 163 +++++++++++-------------- plugins/include/console.inc | 127 ++++++++----------- plugins/include/cstrike.inc | 64 ++++------ plugins/include/entity.inc | 137 +++++++++------------ plugins/include/entity_prop_stocks.inc | 148 +++++++++++----------- plugins/include/float.inc | 149 +++++++++++----------- plugins/include/functions.inc | 91 ++++++-------- plugins/include/halflife.inc | 117 ++++++++---------- 8 files changed, 439 insertions(+), 557 deletions(-) diff --git a/plugins/include/clients.inc b/plugins/include/clients.inc index 0d080275..be18d395 100644 --- a/plugins/include/clients.inc +++ b/plugins/include/clients.inc @@ -72,7 +72,7 @@ enum AuthIdType #define MAXPLAYERS 65 /**< Maximum number of players SourceMod supports */ #define MAX_NAME_LENGTH 32 /**< Maximum buffer required to store a client name */ -public const MaxClients; /**< Maximum number of players the server supports (dynamic) */ +public const int MaxClients; /**< Maximum number of players the server supports (dynamic) */ /** * Called on client connection. If you return true, the client will be allowed in the server. @@ -88,15 +88,14 @@ public const MaxClients; /**< Maximum number of players the server supports (dyn * @param maxlen Maximum number of characters for rejection buffer. * @return True to validate client's connection, false to refuse it. */ -forward bool:OnClientConnect(client, String:rejectmsg[], maxlen); +forward bool OnClientConnect(int client, char[] rejectmsg, int maxlen); /** * Called once a client successfully connects. This callback is paired with OnClientDisconnect. * * @param client Client index. - * @noreturn */ -forward void OnClientConnected(client); +forward void OnClientConnected(int client); /** * Called when a client is entering the game. @@ -110,25 +109,22 @@ forward void OnClientConnected(client); * function, as clients are already in game at this point. * * @param client Client index. - * @noreturn */ -forward void OnClientPutInServer(client); +forward void OnClientPutInServer(int client); /** * Called when a client is disconnecting from the server. * * @param client Client index. - * @noreturn */ -forward void OnClientDisconnect(client); +forward void OnClientDisconnect(int client); /** * Called when a client is disconnected from the server. * * @param client Client index. - * @noreturn */ -forward void OnClientDisconnect_Post(client); +forward void OnClientDisconnect_Post(int client); /** * Called when a client is sending a command. @@ -141,7 +137,7 @@ forward void OnClientDisconnect_Post(client); * @return Plugin_Handled blocks the command from being sent, * and Plugin_Continue resumes normal functionality. */ -forward Action:OnClientCommand(client, args); +forward Action OnClientCommand(int client, int args); /** * Called when a client is sending a KeyValues command. @@ -162,7 +158,6 @@ forward Action OnClientCommandKeyValues(int client, KeyValues kv); * @param kv KeyValues data sent as the command. * (This handle should not be stored and will be closed * after this forward completes.) - * @noreturn */ forward void OnClientCommandKeyValues_Post(int client, KeyValues kv); @@ -170,9 +165,8 @@ forward void OnClientCommandKeyValues_Post(int client, KeyValues kv); * Called whenever the client's settings are changed. * * @param client Client index. - * @noreturn */ -forward void OnClientSettingsChanged(client); +forward void OnClientSettingsChanged(int client); /** * Called when a client receives an auth ID. The state of a client's @@ -183,9 +177,8 @@ forward void OnClientSettingsChanged(client); * * @param client Client index. * @param auth Client Steam2 id, if available, else engine auth id. - * @noreturn */ -forward void OnClientAuthorized(client, const String:auth[]); +forward void OnClientAuthorized(int client, const char[] auth); /** * Called once a client is authorized and fully in-game, but @@ -203,7 +196,7 @@ forward void OnClientAuthorized(client, const String:auth[]); * @param client Client index. * @return Plugin_Handled to block admin checks. */ -forward Action:OnClientPreAdminCheck(client); +forward Action OnClientPreAdminCheck(int client); /** * Called directly before OnClientPostAdminCheck() as a method to @@ -218,9 +211,8 @@ forward Action:OnClientPreAdminCheck(client); * See OnClientPostAdminCheck() for more information. * * @param client Client index. - * @noreturn */ -forward void OnClientPostAdminFilter(client); +forward void OnClientPostAdminFilter(int client); /** * Called once a client is authorized and fully in-game, and @@ -230,9 +222,8 @@ forward void OnClientPostAdminFilter(client); * after each OnClientPutInServer() call. * * @param client Client index. - * @noreturn */ -forward void OnClientPostAdminCheck(client); +forward void OnClientPostAdminCheck(int client); /** * This function will be deprecated in a future release. Use the MaxClients variable instead. @@ -247,7 +238,7 @@ forward void OnClientPostAdminCheck(client); * * @return Maximum number of clients allowed. */ -native GetMaxClients(); +native int GetMaxClients(); /** * Returns the maximum number of human players allowed on the server. This is @@ -262,7 +253,7 @@ native GetMaxClients(); * * @return Maximum number of humans allowed. */ -native GetMaxHumanPlayers(); +native int GetMaxHumanPlayers(); /** * Returns the client count put in the server. @@ -270,7 +261,7 @@ native GetMaxHumanPlayers(); * @param inGameOnly If false connecting players are also counted. * @return Client count in the server. */ -native GetClientCount(bool:inGameOnly=true); +native int GetClientCount(bool inGameOnly=true); /** * Returns the client's name. @@ -281,7 +272,7 @@ native GetClientCount(bool:inGameOnly=true); * @return True on success, false otherwise. * @error If the client is not connected an error will be thrown. */ -native bool:GetClientName(client, String:name[], maxlen); +native bool GetClientName(int client, char[] name, int maxlen); /** * Retrieves a client's IP address. @@ -293,7 +284,7 @@ native bool:GetClientName(client, String:name[], maxlen); * @return True on success, false otherwise. * @error If the client is not connected or the index is invalid. */ -native bool:GetClientIP(client, String:ip[], maxlen, bool:remport=true); +native bool GetClientIP(int client, char[] ip, int maxlen, bool remport=true); /** * Retrieves a client's authentication string (SteamID). @@ -308,7 +299,7 @@ native bool:GetClientIP(client, String:ip[], maxlen, bool:remport=true); * @error If the client is not connected or the index is invalid. */ #pragma deprecated Use GetClientAuthId -native bool:GetClientAuthString(client, String:auth[], maxlen, bool:validate=true); +native bool GetClientAuthString(int client, char[] auth, int maxlen, bool validate=true); /** * Retrieves a client's authentication string (SteamID). @@ -323,7 +314,7 @@ native bool:GetClientAuthString(client, String:auth[], maxlen, bool:validate=tru * @return True on success, false otherwise. * @error If the client is not connected or the index is invalid. */ -native bool:GetClientAuthId(client, AuthIdType:authType, String:auth[], maxlen, bool:validate=true); +native bool GetClientAuthId(int client, AuthIdType authType, char[] auth, int maxlen, bool validate=true); /** * Returns the client's Steam account ID. @@ -335,7 +326,7 @@ native bool:GetClientAuthId(client, AuthIdType:authType, String:auth[], maxlen, * @return Steam account ID or 0 if not available. * @error If the client is not connected or the index is invalid. */ -native GetSteamAccountID(client, bool:validate=true); +native int GetSteamAccountID(int client, bool validate=true); /** * Retrieves a client's user id, which is an index incremented for every client @@ -345,7 +336,7 @@ native GetSteamAccountID(client, bool:validate=true); * @return User id of the client. * @error If the client is not connected or the index is invalid. */ -native GetClientUserId(client); +native int GetClientUserId(int client); /** * Returns if a certain player is connected. @@ -353,7 +344,7 @@ native GetClientUserId(client); * @param client Player index. * @return True if player is connected to the server, false otherwise. */ -native bool:IsClientConnected(client); +native bool IsClientConnected(int client); /** * Returns if a certain player has entered the game. @@ -362,7 +353,7 @@ native bool:IsClientConnected(client); * @return True if player has entered the game, false otherwise. * @error Invalid client index. */ -native bool:IsClientInGame(client); +native bool IsClientInGame(int client); /** * Returns if a client is in the "kick queue" (i.e. the client will be kicked @@ -372,14 +363,14 @@ native bool:IsClientInGame(client); * @return True if in the kick queue, false otherwise. * @error Invalid client index. */ -native bool:IsClientInKickQueue(client); +native bool IsClientInKickQueue(int client); /** * Backwards compatibility stock - use IsClientInGame * @deprecated Renamed to IsClientInGame */ #pragma deprecated Use IsClientInGame() instead -stock bool:IsPlayerInGame(client) +stock bool IsPlayerInGame(int client) { return IsClientInGame(client); } @@ -390,7 +381,7 @@ stock bool:IsPlayerInGame(client) * @param client Player index. * @return True if player has been authenticated, false otherwise. */ -native bool:IsClientAuthorized(client); +native bool IsClientAuthorized(int client); /** * Returns if a certain player is a fake client. @@ -398,7 +389,7 @@ native bool:IsClientAuthorized(client); * @param client Player index. * @return True if player is a fake client, false otherwise. */ -native bool:IsFakeClient(client); +native bool IsFakeClient(int client); /** * Returns if a certain player is the SourceTV bot. @@ -406,7 +397,7 @@ native bool:IsFakeClient(client); * @param client Player index. * @return True if player is the SourceTV bot, false otherwise. */ -native bool:IsClientSourceTV(client); +native bool IsClientSourceTV(int client); /** * Returns if a certain player is the Replay bot. @@ -414,7 +405,7 @@ native bool:IsClientSourceTV(client); * @param client Player index. * @return True if player is the Replay bot, false otherwise. */ -native bool:IsClientReplay(client); +native bool IsClientReplay(int client); /** * Returns if a certain player is an observer/spectator. @@ -422,7 +413,7 @@ native bool:IsClientReplay(client); * @param client Player index. * @return True if player is an observer, false otherwise. */ -native bool:IsClientObserver(client); +native bool IsClientObserver(int client); /** * Returns if the client is alive or dead. @@ -433,7 +424,7 @@ native bool:IsClientObserver(client); * @return True if the client is alive, false otherwise. * @error Invalid client index, client not in game, or no mod support. */ -native bool:IsPlayerAlive(client); +native bool IsPlayerAlive(int client); /** * Retrieves values from client replicated keys. @@ -445,7 +436,7 @@ native bool:IsPlayerAlive(client); * @return True on success, false otherwise. * @error Invalid client index, or client not connected. */ -native bool:GetClientInfo(client, const String:key[], String:value[], maxlen); +native bool GetClientInfo(int client, const char[] key, char[] value, int maxlen); /** * Retrieves a client's team index. @@ -454,7 +445,7 @@ native bool:GetClientInfo(client, const String:key[], String:value[], maxlen); * @return Team index the client is on (mod specific). * @error Invalid client index, client not in game, or no mod support. */ -native GetClientTeam(client); +native int GetClientTeam(int client); /** * Sets a client's AdminId. @@ -462,10 +453,9 @@ native GetClientTeam(client); * @param client Player's index. * @param id AdminId to set. INVALID_ADMIN_ID removes admin permissions. * @param temp True if the id should be freed on disconnect. - * @noreturn * @error Invalid client index, client not connected, or bogus AdminId. */ -native SetUserAdmin(client, AdminId:id, bool:temp=false); +native void SetUserAdmin(int client, AdminId id, bool temp=false); /** * Retrieves a client's AdminId. @@ -474,7 +464,7 @@ native SetUserAdmin(client, AdminId:id, bool:temp=false); * @return AdminId of the client, or INVALID_ADMIN_ID if none. * @error Invalid client index, or client not connected. */ -native AdminId:GetUserAdmin(client); +native AdminId GetUserAdmin(int client); /** * Sets access flags on a client. If the client is not an admin, @@ -482,10 +472,9 @@ native AdminId:GetUserAdmin(client); * * @param client Player's index. * @param ... Flags to set on the client. - * @noreturn * @error Invalid client index, or client not connected. */ -native AddUserFlags(client, AdminFlag:...); +native void AddUserFlags(int client, AdminFlag ...); /** * Removes flags from a client. If the client is not an admin, @@ -493,10 +482,9 @@ native AddUserFlags(client, AdminFlag:...); * * @param client Player's index. * @param ... Flags to remove from the client. - * @noreturn * @error Invalid client index, or client not connected. */ -native RemoveUserFlags(client, AdminFlag:...); +native void RemoveUserFlags(int client, AdminFlag ...); /** * Sets access flags on a client using bits instead of flags. If the @@ -504,9 +492,8 @@ native RemoveUserFlags(client, AdminFlag:...); * * @param client Player's index. * @param flags Bitstring of flags to set on client. - * @noreturn */ -native SetUserFlagBits(client, flags); +native void SetUserFlagBits(int client, int flags); /** * Returns client access flags. If the client is not an admin, @@ -516,7 +503,7 @@ native SetUserFlagBits(client, flags); * @return Flags * @error Invalid client index, or client not connected. */ -native GetUserFlagBits(client); +native int GetUserFlagBits(int client); /** * Returns whether a user can target another user. @@ -527,7 +514,7 @@ native GetUserFlagBits(client); * @return True if target is targettable by the player, false otherwise. * @error Invalid or unconnected player indexers. */ -native bool:CanUserTarget(client, target); +native bool CanUserTarget(int client, int target); /** * Runs through the Core-defined admin authorization checks on a player. @@ -539,7 +526,7 @@ native bool:CanUserTarget(client, target); * @return True if access was changed, false if it did not. * @error Invalid client index or client not in-game AND authorized. */ -native bool:RunAdminCacheChecks(client); +native bool RunAdminCacheChecks(int client); /** * Signals that a player has completed post-connection admin checks. @@ -548,10 +535,9 @@ native bool:RunAdminCacheChecks(client); * Note: This must be sent even if no admin id was assigned. * * @param client Client index. - * @noreturn * @error Invalid client index or client not in-game AND authorized. */ -native NotifyPostAdminCheck(client); +native void NotifyPostAdminCheck(int client); /** * Creates a fake client. @@ -559,7 +545,7 @@ native NotifyPostAdminCheck(client); * @param name Name to use. * @return Client index on success, 0 otherwise. */ -native CreateFakeClient(const String:name[]); +native int CreateFakeClient(const char[] name); /** * Sets a convar value on a fake client. @@ -567,11 +553,10 @@ native CreateFakeClient(const String:name[]); * @param client Client index. * @param cvar ConVar name. * @param value ConVar value. - * @noreturn * @error Invalid client index, client not connected, * or client not a fake client. */ -native SetFakeClientConVar(client, const String:cvar[], const String:value[]); +native void SetFakeClientConVar(int client, const char[] cvar, const char[] value); /** * Returns the client's health. @@ -580,7 +565,7 @@ native SetFakeClientConVar(client, const String:cvar[], const String:value[]); * @return Health value. * @error Invalid client index, client not in game, or no mod support. */ -native GetClientHealth(client); +native int GetClientHealth(int client); /** * Returns the client's model name. @@ -588,10 +573,9 @@ native GetClientHealth(client); * @param client Player's index. * @param model Buffer to store the client's model name. * @param maxlen Maximum length of string buffer (includes NULL terminator). - * @noreturn * @error Invalid client index, client not in game, or no mod support. */ -native GetClientModel(client, String:model[], maxlen); +native void GetClientModel(int client, char[] model, int maxlen); /** * Returns the client's weapon name. @@ -599,50 +583,45 @@ native GetClientModel(client, String:model[], maxlen); * @param client Player's index. * @param weapon Buffer to store the client's weapon name. * @param maxlen Maximum length of string buffer (includes NULL terminator). - * @noreturn * @error Invalid client index, client not in game, or no mod support. */ -native GetClientWeapon(client, String:weapon[], maxlen); +native void GetClientWeapon(int client, char[] weapon, int maxlen); /** * Returns the client's max size vector. * * @param client Player's index. * @param vec Destination vector to store the client's max size. - * @noreturn * @error Invalid client index, client not in game, or no mod support. */ -native GetClientMaxs(client, Float:vec[3]); +native void GetClientMaxs(int client, float vec[3]); /** * Returns the client's min size vector. * * @param client Player's index. * @param vec Destination vector to store the client's min size. - * @noreturn * @error Invalid client index, client not in game, or no mod support. */ -native GetClientMins(client, Float:vec[3]); +native void GetClientMins(int client, float vec[3]); /** * Returns the client's position angle. * * @param client Player's index. * @param ang Destination vector to store the client's position angle. - * @noreturn * @error Invalid client index, client not in game, or no mod support. */ -native GetClientAbsAngles(client, Float:ang[3]); +native void GetClientAbsAngles(int client, float ang[3]); /** * Returns the client's origin vector. * * @param client Player's index. * @param vec Destination vector to store the client's origin vector. - * @noreturn * @error Invalid client index, client not in game, or no mod support. */ -native GetClientAbsOrigin(client, Float:vec[3]); +native void GetClientAbsOrigin(int client, float vec[3]); /** * Returns the client's armor. @@ -651,7 +630,7 @@ native GetClientAbsOrigin(client, Float:vec[3]); * @return Armor value. * @error Invalid client index, client not in game, or no mod support. */ -native GetClientArmor(client); +native int GetClientArmor(int client); /** * Returns the client's death count. @@ -660,7 +639,7 @@ native GetClientArmor(client); * @return Death count. * @error Invalid client index, client not in game, or no mod support. */ -native GetClientDeaths(client); +native int GetClientDeaths(int client); /** * Returns the client's frag count. @@ -669,7 +648,7 @@ native GetClientDeaths(client); * @return Frag count. * @error Invalid client index, client not in game, or no mod support. */ -native GetClientFrags(client); +native int GetClientFrags(int client); /** * Returns the client's send data rate in bytes/sec. @@ -678,7 +657,7 @@ native GetClientFrags(client); * @return Data rate. * @error Invalid client index, client not connected, or fake client. */ -native GetClientDataRate(client); +native int GetClientDataRate(int client); /** * Returns if a client is timing out @@ -687,7 +666,7 @@ native GetClientDataRate(client); * @return True if client is timing out, false otherwise. * @error Invalid client index, client not connected, or fake client. */ -native bool:IsClientTimingOut(client); +native bool IsClientTimingOut(int client); /** * Returns the client's connection time in seconds. @@ -696,7 +675,7 @@ native bool:IsClientTimingOut(client); * @return Connection time. * @error Invalid client index, client not connected, or fake client. */ -native Float:GetClientTime(client); +native float GetClientTime(int client); /** * Returns the client's current latency (RTT), more accurate than GetAvgLatency but jittering. @@ -706,7 +685,7 @@ native Float:GetClientTime(client); * @return Latency, or -1 if network info is not available. * @error Invalid client index, client not connected, or fake client. */ -native Float:GetClientLatency(client, NetFlow:flow); +native float GetClientLatency(int client, NetFlow flow); /** * Returns the client's average packet latency in seconds. @@ -716,7 +695,7 @@ native Float:GetClientLatency(client, NetFlow:flow); * @return Latency, or -1 if network info is not available. * @error Invalid client index, client not connected, or fake client. */ -native Float:GetClientAvgLatency(client, NetFlow:flow); +native float GetClientAvgLatency(int client, NetFlow flow); /** * Returns the client's average packet loss, values go from 0 to 1 (for percentages). @@ -726,7 +705,7 @@ native Float:GetClientAvgLatency(client, NetFlow:flow); * @return Average packet loss, or -1 if network info is not available. * @error Invalid client index, client not connected, or fake client. */ -native Float:GetClientAvgLoss(client, NetFlow:flow); +native float GetClientAvgLoss(int client, NetFlow flow); /** * Returns the client's average packet choke, values go from 0 to 1 (for percentages). @@ -736,7 +715,7 @@ native Float:GetClientAvgLoss(client, NetFlow:flow); * @return Average packet loss, or -1 if network info is not available. * @error Invalid client index, client not connected, or fake client. */ -native Float:GetClientAvgChoke(client, NetFlow:flow); +native float GetClientAvgChoke(int client, NetFlow flow); /** * Returns the client's data flow in bytes/sec. @@ -746,7 +725,7 @@ native Float:GetClientAvgChoke(client, NetFlow:flow); * @return Data flow. * @error Invalid client index, client not connected, or fake client. */ -native Float:GetClientAvgData(client, NetFlow:flow); +native float GetClientAvgData(int client, NetFlow flow); /** * Returns the client's average packet frequency in packets/sec. @@ -756,7 +735,7 @@ native Float:GetClientAvgData(client, NetFlow:flow); * @return Packet frequency. * @error Invalid client index, client not connected, or fake client. */ -native Float:GetClientAvgPackets(client, NetFlow:flow); +native float GetClientAvgPackets(int client, NetFlow flow); /** * Translates an userid index to the real player index. @@ -765,7 +744,7 @@ native Float:GetClientAvgPackets(client, NetFlow:flow); * @return Client value. * @error Returns 0 if invalid userid. */ -native GetClientOfUserId(userid); +native int GetClientOfUserId(int userid); /** * Disconnects a client from the server as soon as the next frame starts. @@ -783,10 +762,9 @@ native GetClientOfUserId(userid); * @param format Optional formatting rules for disconnect reason. * Note that a period is automatically appended to the string by the engine. * @param ... Variable number of format parameters. - * @noreturn * @error Invalid client index, or client not connected. */ -native KickClient(client, const String:format[]="", any:...); +native void KickClient(int client, const char[] format="", any ...); /** * Immediately disconnects a client from the server. @@ -799,10 +777,9 @@ native KickClient(client, const String:format[]="", any:...); * @param format Optional formatting rules for disconnect reason. * Note that a period is automatically appended to the string by the engine. * @param ... Variable number of format parameters. - * @noreturn * @error Invalid client index, or client not connected. */ -native KickClientEx(client, const String:format[]="", any:...); +native void KickClientEx(int client, const char[] format="", any ...); /** * Changes a client's team through the mod's generic team changing function. @@ -810,11 +787,10 @@ native KickClientEx(client, const String:format[]="", any:...); * * @param client Client index. * @param team Mod-specific team index. - * @noreturn * @error Invalid client index, client not connected, or lack of * mod support. */ -native ChangeClientTeam(client, team); +native void ChangeClientTeam(int client, int team); /** * Returns the clients unique serial identifier. @@ -823,7 +799,7 @@ native ChangeClientTeam(client, team); * @return Serial number. * @error Invalid client index, or client not connected. */ -native GetClientSerial(client); +native int GetClientSerial(int client); /** * Returns the client index by its serial number. @@ -831,5 +807,4 @@ native GetClientSerial(client); * @param serial Serial number. * @return Client index, or 0 for invalid serial. */ -native GetClientFromSerial(serial); - +native int GetClientFromSerial(int serial); diff --git a/plugins/include/console.inc b/plugins/include/console.inc index a7107cba..0c30d516 100644 --- a/plugins/include/console.inc +++ b/plugins/include/console.inc @@ -111,9 +111,8 @@ enum ReplySource * * @param format Formatting rules. * @param ... Variable number of format parameters. - * @noreturn */ -native ServerCommand(const String:format[], any:...); +native void ServerCommand(const char[] format, any ...); /** * Executes a server command as if it were on the server console (or RCON) @@ -128,25 +127,21 @@ native ServerCommand(const String:format[], any:...); * @param maxlen Length of buffer. * @param format Formatting rules. * @param ... Variable number of format parameters. - * @noreturn */ -native ServerCommandEx(String:buffer[], maxlen, const String:format[], any:...); +native void ServerCommandEx(char[] buffer, int maxlen, const char[] format, any ...); /** * Inserts a server command at the beginning of the server command buffer. * * @param format Formatting rules. * @param ... Variable number of format parameters. - * @noreturn */ -native InsertServerCommand(const String:format[], any:...); +native void InsertServerCommand(const char[] format, any ...); /** * Executes every command in the server's command buffer, rather than once per frame. - * - * @noreturn */ -native ServerExecute(); +native void ServerExecute(); /** * Executes a client command. Note that this will not work on clients unless @@ -155,10 +150,9 @@ native ServerExecute(); * @param client Index of the client. * @param fmt Format of the client command. * @param ... Format parameters - * @noreturn * @error Invalid client index, or client not connected. */ -native ClientCommand(client, const String:fmt[], any:...); +native void ClientCommand(int client, const char[] fmt, any ...); /** * Executes a client command on the server without being networked. @@ -172,10 +166,9 @@ native ClientCommand(client, const String:fmt[], any:...); * @param client Index of the client. * @param fmt Format of the client command. * @param ... Format parameters - * @noreturn * @error Invalid client index, or client not connected. */ -native FakeClientCommand(client, const String:fmt[], any:...); +native void FakeClientCommand(int client, const char[] fmt, any ...); /** * Executes a client command on the server without being networked. The @@ -185,17 +178,15 @@ native FakeClientCommand(client, const String:fmt[], any:...); * @param client Index of the client. * @param fmt Format of the client command. * @param ... Format parameters - * @noreturn * @error Invalid client index, or client not connected. */ -native FakeClientCommandEx(client, const String:fmt[], any:...); +native void FakeClientCommandEx(int client, const char[] fmt, any ...); /** * Executes a KeyValues client command on the server without being networked. * * @param client Index of the client. * @param kv KeyValues data to be sent. - * @noreturn * @error Invalid client index, client not connected, * or unsupported on current game. */ @@ -206,9 +197,8 @@ native void FakeClientCommandKeyValues(int client, KeyValues kv); * * @param format Formatting rules. * @param ... Variable number of format parameters. - * @noreturn */ -native PrintToServer(const String:format[], any:...); +native void PrintToServer(const char[] format, any ...); /** * Sends a message to a client's console. @@ -216,10 +206,9 @@ native PrintToServer(const String:format[], any:...); * @param client Client index. * @param format Formatting rules. * @param ... Variable number of format parameters. - * @noreturn * @error If the client is not connected an error will be thrown. */ -native PrintToConsole(client, const String:format[], any:...); +native void PrintToConsole(int client, const char[] format, any ...); /** * Reples to a message in a command. @@ -231,17 +220,16 @@ native PrintToConsole(client, const String:format[], any:...); * @param client Client index, or 0 for server. * @param format Formatting rules. * @param ... Variable number of format parameters. - * @noreturn * @error If the client is not connected or invalid. */ -native ReplyToCommand(client, const String:format[], any:...); +native void ReplyToCommand(int client, const char[] format, any ...); /** * Returns the current reply source of a command. * * @return ReplySource value. */ -native ReplySource:GetCmdReplySource(); +native ReplySource GetCmdReplySource(); /** * Sets the current reply source of a command. @@ -252,7 +240,7 @@ native ReplySource:GetCmdReplySource(); * @param source New ReplySource value. * @return Old ReplySource value. */ -native ReplySource:SetCmdReplySource(ReplySource:source); +native ReplySource SetCmdReplySource(ReplySource source); /** * Returns whether the current say hook is a chat trigger. @@ -261,7 +249,7 @@ native ReplySource:SetCmdReplySource(ReplySource:source); * * @return True if a chat trigger, false otherwise. */ -native bool:IsChatTrigger(); +native bool IsChatTrigger(); /** * Displays usage of an admin command to users depending on the @@ -273,10 +261,9 @@ native bool:IsChatTrigger(); * @param tag Tag to prepend to the message. * @param format Formatting rules. * @param ... Variable number of format parameters. - * @noreturn * @error */ -native ShowActivity2(client, const String:tag[], const String:format[], any:...); +native void ShowActivity2(int client, const char[] tag, const char[] format, any ...); /** * Displays usage of an admin command to users depending on the @@ -290,10 +277,9 @@ native ShowActivity2(client, const String:tag[], const String:format[], any:...) * @param client Client index doing the action, or 0 for server. * @param format Formatting rules. * @param ... Variable number of format parameters. - * @noreturn * @error */ -native ShowActivity(client, const String:format[], any:...); +native void ShowActivity(int client, const char[] format, any ...); /** * Same as ShowActivity(), except the tag parameter is used instead of @@ -303,10 +289,9 @@ native ShowActivity(client, const String:format[], any:...); * @param tag Tag to display with. * @param format Formatting rules. * @param ... Variable number of format parameters. - * @noreturn * @error */ -native ShowActivityEx(client, const String:tag[], const String:format[], any:...); +native void ShowActivityEx(int client, const char[] tag, const char[] format, any ...); /** * Given an originating client and a target client, returns the string @@ -324,7 +309,7 @@ native ShowActivityEx(client, const String:tag[], const String:format[], any:... * sm_show_activity filters. * @error Invalid client index or client not connected. */ -native FormatActivitySource(client, target, const String:namebuf[], maxlength); +native bool FormatActivitySource(int client, int target, const char[] namebuf, int maxlength); /** * Called when a server-only command is invoked. @@ -344,10 +329,9 @@ typedef SrvCmd = function Action (int args); * @param callback A function to use as a callback for when the command is invoked. * @param description Optional description to use for command creation. * @param flags Optional flags to use for command creation. - * @noreturn * @error Command name is the same as an existing convar. */ -native RegServerCmd(const String:cmd[], SrvCmd:callback, const String:description[]="", flags=0); +native void RegServerCmd(const char[] cmd, SrvCmd callback, const char[] description="", int flags=0); /** * Called when a generic console command is invoked. @@ -370,10 +354,9 @@ typedef ConCmd = function Action (int client, int args); * @param callback A function to use as a callback for when the command is invoked. * @param description Optional description to use for command creation. * @param flags Optional flags to use for command creation. - * @noreturn * @error Command name is the same as an existing convar. */ -native RegConsoleCmd(const String:cmd[], ConCmd:callback, const String:description[]="", flags=0); +native void RegConsoleCmd(const char[] cmd, ConCmd callback, const char[] description="", int flags=0); /** * Creates a console command as an administrative command. If the command does not exist, @@ -389,15 +372,14 @@ native RegConsoleCmd(const String:cmd[], ConCmd:callback, const String:descripti * @param group String containing the command group to use. If empty, * the plugin's filename will be used instead. * @param flags Optional console flags. - * @noreturn * @error Command name is the same as an existing convar. */ -native RegAdminCmd(const String:cmd[], - ConCmd:callback, - adminflags, - const String:description[]="", - const String:group[]="", - flags=0); +native void RegAdminCmd(const char[] cmd, + ConCmd callback, + int adminflags, + const char[] description="", + const char[] group="", + int flags=0); /** * Returns the number of arguments from the current console or server command. @@ -405,7 +387,7 @@ native RegAdminCmd(const String:cmd[], * * @return Number of arguments to the current command. */ -native GetCmdArgs(); +native int GetCmdArgs(); /** * Retrieves a command argument given its index, from the current console or @@ -417,7 +399,7 @@ native GetCmdArgs(); * @param maxlength Maximum length of the buffer. * @return Length of string written to buffer. */ -native GetCmdArg(argnum, String:buffer[], maxlength); +native int GetCmdArg(int argnum, char[] buffer, int maxlength); /** * Retrieves the entire command argument string in one lump from the current @@ -427,14 +409,14 @@ native GetCmdArg(argnum, String:buffer[], maxlength); * @param maxlength Maximum length of the buffer. * @return Length of string written to buffer. */ -native GetCmdArgString(String:buffer[], maxlength); +native int GetCmdArgString(char[] buffer, int maxlength); /** * Gets a command iterator. Must be freed with CloseHandle(). * * @return A new command iterator. */ -native Handle:GetCommandIterator(); +native Handle GetCommandIterator(); /** * Reads a command iterator, then advances to the next command if any. @@ -448,12 +430,12 @@ native Handle:GetCommandIterator(); * @param descLen Command description buffer size. * @return True on success, false if there are no more commands. */ -native bool:ReadCommandIterator(Handle:iter, - String:name[], - nameLen, - &eflags=0, - String:desc[]="", - descLen=0); +native bool ReadCommandIterator(Handle iter, + char[] name, + int nameLen, + int &eflags=0, + char[] desc="", + int descLen=0); /** * Returns whether a client has access to a given command string. The string @@ -472,10 +454,10 @@ native bool:ReadCommandIterator(Handle:iter, * there is a matching admin command. * @return True if the client has access, false otherwise. */ -native bool:CheckCommandAccess(client, - const String:command[], - flags, - bool:override_only=false); +native bool CheckCommandAccess(int client, + const char[] command, + int flags, + bool override_only=false); /** * Returns whether an admin has access to a given command string. The string @@ -494,10 +476,10 @@ native bool:CheckCommandAccess(client, * there is a matching admin command. * @return True if the admin has access, false otherwise. */ -native bool:CheckAccess(AdminId:id, - const String:command[], - flags, - bool:override_only=false); +native bool CheckAccess(AdminId id, + const char[] command, + int flags, + bool override_only=false); /** * Returns the bitstring of flags of a command. @@ -506,7 +488,7 @@ native bool:CheckAccess(AdminId:id, * @return A bitstring containing the FCVAR_* flags that are enabled * or INVALID_FCVAR_FLAGS if command not found. */ -native GetCommandFlags(const String:name[]); +native int GetCommandFlags(const char[] name); /** * Sets the bitstring of flags of a command. @@ -515,7 +497,7 @@ native GetCommandFlags(const String:name[]); * @param flags A bitstring containing the FCVAR_* flags to enable. * @return True on success, otherwise false. */ -native bool:SetCommandFlags(const String:name[], flags); +native bool SetCommandFlags(const char[] name, int flags); /** * Starts a ConCommandBase search, traversing the list of ConVars and @@ -537,7 +519,7 @@ native bool:SetCommandFlags(const String:name[], flags); * On failure, INVALID_HANDLE is returned, and the * contents of outputs is undefined. */ -native Handle:FindFirstConCommand(String:buffer[], max_size, &bool:isCommand, &flags=0, String:description[]="", descrmax_size=0); +native Handle FindFirstConCommand(char[] buffer, int max_size, bool &isCommand, int &flags=0, char[] description="", int descrmax_size=0); /** * Reads the next entry in a ConCommandBase iterator. @@ -555,7 +537,7 @@ native Handle:FindFirstConCommand(String:buffer[], max_size, &bool:isCommand, &f * If no more entries exist, false is returned, and the * contents of outputs is undefined. */ -native bool:FindNextConCommand(Handle:search, String:buffer[], max_size, &bool:isCommand, &flags=0, String:description[]="", descrmax_size=0); +native bool FindNextConCommand(Handle search, char[] buffer, int max_size, bool &isCommand, int &flags=0, char[] description="", int descrmax_size=0); /** * Adds an informational string to the server's public "tags". @@ -565,17 +547,15 @@ native bool:FindNextConCommand(Handle:search, String:buffer[], max_size, &bool:i * Note: Currently, this function does nothing because of bugs in the Valve master. * * @param tag Tag string to append. - * @noreturn */ -native AddServerTag(const String:tag[]); +native void AddServerTag(const char[] tag); /** * Removes a tag previously added by the calling plugin. * * @param tag Tag string to remove. - * @noreturn */ -native RemoveServerTag(const String:tag[]); +native void RemoveServerTag(const char[] tag); /** * Callback for command listeners. This is invoked whenever any command @@ -622,7 +602,7 @@ typedef CommandListener = function Action (int client, const char[] command, int * @return True if this feature is available on the current game, * false otherwise. */ -native bool:AddCommandListener(CommandListener:callback, const String:command[]=""); +native bool AddCommandListener(CommandListener callback, const char[] command=""); /** * Removes a previously added command listener, in reverse order of being added. @@ -632,7 +612,7 @@ native bool:AddCommandListener(CommandListener:callback, const String:command[]= * The command is case insensitive. * @error Callback has no active listeners. */ -native RemoveCommandListener(CommandListener:callback, const String:command[]=""); +native void RemoveCommandListener(CommandListener callback, const char[] command=""); /** * Returns true if the supplied command exists. @@ -640,7 +620,7 @@ native RemoveCommandListener(CommandListener:callback, const String:command[]="" * @param command Command to find. * @return True if command is found, false otherwise. */ -stock bool:CommandExists(const String:command[]) +stock bool CommandExists(const char[] command) { return (GetCommandFlags(command) != INVALID_FCVAR_FLAGS); } @@ -654,7 +634,7 @@ stock bool:CommandExists(const String:command[]) * @return An Action value. Returning Plugin_Handled bypasses the game function call. Returning Plugin_Stop bypasses the post hook as well as the game function. */ -forward Action:OnClientSayCommand(client, const String:command[], const String:sArgs[]); +forward Action OnClientSayCommand(int client, const char[] command, const char[] sArgs); /** * Global post listener for the chat commands. @@ -662,6 +642,5 @@ forward Action:OnClientSayCommand(client, const String:command[], const String:s * @param client Client index. * @param command Command name. * @param sArgs Chat argument string. - * */ forward void OnClientSayCommand_Post(int client, const char[] command, const char[] sArgs); diff --git a/plugins/include/cstrike.inc b/plugins/include/cstrike.inc index c29e144c..a149833a 100644 --- a/plugins/include/cstrike.inc +++ b/plugins/include/cstrike.inc @@ -141,7 +141,7 @@ enum CSWeaponID * @param client Client index * @param weapon User input for weapon name */ -forward Action:CS_OnBuyCommand(client, const String:weapon[]); +forward Action CS_OnBuyCommand(int client, const char[] weapon); /** * Called when CSWeaponDrop is called @@ -151,7 +151,7 @@ forward Action:CS_OnBuyCommand(client, const String:weapon[]); * @param client Client index * @param weaponIndex Weapon index */ -forward Action:CS_OnCSWeaponDrop(client, weaponIndex); +forward Action CS_OnCSWeaponDrop(int client, int weaponIndex); /** * Called when game retrieves a weapon's price for a player. @@ -166,7 +166,7 @@ forward Action:CS_OnCSWeaponDrop(client, weaponIndex); * * @note Not all "weapons" call GetWeaponPrice. Example: c4, knife, vest, vest helmet, night vision. */ -forward Action:CS_OnGetWeaponPrice(client, const String:weapon[], &price); +forward Action CS_OnGetWeaponPrice(int client, const char[] weapon, int &price); /** * Called when TerminateRound is called. @@ -177,26 +177,24 @@ forward Action:CS_OnGetWeaponPrice(client, const String:weapon[], &price); * @param delay Time (in seconds) until new round starts * @param reason Reason for round end */ -forward Action:CS_OnTerminateRound(&Float:delay, &CSRoundEndReason:reason); +forward Action CS_OnTerminateRound(float &delay, CSRoundEndReason &reason); /** * Respawns a player. * * @param client Player's index. - * @noreturn * @error Invalid client index, client not in game. */ -native CS_RespawnPlayer(client); +native void CS_RespawnPlayer(int client); /** * Switches the player's team. * * @param client Player's index. * @param team Team index. - * @noreturn * @error Invalid client index, client not in game. */ -native CS_SwitchTeam(client, team); +native void CS_SwitchTeam(int client, int team); /** * Forces a player to drop or toss their weapon @@ -206,10 +204,9 @@ native CS_SwitchTeam(client, team); * @param toss True to toss weapon (with velocity) or false to just drop weapon * @param blockhook Set to true to stop the corresponding CS_OnCSWeaponDrop * - * @noreturn * @error Invalid client index, client not in game, or invalid weapon index. */ -native CS_DropWeapon(client, weaponIndex, bool:toss, bool:blockhook = false); +native void CS_DropWeapon(int client, int weaponIndex, bool toss, bool blockhook = false); /** * Forces round to end with a reason @@ -218,9 +215,8 @@ native CS_DropWeapon(client, weaponIndex, bool:toss, bool:blockhook = false); * @param reason Reason for the round ending * @param blockhook Set to true to stop the corresponding CS_OnTerminateRound * forward from being called. - * @noreturn */ -native CS_TerminateRound(Float:delay, CSRoundEndReason:reason, bool:blockhook = false); +native void CS_TerminateRound(float delay, CSRoundEndReason reason, bool blockhook = false); /** * Gets a weapon name from a weapon alias @@ -228,11 +224,10 @@ native CS_TerminateRound(Float:delay, CSRoundEndReason:reason, bool:blockhook = * @param alias Weapons alias to get weapon name for. * @param weapon Buffer to store weapons name * @param size Size of buffer to store the weapons name. - * @noreturn * * @note Will set the buffer to the original alias if it is not an alias to a weapon. */ -native CS_GetTranslatedWeaponAlias(const String:alias[], String:weapon[], size); +native void CS_GetTranslatedWeaponAlias(const char[] alias, char[] weapon, int size); /** * Gets a weapon's price @@ -245,7 +240,7 @@ native CS_GetTranslatedWeaponAlias(const String:alias[], String:weapon[], size); * @error Invalid client, failing to get weapon info, or failing to get price offset. * @note c4, knife and shield will always return 0. vest, vest helmet and night vision will always return default price. */ -native CS_GetWeaponPrice(client, CSWeaponID:id, bool:defaultprice = false); +native int CS_GetWeaponPrice(int client, CSWeaponID id, bool defaultprice = false); /** * Gets a clients clan tag @@ -256,17 +251,16 @@ native CS_GetWeaponPrice(client, CSWeaponID:id, bool:defaultprice = false); * * @error Invalid client. */ -native CS_GetClientClanTag(client, String:buffer[], size); +native int CS_GetClientClanTag(int client, char[] buffer, int size); /** * Sets a clients clan tag * @param client Client index to set clan tag for. * @param tag Tag to set clients clan tag as. - * @noreturn * * @error Invalid client. */ -native CS_SetClientClanTag(client, const String:tag[]); +native void CS_SetClientClanTag(int client, const char[] tag); /** * Gets a team's score @@ -275,18 +269,17 @@ native CS_SetClientClanTag(client, const String:tag[]); * * @error Invalid team index. */ -native CS_GetTeamScore(team); +native int CS_GetTeamScore(int team); /** * Sets a team's score * @param team Team index to set score for. * @param value Value to set teams score as. - * @noreturn * * @error Invalid team index. * @note This will update the scoreboard only after the scoreboard update function is called. Use SetTeamScore plus this to update the scoreboard instantly and save values correctly. */ -native CS_SetTeamScore(team, value); +native void CS_SetTeamScore(int team, int value); /** * Gets a client's mvp count @@ -295,17 +288,16 @@ native CS_SetTeamScore(team, value); * * @error Invalid client. */ -native CS_GetMVPCount(client); +native int CS_GetMVPCount(int client); /** * Sets a client's mvp count * @param client Client index to set mvp count for. * @param value Value to set client's mvp count as. - * @noreturn * * @error Invalid client. */ -native CS_SetMVPCount(client, value); +native void CS_SetMVPCount(int client, int value); /** * Gets a client's contribution score (CS:GO only) @@ -314,17 +306,16 @@ native CS_SetMVPCount(client, value); * * @error Invalid client. */ -native CS_GetClientContributionScore(client); +native int CS_GetClientContributionScore(int client); /** * Sets a client's contribution score (CS:GO only) * @param client Client index to set score for. * @param value Value to set client's score as. - * @noreturn * * @error Invalid client. */ -native CS_SetClientContributionScore(client, value); +native void CS_SetClientContributionScore(int client, int value); /** * Gets a client's assists (CS:GO only) @@ -333,17 +324,16 @@ native CS_SetClientContributionScore(client, value); * * @error Invalid client. */ -native CS_GetClientAssists(client); +native int CS_GetClientAssists(int client); /** * Sets a client's assists (CS:GO only) * @param client Client index to set assists for. * @param value Value to set client's assists as. - * @noreturn * * @error Invalid client. */ -native CS_SetClientAssists(client, value); +native void CS_SetClientAssists(int client, int value); /** * Gets a weaponID from a alias @@ -352,7 +342,7 @@ native CS_SetClientAssists(client, value); * * @note For best results use CS_GetTranslatedWeaponAlias on the weapon name before passing it. */ -native CSWeaponID:CS_AliasToWeaponID(const String:alias[]); +native CSWeaponID CS_AliasToWeaponID(const char[] alias); /** * Gets a alias from a weaponID @@ -361,7 +351,7 @@ native CSWeaponID:CS_AliasToWeaponID(const String:alias[]); * @param len Length of the destination array. * @return Returns number of cells written. */ -native CS_WeaponIDToAlias(CSWeaponID:weaponID, String:destination[], len); +native int CS_WeaponIDToAlias(CSWeaponID weaponID, char[] destination, int len); /** * Returns weather a WeaponID is valid on the current mod (css or csgo) @@ -370,21 +360,20 @@ native CS_WeaponIDToAlias(CSWeaponID:weaponID, String:destination[], len); * * @note This will return false always for CSWeapon_NONE */ -native bool:CS_IsValidWeaponID(CSWeaponID:id); +native bool CS_IsValidWeaponID(CSWeaponID id); /** * Sets a player's model based on their current class * * @param client Player's index. - * @noreturn * @error Invalid client index, client not in game. */ -native CS_UpdateClientModel(client); +native void CS_UpdateClientModel(int client); /** * Do not edit below this line! */ -public Extension:__ext_cstrike = +public Extension __ext_cstrike = { name = "cstrike", file = "games/game.cstrike.ext", @@ -397,7 +386,7 @@ public Extension:__ext_cstrike = }; #if !defined REQUIRE_EXTENSIONS -public __ext_cstrike_SetNTVOptional() +public void __ext_cstrike_SetNTVOptional() { MarkNativeAsOptional("CS_RespawnPlayer"); MarkNativeAsOptional("CS_SwitchTeam"); @@ -421,4 +410,3 @@ public __ext_cstrike_SetNTVOptional() MarkNativeAsOptional("CS_UpdateClientModel"); } #endif - diff --git a/plugins/include/entity.inc b/plugins/include/entity.inc index 450125db..21d32497 100644 --- a/plugins/include/entity.inc +++ b/plugins/include/entity.inc @@ -83,14 +83,14 @@ enum PropFieldType * * @return Maximum number of entities. */ -native GetMaxEntities(); +native int GetMaxEntities(); /** * Returns the number of entities in the server. * * @return Number of entities in the server. */ -native GetEntityCount(); +native int GetEntityCount(); /** * Returns whether or not an entity is valid. Returns false @@ -99,7 +99,7 @@ native GetEntityCount(); * @param edict Index of the entity/edict. * @return True if valid, false otherwise. */ -native bool:IsValidEntity(edict); +native bool IsValidEntity(int edict); /** * Returns whether or not an edict index is valid. @@ -107,7 +107,7 @@ native bool:IsValidEntity(edict); * @param edict Index of the edict. * @return True if valid, false otherwise. */ -native bool:IsValidEdict(edict); +native bool IsValidEdict(int edict); /** * Returns whether or not an entity is a valid networkable edict. @@ -115,23 +115,22 @@ native bool:IsValidEdict(edict); * @param edict Index of the edict. * @return True if networkable, false if invalid or not networkable. */ -native bool:IsEntNetworkable(edict); +native bool IsEntNetworkable(int edict); /** * Creates a new edict (the basis of a networkable entity) * * @return Index of the edict, 0 on failure. */ -native CreateEdict(); +native int CreateEdict(); /** * Removes an edict from the world. * * @param edict Index of the edict. - * @noreturn * @error Invalid edict index. */ -native RemoveEdict(edict); +native void RemoveEdict(int edict); /** * Returns the flags on an edict. These are not the same as entity flags. @@ -140,17 +139,16 @@ native RemoveEdict(edict); * @return Edict flags. * @error Invalid edict index. */ -native GetEdictFlags(edict); +native int GetEdictFlags(int edict); /** * Sets the flags on an edict. These are not the same as entity flags. * * @param edict Index of the entity. * @param flags Flags to set. - * @noreturn * @error Invalid edict index. */ -native SetEdictFlags(edict, flags); +native void SetEdictFlags(int edict, int flags); /** * Retrieves an edict classname. @@ -160,7 +158,7 @@ native SetEdictFlags(edict, flags); * @param maxlength Maximum length of the buffer. * @return True on success, false if there is no classname set. */ -native bool:GetEdictClassname(edict, String:clsname[], maxlength); +native bool GetEdictClassname(int edict, char[] clsname, int maxlength); /** * Retrieves an entity's networkable serverclass name. @@ -172,7 +170,7 @@ native bool:GetEdictClassname(edict, String:clsname[], maxlength); * @return True on success, false if the edict is not networkable. * @error Invalid edict index. */ -native bool:GetEntityNetClass(edict, String:clsname[], maxlength); +native bool GetEntityNetClass(int edict, char[] clsname, int maxlength); /** * @section Entity offset functions @@ -203,10 +201,9 @@ native bool:GetEntityNetClass(edict, String:clsname[], maxlength); * @param edict Index to the edict. * @param offset Offset to mark as changed. If 0, * the entire edict is marked as changed. - * @noreturn * @error Invalid entity or offset out of bounds. */ -native ChangeEdictState(edict, offset = 0); +native void ChangeEdictState(int edict, int offset = 0); /** * Peeks into an entity's object data and retrieves the integer value at @@ -218,7 +215,7 @@ native ChangeEdictState(edict, offset = 0); * @return Value at the given memory location. * @error Invalid entity or offset out of reasonable bounds. */ -native GetEntData(entity, offset, size=4); +native int GetEntData(int entity, int offset, int size=4); /** * Peeks into an entity's object data and sets the integer value at @@ -229,11 +226,9 @@ native GetEntData(entity, offset, size=4); * @param value Value to set. * @param size Number of bytes to write (valid values are 1, 2, or 4). * @param changeState If true, change will be sent over the network. - * @return Value at the given memory location. * @error Invalid entity or offset out of reasonable bounds. - * @noreturn */ -native SetEntData(entity, offset, any:value, size=4, bool:changeState=false); +native void SetEntData(int entity, int offset, any value, int size=4, bool changeState=false); /** * Peeks into an entity's object data and retrieves the float value at @@ -244,7 +239,7 @@ native SetEntData(entity, offset, any:value, size=4, bool:changeState=false); * @return Value at the given memory location. * @error Invalid entity or offset out of reasonable bounds. */ -native Float:GetEntDataFloat(entity, offset); +native float GetEntDataFloat(int entity, int offset); /** * Peeks into an entity's object data and sets the float value at @@ -254,11 +249,9 @@ native Float:GetEntDataFloat(entity, offset); * @param offset Offset to use. * @param value Value to set. * @param changeState If true, change will be sent over the network. - * @return Value at the given memory location. * @error Invalid entity or offset out of reasonable bounds. - * @noreturn */ -native SetEntDataFloat(entity, offset, Float:value, bool:changeState=false); +native void SetEntDataFloat(int entity, int offset, float value, bool changeState=false); /** * This function is deprecated. Use GetEntDataEnt2 instead, for @@ -276,7 +269,7 @@ native SetEntDataFloat(entity, offset, Float:value, bool:changeState=false); * @error Invalid entity or offset out of reasonable bounds. */ #pragma deprecated Use GetEntDataEnt2() instead. -native GetEntDataEnt(entity, offset); +native int GetEntDataEnt(int entity, int offset); /** * This function is deprecated. Use SetEntDataEnt2 instead, for @@ -290,11 +283,10 @@ native GetEntDataEnt(entity, offset); * @param offset Offset to use. * @param other Entity index to set, or 0 to clear. * @param changeState If true, change will be sent over the network. - * @noreturn * @error Invalid entity or offset out of reasonable bounds. */ #pragma deprecated Use SetEntDataEnt2() instead. -native SetEntDataEnt(entity, offset, other, bool:changeState=false); +native void SetEntDataEnt(int entity, int offset, int other, bool changeState=false); /** * Peeks into an entity's object data and retrieves the entity index @@ -310,7 +302,7 @@ native SetEntDataEnt(entity, offset, other, bool:changeState=false); * or the stored entity is invalid, then -1 is returned. * @error Invalid input entity, or offset out of reasonable bounds. */ -native GetEntDataEnt2(entity, offset); +native int GetEntDataEnt2(int entity, int offset); /** * Peeks into an entity's object data and sets the entity index at the @@ -324,10 +316,9 @@ native GetEntDataEnt2(entity, offset); * @param offset Offset to use. * @param other Entity index to set, or -1 to clear. * @param changeState If true, change will be sent over the network. - * @noreturn * @error Invalid input entity, or offset out of reasonable bounds. */ -native SetEntDataEnt2(entity, offset, other, bool:changeState=false); +native void SetEntDataEnt2(int entity, int offset, int other, bool changeState=false); /** * Peeks into an entity's object data and retrieves the vector at the @@ -338,10 +329,9 @@ native SetEntDataEnt2(entity, offset, other, bool:changeState=false); * @param entity Edict index. * @param offset Offset to use. * @param vec Vector buffer to store data in. - * @noreturn * @error Invalid entity or offset out of reasonable bounds. */ -native GetEntDataVector(entity, offset, Float:vec[3]); +native void GetEntDataVector(int entity, int offset, float vec[3]); /** * Peeks into an entity's object data and sets the vector at the given @@ -353,10 +343,9 @@ native GetEntDataVector(entity, offset, Float:vec[3]); * @param offset Offset to use. * @param vec Vector to set. * @param changeState If true, change will be sent over the network. - * @noreturn * @error Invalid entity or offset out of reasonable bounds. */ -native SetEntDataVector(entity, offset, const Float:vec[3], bool:changeState=false); +native void SetEntDataVector(int entity, int offset, const float vec[3], bool changeState=false); /** * Peeks into an entity's object data and retrieves the string at @@ -369,7 +358,7 @@ native SetEntDataVector(entity, offset, const Float:vec[3], bool:changeState=fal * @return Number of non-null bytes written. * @error Invalid entity or offset out of reasonable bounds. */ -native GetEntDataString(entity, offset, String:buffer[], maxlen); +native int GetEntDataString(int entity, int offset, char[] buffer, int maxlen); /** * Peeks into an entity's object data and sets the string at @@ -383,7 +372,7 @@ native GetEntDataString(entity, offset, String:buffer[], maxlen); * @return Number of non-null bytes written. * @error Invalid entity or offset out of reasonable bounds. */ -native SetEntDataString(entity, offset, const String:buffer[], maxlen, bool:changeState=false); +native int SetEntDataString(int entity, int offset, const char[] buffer, int maxlen, bool changeState=false); /** * @endsection @@ -404,7 +393,7 @@ native SetEntDataString(entity, offset, const String:buffer[], maxlen, bool:chan * @return An offset, or -1 on failure. */ #pragma deprecated Use FindSendPropInfo instead, or HasEntProp if you just want to check for existence. -native FindSendPropOffs(const String:cls[], const String:prop[]); +native int FindSendPropOffs(const char[] cls, const char[] prop); /** * Given a ServerClass name, finds a networkable send property offset. @@ -423,11 +412,11 @@ native FindSendPropOffs(const String:cls[], const String:prop[]); * If no offset is available, 0 is returned. * If the property is not found, -1 is returned. */ -native FindSendPropInfo(const String:cls[], - const String:prop[], - &PropFieldType:type=PropFieldType:0, - &num_bits=0, - &local_offset=0); +native int FindSendPropInfo(const char[] cls, + const char[] prop, + PropFieldType &type=view_as(0), + int &num_bits=0, + int &local_offset=0); /** * Given an entity, finds a datamap property offset. @@ -442,10 +431,10 @@ native FindSendPropInfo(const String:cls[], * @return An offset, or -1 on failure. */ #pragma deprecated Use FindDataMapInfo instead, or HasEntProp if you just want to check for existence. -native FindDataMapOffs(entity, - const String:prop[], - &PropFieldType:type=PropFieldType:0, - &num_bits=0); +native int FindDataMapOffs(int entity, + const char[] prop, + PropFieldType &type=view_as(0), + int &num_bits=0); /** * Given an entity, finds a nested datamap property offset. @@ -461,11 +450,11 @@ native FindDataMapOffs(entity, * FindDataMapOffs() would return. * @return An offset, or -1 on failure. */ -native FindDataMapInfo(entity, - const String:prop[], - &PropFieldType:type=PropFieldType:0, - &num_bits=0, - &local_offset=0); +native int FindDataMapInfo(int entity, + const char[] prop, + PropFieldType &type=view_as(0), + int &num_bits=0, + int &local_offset=0); /** * Wrapper function for finding a send property for a particular entity. @@ -477,17 +466,17 @@ native FindDataMapInfo(entity, * is used instead. * @return An offset, or -1 on failure. */ -stock GetEntSendPropOffs(ent, const String:prop[], bool:actual=false) +stock int GetEntSendPropOffs(int ent, const char[] prop, bool actual=false) { - new String:cls[64]; + char cls[64]; if (!GetEntityNetClass(ent, cls, sizeof(cls))) { return -1; } - new local = -1; - new offset = FindSendPropInfo(cls, prop, _, _, local); + int local = -1; + int offset = FindSendPropInfo(cls, prop, _, _, local); if (actual) { @@ -506,7 +495,7 @@ stock GetEntSendPropOffs(ent, const String:prop[], bool:actual=false) * @return Whether the property exists on the entity. * @error Invalid entity. */ -stock bool:HasEntProp(entity, PropType:type, const String:prop[]) +stock bool HasEntProp(int entity, PropType type, const char[] prop) { if (type == Prop_Data) { return (FindDataMapInfo(entity, prop) != -1); @@ -516,7 +505,7 @@ stock bool:HasEntProp(entity, PropType:type, const String:prop[]) return false; } - new String:cls[64]; + char cls[64]; if (!GetEntityNetClass(entity, cls, sizeof(cls))) { return false; } @@ -540,7 +529,7 @@ stock bool:HasEntProp(entity, PropType:type, const String:prop[]) * @return Value at the given property offset. * @error Invalid entity or property not found. */ -native GetEntProp(entity, PropType:type, const String:prop[], size=4, element=0); +native int GetEntProp(int entity, PropType type, const char[] prop, int size=4, int element=0); /** * Sets an integer value in an entity's property. @@ -557,9 +546,8 @@ native GetEntProp(entity, PropType:type, const String:prop[], size=4, element=0) * only used as a fallback in case detection fails. * @param element Element # (starting from 0) if property is an array. * @error Invalid entity or offset out of reasonable bounds. - * @noreturn */ -native SetEntProp(entity, PropType:type, const String:prop[], any:value, size=4, element=0); +native void SetEntProp(int entity, PropType type, const char[] prop, any value, int size=4, int element=0); /** * Retrieves a float value from an entity's property. @@ -574,7 +562,7 @@ native SetEntProp(entity, PropType:type, const String:prop[], any:value, size=4, * @return Value at the given property offset. * @error Invalid entity or offset out of reasonable bounds. */ -native Float:GetEntPropFloat(entity, PropType:type, const String:prop[], element=0); +native float GetEntPropFloat(int entity, PropType type, const char[] prop, int element=0); /** * Sets a float value in an entity's property. @@ -587,10 +575,9 @@ native Float:GetEntPropFloat(entity, PropType:type, const String:prop[], element * @param prop Property name. * @param value Value to set. * @param element Element # (starting from 0) if property is an array. - * @noreturn * @error Invalid entity or offset out of reasonable bounds. */ -native SetEntPropFloat(entity, PropType:type, const String:prop[], Float:value, element=0); +native void SetEntPropFloat(int entity, PropType type, const char[] prop, float value, int element=0); /** * Retrieves an entity index from an entity's property. @@ -607,7 +594,7 @@ native SetEntPropFloat(entity, PropType:type, const String:prop[], Float:value, * then -1 is returned. * @error Invalid entity or offset out of reasonable bounds. */ -native GetEntPropEnt(entity, PropType:type, const String:prop[], element=0); +native int GetEntPropEnt(int entity, PropType type, const char[] prop, int element=0); /** * Sets an entity index in an entity's property. @@ -620,10 +607,9 @@ native GetEntPropEnt(entity, PropType:type, const String:prop[], element=0); * @param prop Property name. * @param other Entity index to set, or -1 to unset. * @param element Element # (starting from 0) if property is an array. - * @noreturn * @error Invalid entity or offset out of reasonable bounds. */ -native SetEntPropEnt(entity, PropType:type, const String:prop[], other, element=0); +native void SetEntPropEnt(int entity, PropType type, const char[] prop, int other, int element=0); /** * Retrieves a vector of floats from an entity, given a named network property. @@ -636,11 +622,10 @@ native SetEntPropEnt(entity, PropType:type, const String:prop[], other, element= * @param prop Property name. * @param vec Vector buffer to store data in. * @param element Element # (starting from 0) if property is an array. - * @noreturn * @error Invalid entity, property not found, or property not * actually a vector data type. */ -native GetEntPropVector(entity, PropType:type, const String:prop[], Float:vec[3], element=0); +native void GetEntPropVector(int entity, PropType type, const char[] prop, float vec[3], int element=0); /** * Sets a vector of floats in an entity, given a named network property. @@ -653,11 +638,10 @@ native GetEntPropVector(entity, PropType:type, const String:prop[], Float:vec[3] * @param prop Property name. * @param vec Vector to set. * @param element Element # (starting from 0) if property is an array. - * @noreturn * @error Invalid entity, property not found, or property not * actually a vector data type. */ -native SetEntPropVector(entity, PropType:type, const String:prop[], const Float:vec[3], element=0); +native void SetEntPropVector(int entity, PropType type, const char[] prop, const float vec[3], int element=0); /** * Gets a network property as a string. @@ -671,7 +655,7 @@ native SetEntPropVector(entity, PropType:type, const String:prop[], const Float: * @return Number of non-null bytes written. * @error Invalid entity, offset out of reasonable bounds, or property is not a valid string. */ -native GetEntPropString(entity, PropType:type, const String:prop[], String:buffer[], maxlen, element=0); +native int GetEntPropString(int entity, PropType type, const char[] prop, char[] buffer, int maxlen, int element=0); /** * Sets a network property as a string. @@ -684,7 +668,7 @@ native GetEntPropString(entity, PropType:type, const String:prop[], String:buffe * @return Number of non-null bytes written. * @error Invalid entity, offset out of reasonable bounds, or property is not a valid string. */ -native SetEntPropString(entity, PropType:type, const String:prop[], const String:buffer[], element=0); +native int SetEntPropString(int entity, PropType type, const char[] prop, const char[] buffer, int element=0); /** * Retrieves the count of values that an entity property's array can store. @@ -695,7 +679,7 @@ native SetEntPropString(entity, PropType:type, const String:prop[], const String * @return Size of array (in elements) or 1 if property is not an array. * @error Invalid entity or property not found. */ -native GetEntPropArraySize(entity, PropType:type, const String:prop[]); +native int GetEntPropArraySize(int entity, PropType type, const char[] prop); /** * Copies an array of cells from an entity at a given offset. @@ -722,12 +706,11 @@ stock void GetEntDataArray(int entity, int offset, int[] array, int arraySize, i * @param arraySize Number of values to copy. * @param dataSize Size of each value in bytes (1, 2, or 4). * @param changeState True to set the network state as changed; false otherwise. - * @noreturn * @error Invalid entity or offset out of reasonable bounds. */ -stock SetEntDataArray(entity, offset, const array[], arraySize, dataSize=4, bool:changeState=false) +stock void SetEntDataArray(int entity, int offset, const int[] array, int arraySize, int dataSize=4, bool changeState=false) { - for (new i=0; i(GetEntProp(entity, Prop_Data, datamap)); } /** @@ -227,18 +226,17 @@ stock MoveType:GetEntityMoveType(entity) * * @param entity Entity index. * @param mt Movetype, see enum above. - * @noreturn * @error Invalid entity index, or lack of mod compliance. */ -stock SetEntityMoveType(entity, MoveType:mt) +stock void SetEntityMoveType(int entity, MoveType mt) { - static bool:gotconfig = false; - static String:datamap[32]; + static bool gotconfig = false; + static char datamap[32]; if (!gotconfig) { - new Handle:gc = LoadGameConfigFile("core.games"); - new bool:exists = GameConfGetKeyValue(gc, "m_MoveType", datamap, sizeof(datamap)); + Handle gc = LoadGameConfigFile("core.games"); + bool exists = GameConfGetKeyValue(gc, "m_MoveType", datamap, sizeof(datamap)); CloseHandle(gc); if (!exists) @@ -259,15 +257,15 @@ stock SetEntityMoveType(entity, MoveType:mt) * @return RenderMode value. * @error Invalid entity index, or lack of mod compliance. */ -stock RenderMode:GetEntityRenderMode(entity) +stock RenderMode GetEntityRenderMode(int entity) { - static bool:gotconfig = false; - static String:prop[32]; + static bool gotconfig = false; + static char prop[32]; if (!gotconfig) { - new Handle:gc = LoadGameConfigFile("core.games"); - new bool:exists = GameConfGetKeyValue(gc, "m_nRenderMode", prop, sizeof(prop)); + Handle gc = LoadGameConfigFile("core.games"); + bool exists = GameConfGetKeyValue(gc, "m_nRenderMode", prop, sizeof(prop)); CloseHandle(gc); if (!exists) @@ -278,7 +276,7 @@ stock RenderMode:GetEntityRenderMode(entity) gotconfig = true; } - return RenderMode:GetEntProp(entity, Prop_Send, prop, 1); + return view_as(GetEntProp(entity, Prop_Send, prop, 1)); } /** @@ -286,18 +284,17 @@ stock RenderMode:GetEntityRenderMode(entity) * * @param entity Entity index. * @param mode RenderMode value. - * @noreturn * @error Invalid entity index, or lack of mod compliance. */ -stock SetEntityRenderMode(entity, RenderMode:mode) +stock void SetEntityRenderMode(int entity, RenderMode mode) { - static bool:gotconfig = false; - static String:prop[32]; + static bool gotconfig = false; + static char prop[32]; if (!gotconfig) { - new Handle:gc = LoadGameConfigFile("core.games"); - new bool:exists = GameConfGetKeyValue(gc, "m_nRenderMode", prop, sizeof(prop)); + Handle gc = LoadGameConfigFile("core.games"); + bool exists = GameConfGetKeyValue(gc, "m_nRenderMode", prop, sizeof(prop)); CloseHandle(gc); if (!exists) @@ -318,15 +315,15 @@ stock SetEntityRenderMode(entity, RenderMode:mode) * @return RenderFx value. * @error Invalid entity index, or lack of mod compliance. */ -stock RenderFx:GetEntityRenderFx(entity) +stock RenderFx GetEntityRenderFx(int entity) { - static bool:gotconfig = false; - static String:prop[32]; + static bool gotconfig = false; + static char prop[32]; if (!gotconfig) { - new Handle:gc = LoadGameConfigFile("core.games"); - new bool:exists = GameConfGetKeyValue(gc, "m_nRenderFX", prop, sizeof(prop)); + Handle gc = LoadGameConfigFile("core.games"); + bool exists = GameConfGetKeyValue(gc, "m_nRenderFX", prop, sizeof(prop)); CloseHandle(gc); if (!exists) @@ -337,7 +334,7 @@ stock RenderFx:GetEntityRenderFx(entity) gotconfig = true; } - return RenderFx:GetEntProp(entity, Prop_Send, prop, 1); + return view_as(GetEntProp(entity, Prop_Send, prop, 1)); } /** @@ -345,18 +342,17 @@ stock RenderFx:GetEntityRenderFx(entity) * * @param entity Entity index. * @param fx RenderFx value. - * @noreturn * @error Invalid entity index, or lack of mod compliance. */ -stock SetEntityRenderFx(entity, RenderFx:fx) +stock void SetEntityRenderFx(int entity, RenderFx fx) { - static bool:gotconfig = false; - static String:prop[32]; + static bool gotconfig = false; + static char prop[32]; if (!gotconfig) { - new Handle:gc = LoadGameConfigFile("core.games"); - new bool:exists = GameConfGetKeyValue(gc, "m_nRenderFX", prop, sizeof(prop)); + Handle gc = LoadGameConfigFile("core.games"); + bool exists = GameConfGetKeyValue(gc, "m_nRenderFX", prop, sizeof(prop)); CloseHandle(gc); if (!exists) @@ -378,18 +374,17 @@ stock SetEntityRenderFx(entity, RenderFx:fx) * @param g Amount of green (0-255) * @param b Amount of blue (0-255) * @param a Amount of alpha (0-255) - * @noreturn * @error Invalid entity index, or lack of mod compliance. */ -stock GetEntityRenderColor(entity, &r, &g, &b, &a) +stock void GetEntityRenderColor(int entity, int &r, int &g, int &b, int &a) { - static bool:gotconfig = false; - static String:prop[32]; + static bool gotconfig = false; + static char prop[32]; if (!gotconfig) { - new Handle:gc = LoadGameConfigFile("core.games"); - new bool:exists = GameConfGetKeyValue(gc, "m_clrRender", prop, sizeof(prop)); + Handle gc = LoadGameConfigFile("core.games"); + bool exists = GameConfGetKeyValue(gc, "m_clrRender", prop, sizeof(prop)); CloseHandle(gc); if (!exists) @@ -400,7 +395,7 @@ stock GetEntityRenderColor(entity, &r, &g, &b, &a) gotconfig = true; } - new offset = GetEntSendPropOffs(entity, prop); + int offset = GetEntSendPropOffs(entity, prop); if (offset <= 0) { @@ -421,18 +416,17 @@ stock GetEntityRenderColor(entity, &r, &g, &b, &a) * @param g Amount of green (0-255) * @param b Amount of blue (0-255) * @param a Amount of alpha (0-255) - * @noreturn * @error Invalid entity index, or lack of mod compliance. */ -stock SetEntityRenderColor(entity, r=255, g=255, b=255, a=255) +stock void SetEntityRenderColor(int entity, int r=255, int g=255, int b=255, int a=255) { - static bool:gotconfig = false; - static String:prop[32]; + static bool gotconfig = false; + static char prop[32]; if (!gotconfig) { - new Handle:gc = LoadGameConfigFile("core.games"); - new bool:exists = GameConfGetKeyValue(gc, "m_clrRender", prop, sizeof(prop)); + Handle gc = LoadGameConfigFile("core.games"); + bool exists = GameConfGetKeyValue(gc, "m_clrRender", prop, sizeof(prop)); CloseHandle(gc); if (!exists) @@ -443,7 +437,7 @@ stock SetEntityRenderColor(entity, r=255, g=255, b=255, a=255) gotconfig = true; } - new offset = GetEntSendPropOffs(entity, prop); + int offset = GetEntSendPropOffs(entity, prop); if (offset <= 0) { @@ -463,15 +457,15 @@ stock SetEntityRenderColor(entity, r=255, g=255, b=255, a=255) * @return Entity's m_flGravity value. * @error Invalid entity index, or lack of mod compliance. */ -stock Float:GetEntityGravity(entity) +stock float GetEntityGravity(int entity) { - static bool:gotconfig = false; - static String:datamap[32]; + static bool gotconfig = false; + static char datamap[32]; if (!gotconfig) { - new Handle:gc = LoadGameConfigFile("core.games"); - new bool:exists = GameConfGetKeyValue(gc, "m_flGravity", datamap, sizeof(datamap)); + Handle gc = LoadGameConfigFile("core.games"); + bool exists = GameConfGetKeyValue(gc, "m_flGravity", datamap, sizeof(datamap)); CloseHandle(gc); if (!exists) @@ -490,18 +484,17 @@ stock Float:GetEntityGravity(entity) * * @param entity Entity index. * @param amount Gravity to set (default = 1.0, half = 0.5, double = 2.0). - * @noreturn * @error Invalid entity index, or lack of mod compliance. */ -stock SetEntityGravity(entity, Float:amount) +stock void SetEntityGravity(int entity, float amount) { - static bool:gotconfig = false; - static String:datamap[32]; + static bool gotconfig = false; + static char datamap[32]; if (!gotconfig) { - new Handle:gc = LoadGameConfigFile("core.games"); - new bool:exists = GameConfGetKeyValue(gc, "m_flGravity", datamap, sizeof(datamap)); + Handle gc = LoadGameConfigFile("core.games"); + bool exists = GameConfGetKeyValue(gc, "m_flGravity", datamap, sizeof(datamap)); CloseHandle(gc); if (!exists) @@ -520,18 +513,17 @@ stock SetEntityGravity(entity, Float:amount) * * @param entity Entity index. * @param amount Health amount. - * @noreturn * @error Invalid entity index, or lack of mod compliance. */ -stock SetEntityHealth(entity, amount) +stock void SetEntityHealth(int entity, int amount) { - static bool:gotconfig = false; - static String:prop[32]; + static bool gotconfig = false; + static char prop[32]; if (!gotconfig) { - new Handle:gc = LoadGameConfigFile("core.games"); - new bool:exists = GameConfGetKeyValue(gc, "m_iHealth", prop, sizeof(prop)); + Handle gc = LoadGameConfigFile("core.games"); + bool exists = GameConfGetKeyValue(gc, "m_iHealth", prop, sizeof(prop)); CloseHandle(gc); if (!exists) @@ -542,9 +534,9 @@ stock SetEntityHealth(entity, amount) gotconfig = true; } - decl String:cls[64]; - new PropFieldType:type; - new offset; + char cls[64]; + PropFieldType type; + int offset; if (!GetEntityNetClass(entity, cls, sizeof(cls))) { @@ -579,15 +571,15 @@ stock SetEntityHealth(entity, amount) * @error Invalid client index, client not in game, * or lack of mod compliance. */ -stock GetClientButtons(client) +stock int GetClientButtons(int client) { - static bool:gotconfig = false; - static String:datamap[32]; + static bool gotconfig = false; + static char datamap[32]; if (!gotconfig) { - new Handle:gc = LoadGameConfigFile("core.games"); - new bool:exists = GameConfGetKeyValue(gc, "m_nButtons", datamap, sizeof(datamap)); + Handle gc = LoadGameConfigFile("core.games"); + bool exists = GameConfGetKeyValue(gc, "m_nButtons", datamap, sizeof(datamap)); CloseHandle(gc); if (!exists) diff --git a/plugins/include/float.inc b/plugins/include/float.inc index d1c5c2e0..8b215c45 100644 --- a/plugins/include/float.inc +++ b/plugins/include/float.inc @@ -42,7 +42,7 @@ * @param value Integer to convert. * @return Floating point value. */ -native Float:float(value); +native float float(int value); #endif /** @@ -52,7 +52,7 @@ native Float:float(value); * @param oper2 Second value. * @return oper1*oper2. */ -native Float:FloatMul(Float:oper1, Float:oper2); +native float FloatMul(float oper1, float oper2); /** * Divides the dividend by the divisor. @@ -61,7 +61,7 @@ native Float:FloatMul(Float:oper1, Float:oper2); * @param divisor Second value. * @return dividend/divisor. */ -native Float:FloatDiv(Float:dividend, Float:divisor); +native float FloatDiv(float dividend, float divisor); /** * Adds two floats together. @@ -70,7 +70,7 @@ native Float:FloatDiv(Float:dividend, Float:divisor); * @param oper2 Second value. * @return oper1+oper2. */ -native Float:FloatAdd(Float:oper1, Float:oper2); +native float FloatAdd(float oper1, float oper2); /** * Subtracts oper2 from oper1. @@ -79,7 +79,7 @@ native Float:FloatAdd(Float:oper1, Float:oper2); * @param oper2 Second value. * @return oper1-oper2. */ -native Float:FloatSub(Float:oper1, Float:oper2); +native float FloatSub(float oper1, float oper2); /** * Returns the decimal part of a float. @@ -87,7 +87,7 @@ native Float:FloatSub(Float:oper1, Float:oper2); * @param value Input value. * @return Decimal part. */ -native Float:FloatFraction(Float:value); +native float FloatFraction(float value); /** * Rounds a float to the closest integer to zero. @@ -95,7 +95,7 @@ native Float:FloatFraction(Float:value); * @param value Input value to be rounded. * @return Rounded value. */ -native RoundToZero(Float:value); +native int RoundToZero(float value); /** * Rounds a float to the next highest integer value. @@ -103,7 +103,7 @@ native RoundToZero(Float:value); * @param value Input value to be rounded. * @return Rounded value. */ -native RoundToCeil(Float:value); +native int RoundToCeil(float value); /** * Rounds a float to the next lowest integer value. @@ -111,7 +111,7 @@ native RoundToCeil(Float:value); * @param value Input value to be rounded. * @return Rounded value. */ -native RoundToFloor(Float:value); +native int RoundToFloor(float value); /** * Standard IEEE rounding. @@ -119,7 +119,7 @@ native RoundToFloor(Float:value); * @param value Input value to be rounded. * @return Rounded value. */ -native RoundToNearest(Float:value); +native int RoundToNearest(float value); /** * Compares two floats. @@ -130,7 +130,7 @@ native RoundToNearest(Float:value); * Returns -1 if the first argument is smaller than the second argument. * Returns 0 if both arguments are equal. */ -native FloatCompare(Float:fOne, Float:fTwo); +native int FloatCompare(float fOne, float fTwo); /** * Returns the square root of the input value, equivalent to floatpower(value, 0.5). @@ -138,7 +138,7 @@ native FloatCompare(Float:fOne, Float:fTwo); * @param value Input value. * @return Square root of the value. */ -native Float:SquareRoot(Float:value); +native float SquareRoot(float value); /** * Returns the value raised to the power of the exponent. @@ -147,7 +147,7 @@ native Float:SquareRoot(Float:value); * @param exponent Value to raise the base. * @return value^exponent. */ -native Float:Pow(Float:value, Float:exponent); +native float Pow(float value, float exponent); /** * Returns the value of raising the input by e. @@ -155,7 +155,7 @@ native Float:Pow(Float:value, Float:exponent); * @param value Input value. * @return exp(value). */ -native Float:Exponential(Float:value); +native float Exponential(float value); /** * Returns the logarithm of any base specified. @@ -164,7 +164,7 @@ native Float:Exponential(Float:value); * @param base Logarithm base to use, default is 10. * @return log(value)/log(base). */ -native Float:Logarithm(Float:value, Float:base=10.0); +native float Logarithm(float value, float base=10.0); /** * Returns the sine of the argument. @@ -172,7 +172,7 @@ native Float:Logarithm(Float:value, Float:base=10.0); * @param value Input value in radians. * @return sin(value). */ -native Float:Sine(Float:value); +native float Sine(float value); /** * Returns the cosine of the argument. @@ -180,7 +180,7 @@ native Float:Sine(Float:value); * @param value Input value in radians. * @return cos(value). */ -native Float:Cosine(Float:value); +native float Cosine(float value); /** * Returns the tangent of the argument. @@ -188,7 +188,7 @@ native Float:Cosine(Float:value); * @param value Input value in radians. * @return tan(value). */ -native Float:Tangent(Float:value); +native float Tangent(float value); /** * Returns an absolute value. @@ -196,7 +196,7 @@ native Float:Tangent(Float:value); * @param value Input value. * @return Absolute value of the input. */ -native Float:FloatAbs(Float:value); +native float FloatAbs(float value); /** * Returns the arctangent of the input value. @@ -204,7 +204,7 @@ native Float:FloatAbs(Float:value); * @param angle Input value. * @return atan(value) in radians. */ -native Float:ArcTangent(Float:angle); +native float ArcTangent(float angle); /** * Returns the arccosine of the input value. @@ -212,7 +212,7 @@ native Float:ArcTangent(Float:angle); * @param angle Input value. * @return acos(value) in radians. */ -native Float:ArcCosine(Float:angle); +native float ArcCosine(float angle); /** * Returns the arcsine of the input value. @@ -220,7 +220,7 @@ native Float:ArcCosine(Float:angle); * @param angle Input value. * @return asin(value) in radians. */ -native Float:ArcSine(Float:angle); +native float ArcSine(float angle); /** * Returns the arctangent2 of the input values. @@ -229,7 +229,7 @@ native Float:ArcSine(Float:angle); * @param y Vertical value. * @return atan2(value) in radians. */ -native Float:ArcTangent2(Float:x, Float:y); +native float ArcTangent2(float x, float y); /** * Rounds a floating point number using the "round to nearest" algorithm. @@ -237,140 +237,138 @@ native Float:ArcTangent2(Float:x, Float:y); * @param value Floating point value to round. * @return The value rounded to the nearest integer. */ -stock RoundFloat(Float:value) +stock int RoundFloat(float value) { return RoundToNearest(value); } /** * User defined operators. - * */ #if !defined __sourcepawn2__ #pragma rational Float -native bool:__FLOAT_GT__(Float:a, Float:b); -native bool:__FLOAT_GE__(Float:a, Float:b); -native bool:__FLOAT_LT__(Float:a, Float:b); -native bool:__FLOAT_LE__(Float:a, Float:b); -native bool:__FLOAT_EQ__(Float:a, Float:b); -native bool:__FLOAT_NE__(Float:a, Float:b); -native bool:__FLOAT_NOT__(Float:a); +native bool __FLOAT_GT__(float a, float b); +native bool __FLOAT_GE__(float a, float b); +native bool __FLOAT_LT__(float a, float b); +native bool __FLOAT_LE__(float a, float b); +native bool __FLOAT_EQ__(float a, float b); +native bool __FLOAT_NE__(float a, float b); +native bool __FLOAT_NOT__(float a); -native Float:operator*(Float:oper1, Float:oper2) = FloatMul; -native Float:operator/(Float:oper1, Float:oper2) = FloatDiv; -native Float:operator+(Float:oper1, Float:oper2) = FloatAdd; -native Float:operator-(Float:oper1, Float:oper2) = FloatSub; -native bool:operator!(Float:oper1) = __FLOAT_NOT__; -native bool:operator>(Float:oper1, Float:oper2) = __FLOAT_GT__; -native bool:operator>=(Float:oper1, Float:oper2) = __FLOAT_GE__; -native bool:operator<(Float:oper1, Float:oper2) = __FLOAT_LT__; -native bool:operator<=(Float:oper1, Float:oper2) = __FLOAT_LE__; -native bool:operator!=(Float:oper1, Float:oper2) = __FLOAT_NE__; -native bool:operator==(Float:oper1, Float:oper2) = __FLOAT_EQ__; +native float operator*(float oper1, float oper2) = FloatMul; +native float operator/(float oper1, float oper2) = FloatDiv; +native float operator+(float oper1, float oper2) = FloatAdd; +native float operator-(float oper1, float oper2) = FloatSub; +native bool operator!(float oper1) = __FLOAT_NOT__; +native bool operator>(float oper1, float oper2) = __FLOAT_GT__; +native bool operator>=(float oper1, float oper2) = __FLOAT_GE__; +native bool operator<(float oper1, float oper2) = __FLOAT_LT__; +native bool operator<=(float oper1, float oper2) = __FLOAT_LE__; +native bool operator!=(float oper1, float oper2) = __FLOAT_NE__; +native bool operator==(float oper1, float oper2) = __FLOAT_EQ__; -stock Float:operator++(Float:oper) +stock float operator++(float oper) { return oper+1.0; } -stock Float:operator--(Float:oper) +stock float operator--(float oper) { return oper-1.0; } -stock Float:operator-(Float:oper) +stock float operator-(float oper) { - return oper^Float:cellmin; /* IEEE values are sign/magnitude */ + return oper^float(cellmin); /* IEEE values are sign/magnitude */ } -stock Float:operator*(Float:oper1, oper2) +stock float operator*(float oper1, int oper2) { return FloatMul(oper1, float(oper2)); /* "*" is commutative */ } -stock Float:operator/(Float:oper1, oper2) +stock float operator/(float oper1, int oper2) { return FloatDiv(oper1, float(oper2)); } -stock Float:operator/(oper1, Float:oper2) +stock float operator/(int oper1, float oper2) { return FloatDiv(float(oper1), oper2); } -stock Float:operator+(Float:oper1, oper2) +stock float operator+(float oper1, int oper2) { return FloatAdd(oper1, float(oper2)); /* "+" is commutative */ } -stock Float:operator-(Float:oper1, oper2) +stock float operator-(float oper1, int oper2) { return FloatSub(oper1, float(oper2)); } -stock Float:operator-(oper1, Float:oper2) +stock float operator-(int oper1, float oper2) { return FloatSub(float(oper1), oper2); } -stock bool:operator==(Float:oper1, oper2) +stock bool operator==(float oper1, int oper2) { return __FLOAT_EQ__(oper1, float(oper2)); } -stock bool:operator!=(Float:oper1, oper2) +stock bool operator!=(float oper1, int oper2) { return __FLOAT_NE__(oper1, float(oper2)); } -stock bool:operator>(Float:oper1, oper2) +stock bool operator>(float oper1, int oper2) { return __FLOAT_GT__(oper1, float(oper2)); } -stock bool:operator>(oper1, Float:oper2) +stock bool operator>(int oper1, float oper2) { return __FLOAT_GT__(float(oper1), oper2); } -stock bool:operator>=(Float:oper1, oper2) +stock bool operator>=(float oper1, int oper2) { return __FLOAT_GE__(oper1, float(oper2)); } -stock bool:operator>=(oper1, Float:oper2) +stock bool operator>=(int oper1, float oper2) { return __FLOAT_GE__(float(oper1), oper2); } -stock bool:operator<(Float:oper1, oper2) +stock bool operator<(float oper1, int oper2) { return __FLOAT_LT__(oper1, float(oper2)); } -stock bool:operator<(oper1, Float:oper2) +stock bool operator<(int oper1, float oper2) { return __FLOAT_LT__(float(oper1), oper2); } -stock bool:operator<=(Float:oper1, oper2) +stock bool operator<=(float oper1, int oper2) { return __FLOAT_LE__(oper1, float(oper2)); } -stock bool:operator<=(oper1, Float:oper2) +stock bool operator<=(int oper1, float oper2) { return __FLOAT_LE__(float(oper1), oper2); } /** * Forbidden operators. - * */ -forward operator%(Float:oper1, Float:oper2); -forward operator%(Float:oper1, oper2); -forward operator%(oper1, Float:oper2); +forward operator%(float oper1, float oper2); +forward operator%(float oper1, int oper2); +forward operator%(int oper1, float oper2); #endif // __sourcepawn2__ #define FLOAT_PI 3.1415926535897932384626433832795 @@ -381,7 +379,7 @@ forward operator%(oper1, Float:oper2); * @param angle Degrees. * @return Radians. */ -stock Float:DegToRad(Float:angle) +stock float DegToRad(float angle) { return (angle*FLOAT_PI)/180; } @@ -392,7 +390,7 @@ stock Float:DegToRad(Float:angle) * @param angle Radians. * @return Degrees. */ -stock Float:RadToDeg(Float:angle) +stock float RadToDeg(float angle) { return (angle*180)/FLOAT_PI; } @@ -404,7 +402,7 @@ stock Float:RadToDeg(Float:angle) * * @return Random integer. */ -native GetURandomInt(); +native int GetURandomInt(); /** * Returns a uniform random float in the range [0, 1). @@ -413,7 +411,7 @@ native GetURandomInt(); * * @return Uniform random floating-point number. */ -native Float:GetURandomFloat(); +native float GetURandomFloat(); /** * Seeds a plugin's uniform random number stream. This is done automatically, @@ -421,21 +419,18 @@ native Float:GetURandomFloat(); * * @param seeds Array of numbers to use as seeding data. * @param numSeeds Number of seeds in the seeds array. - * @noreturn */ -native SetURandomSeed(const seeds[], numSeeds); +native void SetURandomSeed(const int[] seeds, int numSeeds); /** * Seeds a plugin's uniform random number stream. This is done automatically, * so normally it is totally unnecessary to call this. * * @param seed Single seed value. - * @noreturn */ -stock SetURandomSeedSimple(seed) +stock void SetURandomSeedSimple(int seed) { - new seeds[1]; + int seeds[1]; seeds[0] = seed; SetURandomSeed(seeds, 1); } - diff --git a/plugins/include/functions.inc b/plugins/include/functions.inc index 0c409915..1c479618 100644 --- a/plugins/include/functions.inc +++ b/plugins/include/functions.inc @@ -120,7 +120,7 @@ enum ExecType * @return Function id or INVALID_FUNCTION if not found. * @error Invalid or corrupt plugin handle. */ -native Function:GetFunctionByName(Handle:plugin, const String:name[]); +native Function GetFunctionByName(Handle plugin, const char[] name); /** * Creates a global forward. @@ -136,7 +136,7 @@ native Function:GetFunctionByName(Handle:plugin, const String:name[]); * @return Handle to new global forward. * @error More than 32 paramater types passed. */ -native Handle:CreateGlobalForward(const String:name[], ExecType:type, ParamType:...); +native Handle CreateGlobalForward(const char[] name, ExecType type, ParamType ...); /** * Creates a private forward. @@ -150,7 +150,7 @@ native Handle:CreateGlobalForward(const String:name[], ExecType:type, ParamType: * @return Handle to new private forward. * @error More than 32 paramater types passed. */ -native Handle:CreateForward(ExecType:type, ParamType:...); +native Handle CreateForward(ExecType type, ParamType ...); /** * Returns the number of functions in a global or private forward's call list. @@ -159,7 +159,7 @@ native Handle:CreateForward(ExecType:type, ParamType:...); * @return Number of functions in forward. * @error Invalid or corrupt forward handle. */ -native GetForwardFunctionCount(Handle:fwd); +native int GetForwardFunctionCount(Handle fwd); /** * Adds a function to a private forward's call list. @@ -173,7 +173,7 @@ native GetForwardFunctionCount(Handle:fwd); * @return True on success, false otherwise. * @error Invalid or corrupt private forward handle, invalid or corrupt plugin handle, or invalid function. */ -native bool:AddToForward(Handle:fwd, Handle:plugin, Function:func); +native bool AddToForward(Handle fwd, Handle plugin, Function func); /** * Removes a function from a private forward's call list. @@ -188,7 +188,7 @@ native bool:AddToForward(Handle:fwd, Handle:plugin, Function:func); * @return True on success, false otherwise. * @error Invalid or corrupt private forward handle, invalid or corrupt plugin handle, or invalid function. */ -native bool:RemoveFromForward(Handle:fwd, Handle:plugin, Function:func); +native bool RemoveFromForward(Handle fwd, Handle plugin, Function func); /** * Removes all instances of a plugin from a private forward's call list. @@ -201,7 +201,7 @@ native bool:RemoveFromForward(Handle:fwd, Handle:plugin, Function:func); * @return Number of functions removed from forward. * @error Invalid or corrupt private forward handle or invalid or corrupt plugin handle. */ -native RemoveAllFromForward(Handle:fwd, Handle:plugin); +native int RemoveAllFromForward(Handle fwd, Handle plugin); /** * Starts a call to functions in a forward's call list. @@ -209,10 +209,9 @@ native RemoveAllFromForward(Handle:fwd, Handle:plugin); * @note Cannot be used during an incomplete call. * * @param fwd Handle to global or private forward. - * @noreturn * @error Invalid or corrupt forward handle or called before another call has completed. */ -native Call_StartForward(Handle:fwd); +native void Call_StartForward(Handle fwd); /** * Starts a call to a function. @@ -222,10 +221,9 @@ native Call_StartForward(Handle:fwd); * @param plugin Handle of the plugin that contains the function. * Pass INVALID_HANDLE to specify the calling plugin. * @param func Function to call. - * @noreturn * @error Invalid or corrupt plugin handle, invalid function, or called before another call has completed. */ -native Call_StartFunction(Handle:plugin, Function:func); +native void Call_StartFunction(Handle plugin, Function func); /** * Pushes a cell onto the current call. @@ -233,10 +231,9 @@ native Call_StartFunction(Handle:plugin, Function:func); * @note Cannot be used before a call has been started. * * @param value Cell value to push. - * @noreturn * @error Called before a call has been started. */ -native Call_PushCell(any:value); +native void Call_PushCell(any value); /** * Pushes a cell by reference onto the current call. @@ -244,10 +241,9 @@ native Call_PushCell(any:value); * @note Cannot be used before a call has been started. * * @param value Cell reference to push. - * @noreturn * @error Called before a call has been started. */ -native Call_PushCellRef(&any:value); +native void Call_PushCellRef(any &value); /** * Pushes a float onto the current call. @@ -255,10 +251,9 @@ native Call_PushCellRef(&any:value); * @note Cannot be used before a call has been started. * * @param value Floating point value to push. - * @noreturn * @error Called before a call has been started. */ -native Call_PushFloat(Float:value); +native void Call_PushFloat(float value); /** * Pushes a float by reference onto the current call. @@ -266,10 +261,9 @@ native Call_PushFloat(Float:value); * @note Cannot be used before a call has been started. * * @param value Floating point reference to push. - * @noreturn * @error Called before a call has been started. */ -native Call_PushFloatRef(&Float:value); +native void Call_PushFloatRef(float &value); /** * Pushes an array onto the current call. @@ -279,10 +273,9 @@ native Call_PushFloatRef(&Float:value); * * @param value Array to push. * @param size Size of array. - * @noreturn * @error Called before a call has been started. */ -native Call_PushArray(const any:value[], size); +native void Call_PushArray(const any[] value, int size); /** * Pushes an array onto the current call. @@ -293,10 +286,9 @@ native Call_PushArray(const any:value[], size); * @param size Size of array. * @param cpflags Whether or not changes should be copied back to the input array. * See SP_PARAM_* constants for details. - * @noreturn * @error Called before a call has been started. */ -native Call_PushArrayEx(any:value[], size, cpflags); +native void Call_PushArrayEx(any[] value, int size, int cpflags); /** * Pushes a string onto the current call. @@ -305,10 +297,9 @@ native Call_PushArrayEx(any:value[], size, cpflags); * @note Cannot be used before a call has been started. * * @param value String to push. - * @noreturn * @error Called before a call has been started. */ -native Call_PushString(const String:value[]); +native void Call_PushString(const char[] value); /** * Pushes a string onto the current call. @@ -322,10 +313,9 @@ native Call_PushString(const String:value[]); * The default (0) is to push ASCII. * @param cpflags Whether or not changes should be copied back to the input array. * See SM_PARAM_* constants for details. - * @noreturn * @error Called before a call has been started. */ -native Call_PushStringEx(String:value[], length, szflags, cpflags); +native void Call_PushStringEx(char[] value, int length, int szflags, int cpflags); /** * Completes a call to a function or forward's call list. @@ -336,17 +326,16 @@ native Call_PushStringEx(String:value[], length, szflags, cpflags); * @return SP_ERROR_NONE on success, any other integer on failure. * @error Called before a call has been started. */ -native Call_Finish(&any:result=0); +native int Call_Finish(any &result=0); /** * Cancels a call to a function or forward's call list. * * @note Cannot be used before a call has been started. * - * @noreturn * @error Called before a call has been started. */ -native Call_Cancel(); +native void Call_Cancel(); /** * Defines a native function. @@ -366,9 +355,8 @@ typedef NativeCall = function int (Handle plugin, int numParams); * @param name Name of the dynamic native; must be unique among * all other registered dynamic natives. * @param func Function to use as the dynamic native. - * @noreturn */ -native CreateNative(const String:name[], NativeCall:func); +native void CreateNative(const char[] name, NativeCall func); /** * Throws an error in the calling plugin of a native, instead of your own plugin. @@ -377,7 +365,7 @@ native CreateNative(const String:name[], NativeCall:func); * @param fmt Error message format. * @param ... Format arguments. */ -native ThrowNativeError(error, const String:fmt[], any:...); +native int ThrowNativeError(int error, const char[] fmt, any ...); /** * Retrieves the string length from a native parameter string. This is useful @@ -389,7 +377,7 @@ native ThrowNativeError(error, const String:fmt[], any:...); * @return SP_ERROR_NONE on success, any other integer on failure. * @error Invalid parameter number or calling from a non-native function. */ -native GetNativeStringLength(param, &length); +native int GetNativeStringLength(int param, int &length); /** * Retrieves a string from a native parameter. @@ -402,7 +390,7 @@ native GetNativeStringLength(param, &length); * @return SP_ERROR_NONE on success, any other integer on failure. * @error Invalid parameter number or calling from a non-native function. */ -native GetNativeString(param, String:buffer[], maxlength, &bytes=0); +native int GetNativeString(int param, char[] buffer, int maxlength, int &bytes=0); /** * Sets a string in a native parameter. @@ -417,7 +405,7 @@ native GetNativeString(param, String:buffer[], maxlength, &bytes=0); * @return SP_ERROR_NONE on success, any other integer on failure. * @error Invalid parameter number or calling from a non-native function. */ -native SetNativeString(param, const String:source[], maxlength, bool:utf8=true, &bytes=0); +native int SetNativeString(int param, const char[] source, int maxlength, bool utf8=true, int &bytes=0); /** * Gets a cell from a native parameter. @@ -426,7 +414,7 @@ native SetNativeString(param, const String:source[], maxlength, bool:utf8=true, * @return Cell value at the parameter number. * @error Invalid parameter number or calling from a non-native function. */ -native any:GetNativeCell(param); +native any GetNativeCell(int param); /** * Gets a function pointer from a native parameter. @@ -435,7 +423,7 @@ native any:GetNativeCell(param); * @return Function pointer at the given parameter number. * @error Invalid parameter number, or calling from a non-native function. */ -native Function GetNativeFunction(param); +native Function GetNativeFunction(int param); /** * Gets a cell from a native parameter, by reference. @@ -444,17 +432,16 @@ native Function GetNativeFunction(param); * @return Cell value at the parameter number. * @error Invalid parameter number or calling from a non-native function. */ -native any:GetNativeCellRef(param); +native any GetNativeCellRef(int param); /** * Sets a cell from a native parameter, by reference. * * @param param Parameter number, starting from 1. * @param value Cell value at the parameter number to set by reference. - * @noreturn * @error Invalid parameter number or calling from a non-native function. */ -native SetNativeCellRef(param, any:value); +native void SetNativeCellRef(int param, any value); /** * Gets an array from a native parameter (always by reference). @@ -465,7 +452,7 @@ native SetNativeCellRef(param, any:value); * @return SP_ERROR_NONE on success, anything else on failure. * @error Invalid parameter number or calling from a non-native function. */ -native GetNativeArray(param, any:local[], size); +native int GetNativeArray(int param, any[] local, int size); /** * Copies a local array into a native parameter array (always by reference). @@ -476,7 +463,7 @@ native GetNativeArray(param, any:local[], size); * @return SP_ERROR_NONE on success, anything else on failure. * @error Invalid parameter number or calling from a non-native function. */ -native SetNativeArray(param, const any:local[], size); +native int SetNativeArray(int param, const any[] local, int size); /** * Formats a string using parameters from a native. @@ -494,19 +481,18 @@ native SetNativeArray(param, const any:local[], size); * @param fmt_string Format string to use if fmt_param is not used. * @return SP_ERROR_NONE on success, anything else on failure. */ -native FormatNativeString(out_param, - fmt_param, - vararg_param, - out_len, - &written=0, - String:out_string[]="", - const String:fmt_string[]=""); +native int FormatNativeString(int out_param, + int fmt_param, + int vararg_param, + int out_len, + int &written=0, + char[] out_string="", + const char[] fmt_string=""); /** * Defines a RequestFrame Callback. * * @param data Data passed to the RequestFrame native. - * @noreturn */ typedef RequestFrameCallback = function void (any data); @@ -515,6 +501,5 @@ typedef RequestFrameCallback = function void (any data); * * @param Function Function to call on the next frame. * @param data Value to be passed on the invocation of the Function. - * @noreturn */ -native RequestFrame(RequestFrameCallback:Function, any:data=0); +native void RequestFrame(RequestFrameCallback Function, any data=0); diff --git a/plugins/include/halflife.inc b/plugins/include/halflife.inc index dfb906f9..e429b2b2 100644 --- a/plugins/include/halflife.inc +++ b/plugins/include/halflife.inc @@ -117,17 +117,15 @@ enum FindMapResult * * @param format String format. * @param ... Format arguments. - * @noreturn */ -native LogToGame(const String:format[], any:...); +native void LogToGame(const char[] format, any ...); /** * Sets the seed value for the global Half-Life 2 Random Stream. * * @param seed Seed value. - * @noreturn */ -native SetRandomSeed(seed); +native void SetRandomSeed(int seed); /** * Returns a random floating point number from the Half-Life 2 Random Stream. @@ -136,7 +134,7 @@ native SetRandomSeed(seed); * @param fMax Maximum random bound. * @return A random number between (inclusive) fMin and fMax. */ -native Float:GetRandomFloat(Float:fMin=0.0, Float:fMax=1.0); +native float GetRandomFloat(float fMin=0.0, float fMax=1.0); /** * Returns a random number from the Half-Life 2 Random Stream. @@ -145,7 +143,7 @@ native Float:GetRandomFloat(Float:fMin=0.0, Float:fMax=1.0); * @param nmax Maximum random bound. * @return A random number between (inclusive) nmin and nmax. */ -native GetRandomInt(nmin, nmax); +native int GetRandomInt(int nmin, int nmax); /** * Returns whether a map is valid or not. @@ -153,7 +151,7 @@ native GetRandomInt(nmin, nmax); * @param map Map name, excluding .bsp extension. * @return True if valid, false otherwise. */ -native bool:IsMapValid(const String:map[]); +native bool IsMapValid(const char[] map); /** * Returns whether a full or partial map name is found or can be resolved @@ -190,28 +188,28 @@ native bool GetMapDisplayName(const char[] map, char[] displayName, int maxlen); * * @return True if dedicated, false otherwise. */ -native bool:IsDedicatedServer(); +native bool IsDedicatedServer(); /** * Returns a high-precision time value for profiling the engine. * * @return A floating point time value. */ -native Float:GetEngineTime(); +native float GetEngineTime(); /** * Returns the game time based on the game tick. * * @return Game tick time. */ -native Float:GetGameTime(); +native float GetGameTime(); /** * Returns the game's internal tick count. * * @return Game tick count. */ -native GetGameTickCount(); +native int GetGameTickCount(); /** * Returns the game description from the mod. @@ -222,7 +220,7 @@ native GetGameTickCount(); * ignoring any potential hooks from plugins. * @return Number of bytes written to the buffer (UTF-8 safe). */ -native GetGameDescription(String:buffer[], maxlength, bool:original=false); +native int GetGameDescription(char[] buffer, int maxlength, bool original=false); /** * Returns the name of the game's directory. @@ -232,7 +230,7 @@ native GetGameDescription(String:buffer[], maxlength, bool:original=false); * * return Number of bytes written to the buffer (UTF-8 safe). */ -native GetGameFolderName(String:buffer[], maxlength); +native int GetGameFolderName(char[] buffer, int maxlength); /** * Returns the current map name. @@ -241,7 +239,7 @@ native GetGameFolderName(String:buffer[], maxlength); * @param maxlength Maximum length of buffer. * @return Number of bytes written (UTF-8 safe). */ -native GetCurrentMap(String:buffer[], maxlength); +native int GetCurrentMap(char[] buffer, int maxlength); /** * Precaches a given model. @@ -250,7 +248,7 @@ native GetCurrentMap(String:buffer[], maxlength); * @param preload If preload is true the file will be precached before level startup. * @return Returns the model index, 0 for error. */ -native PrecacheModel(const String:model[], bool:preload=false); +native int PrecacheModel(const char[] model, bool preload=false); /** * Precaches a given sentence file. @@ -259,7 +257,7 @@ native PrecacheModel(const String:model[], bool:preload=false); * @param preload If preload is true the file will be precached before level startup. * @return Returns a sentence file index. */ -native PrecacheSentenceFile(const String:file[], bool:preload=false); +native int PrecacheSentenceFile(const char[] file, bool preload=false); /** * Precaches a given decal. @@ -268,7 +266,7 @@ native PrecacheSentenceFile(const String:file[], bool:preload=false); * @param preload If preload is true the file will be precached before level startup. * @return Returns a decal index. */ -native PrecacheDecal(const String:decal[], bool:preload=false); +native int PrecacheDecal(const char[] decal, bool preload=false); /** * Precaches a given generic file. @@ -277,7 +275,7 @@ native PrecacheDecal(const String:decal[], bool:preload=false); * @param preload If preload is true the file will be precached before level startup. * @return Returns a generic file index. */ -native PrecacheGeneric(const String:generic[], bool:preload=false); +native int PrecacheGeneric(const char[] generic, bool preload=false); /** * Returns if a given model is precached. @@ -285,7 +283,7 @@ native PrecacheGeneric(const String:generic[], bool:preload=false); * @param model Name of the model to check. * @return True if precached, false otherwise. */ -native bool:IsModelPrecached(const String:model[]); +native bool IsModelPrecached(const char[] model); /** * Returns if a given decal is precached. @@ -293,7 +291,7 @@ native bool:IsModelPrecached(const String:model[]); * @param decal Name of the decal to check. * @return True if precached, false otherwise. */ -native bool:IsDecalPrecached(const String:decal[]); +native bool IsDecalPrecached(const char[] decal); /** * Returns if a given generic file is precached. @@ -301,7 +299,7 @@ native bool:IsDecalPrecached(const String:decal[]); * @param generic Name of the generic file to check. * @return True if precached, false otherwise. */ -native bool:IsGenericPrecached(const String:generic[]); +native bool IsGenericPrecached(const char[] generic); /** * Precaches a given sound. @@ -310,7 +308,7 @@ native bool:IsGenericPrecached(const String:generic[]); * @param preload If preload is true the file will be precached before level startup. * @return True if successfully precached, false otherwise. */ -native bool:PrecacheSound(const String:sound[], bool:preload=false); +native bool PrecacheSound(const char[] sound, bool preload=false); /** * Returns if a given sound is precached. @@ -318,7 +316,7 @@ native bool:PrecacheSound(const String:sound[], bool:preload=false); * @param sound Name of the sound to check. * @return True if precached, false otherwise. */ -native bool:IsSoundPrecached(const String:sound[]); +native bool IsSoundPrecached(const char[] sound); /** * Creates different types of ingame messages. @@ -326,10 +324,9 @@ native bool:IsSoundPrecached(const String:sound[]); * @param client Index of the client. * @param kv KeyValues handle to set the menu keys and options. (Check iserverplugin.h for more information). * @param type Message type to display ingame. - * @noreturn * @error Invalid client index, or client not connected. */ -native CreateDialog(client, Handle:kv, DialogType:type); +native void CreateDialog(int client, Handle kv, DialogType type); /** * Guesses the SDK version a mod was compiled against. If nothing @@ -341,7 +338,7 @@ native CreateDialog(client, Handle:kv, DialogType:type); * @return SOURCE_SDK version code. */ #pragma deprecated See GetEngineVersion() -native GuessSDKVersion(); +native int GuessSDKVersion(); /** * Gets the engine version that the currently-loaded SM core was compiled against. @@ -351,7 +348,7 @@ native GuessSDKVersion(); * * @return An EngineVersion value. */ -native EngineVersion:GetEngineVersion(); +native EngineVersion GetEngineVersion(); /** * Prints a message to a specific client in the chat area. @@ -359,23 +356,21 @@ native EngineVersion:GetEngineVersion(); * @param client Client index. * @param format Formatting rules. * @param ... Variable number of format parameters. - * @noreturn * @error If the client is not connected an error will be thrown. */ -native PrintToChat(client, const String:format[], any:...); +native void PrintToChat(int client, const char[] format, any ...); /** * Prints a message to all clients in the chat area. * * @param format Formatting rules. * @param ... Variable number of format parameters. - * @noreturn */ -stock PrintToChatAll(const String:format[], any:...) +stock void PrintToChatAll(const char[] format, any ...) { - decl String:buffer[254]; + char buffer[254]; - for (new i = 1; i <= MaxClients; i++) + for (int i = 1; i <= MaxClients; i++) { if (IsClientInGame(i)) { @@ -392,23 +387,21 @@ stock PrintToChatAll(const String:format[], any:...) * @param client Client index. * @param format Formatting rules. * @param ... Variable number of format parameters. - * @noreturn * @error If the client is not connected an error will be thrown. */ -native PrintCenterText(client, const String:format[], any:...); +native void PrintCenterText(int client, const char[] format, any ...); /** * Prints a message to all clients in the center of the screen. * * @param format Formatting rules. * @param ... Variable number of format parameters. - * @noreturn */ -stock PrintCenterTextAll(const String:format[], any:...) +stock void PrintCenterTextAll(const char[] format, any ...) { - decl String:buffer[254]; + char buffer[254]; - for (new i = 1; i <= MaxClients; i++) + for (int i = 1; i <= MaxClients; i++) { if (IsClientInGame(i)) { @@ -425,23 +418,21 @@ stock PrintCenterTextAll(const String:format[], any:...) * @param client Client index. * @param format Formatting rules. * @param ... Variable number of format parameters. - * @noreturn * @error If the client is not connected an error will be thrown. */ -native PrintHintText(client, const String:format[], any:...); +native void PrintHintText(int client, const char[] format, any ...); /** * Prints a message to all clients with a hint box. * * @param format Formatting rules. * @param ... Variable number of format parameters. - * @noreturn */ -stock PrintHintTextToAll(const String:format[], any:...) +stock void PrintHintTextToAll(const char[] format, any ...) { - decl String:buffer[254]; + char buffer[254]; - for (new i = 1; i <= MaxClients; i++) + for (int i = 1; i <= MaxClients; i++) { if (IsClientInGame(i)) { @@ -461,10 +452,9 @@ stock PrintHintTextToAll(const String:format[], any:...) * @param Kv KeyValues handle with all the data for the panel setup (Depends * on the panel type and may be unused). * @param show True to show the panel, or false to remove it from the client screen. - * @noreturn * @error If the client is not connected an error will be thrown. */ -native ShowVGUIPanel(client, const String:name[], Handle:Kv=INVALID_HANDLE, bool:show=true); +native void ShowVGUIPanel(int client, const char[] name, Handle Kv=INVALID_HANDLE, bool show=true); /** * Creates a HUD synchronization object. This object is used to automatically assign and @@ -499,7 +489,7 @@ native ShowVGUIPanel(client, const String:name[], Handle:Kv=INVALID_HANDLE, bool * If HUD text is not supported on this mod, then * INVALID_HANDLE is returned. */ -native Handle:CreateHudSynchronizer(); +native Handle CreateHudSynchronizer(); /** * Sets the HUD parameters for drawing text. These parameters are stored @@ -523,10 +513,9 @@ native Handle:CreateHudSynchronizer(); * @param fxTime Duration of chosen effect (may not apply to all effects). * @param fadeIn Number of seconds to spend fading in. * @param fadeOut Number of seconds to spend fading out. - * @noreturn */ -native SetHudTextParams(Float:x, Float:y, Float:holdTime, r, g, b, a, effect = 0, - Float:fxTime=6.0, Float:fadeIn=0.1, Float:fadeOut=0.2); +native void SetHudTextParams(float x, float y, float holdTime, int r, int g, int b, int a, int effect = 0, + float fxTime=6.0, float fadeIn=0.1, float fadeOut=0.2); /** * Sets the HUD parameters for drawing text. These parameters are stored @@ -546,11 +535,10 @@ native SetHudTextParams(Float:x, Float:y, Float:holdTime, r, g, b, a, effect = 0 * @param fxTime Duration of chosen effect (may not apply to all effects). * @param fadeIn Number of seconds to spend fading in. * @param fadeOut Number of seconds to spend fading out. - * @noreturn */ -native SetHudTextParamsEx(Float:x, Float:y, Float:holdTime, color1[4], - color2[4]={255,255,255,0}, effect = 0, Float:fxTime=6.0, - Float:fadeIn=0.1, Float:fadeOut=0.2); +native void SetHudTextParamsEx(float x, float y, float holdTime, int color1[4], + int color2[4]={255,255,255,0}, int effect = 0, float fxTime=6.0, + float fadeIn=0.1, float fadeOut=0.2); /** * Shows a synchronized HUD message to a client. @@ -565,7 +553,7 @@ native SetHudTextParamsEx(Float:x, Float:y, Float:holdTime, color1[4], * This function fails if the mod does not support it. * @error Client not in-game, or sync object not valid. */ -native ShowSyncHudText(client, Handle:sync, const String:message[], any:...); +native int ShowSyncHudText(int client, Handle sync, const char[] message, any ...); /** * Clears the text on a synchronized HUD channel. @@ -581,10 +569,9 @@ native ShowSyncHudText(client, Handle:sync, const String:message[], any:...); * * @param client Client index to send the message to. * @param sync Synchronization object. - * @noreturn * @error Client not in-game, or sync object not valid. */ -native ClearSyncHud(client, Handle:sync); +native void ClearSyncHud(int client, Handle sync); /** * Shows a HUD message to a client on the given channel. @@ -603,7 +590,7 @@ native ClearSyncHud(client, Handle:sync); * Any other return value is the channel number that was * used to render the text. */ -native ShowHudText(client, channel, const String:message[], any:...); +native int ShowHudText(int client, int channel, const char[] message, any ...); /** * Shows a MOTD panel to a specific client. @@ -613,10 +600,9 @@ native ShowHudText(client, channel, const String:message[], any:...); * @param msg Contents of the panel, it can be treated as an url, filename or plain text * depending on the type parameter (WARNING: msg has to be 192 bytes maximum!) * @param type Determines the way to treat the message body of the panel. - * @noreturn * @error If the client is not connected an error will be thrown. */ -stock ShowMOTDPanel(client, const String:title[], const String:msg[], type=MOTDPANEL_TYPE_INDEX) +stock void ShowMOTDPanel(int client, const char[] title, const char[] msg, int type=MOTDPANEL_TYPE_INDEX) { char num[3]; IntToString(type, num, sizeof(num)); @@ -636,9 +622,8 @@ stock ShowMOTDPanel(client, const String:title[], const String:msg[], type=MOTDP * @param time Duration to hold the panel on the client's screen. * @param ip Destination IP. * @param password Password to connect to the destination IP. The client will be able to see this. - * @noreturn */ -stock DisplayAskConnectBox(client, Float:time, const String:ip[], const String:password[] = "") +stock void DisplayAskConnectBox(int client, float time, const char[] ip, const char[] password = "") { char destination[288]; FormatEx(destination, sizeof(destination), "%s/%s", ip, password); @@ -656,7 +641,7 @@ stock DisplayAskConnectBox(client, Float:time, const String:ip[], const String:p * @param entity Entity index. * @return Entity reference. */ -native EntIndexToEntRef(entity); +native int EntIndexToEntRef(int entity); /** * Retrieves the entity index from a reference. @@ -664,7 +649,7 @@ native EntIndexToEntRef(entity); * @param ref Entity reference. * @return Entity index. */ -native EntRefToEntIndex(ref); +native int EntRefToEntIndex(int ref); /** * Converts a reference into a backwards compatible version. @@ -672,7 +657,7 @@ native EntRefToEntIndex(ref); * @param ref Entity reference. * @return Bcompat reference. */ -native MakeCompatEntRef(ref); +native int MakeCompatEntRef(int ref); enum ClientRangeType