From 542bb59978731361b9b92e3272d81c6ac2ee8b3b Mon Sep 17 00:00:00 2001 From: ErikMinekus Date: Sat, 21 May 2016 15:16:49 +0200 Subject: [PATCH] Update large includes for transitional syntax #2 (#511) --- plugins/include/dbi.inc | 2 +- plugins/include/files.inc | 2 +- plugins/include/sdktools_functions.inc | 70 +++--- plugins/include/sdktools_sound.inc | 316 ++++++++++++------------- plugins/include/sdktools_tempents.inc | 62 ++--- plugins/include/sdktools_trace.inc | 112 +++++---- plugins/include/sourcemod.inc | 100 ++++---- plugins/include/string.inc | 84 +++---- plugins/include/textparse.inc | 4 +- plugins/include/tf2.inc | 83 +++---- plugins/include/tf2_stocks.inc | 76 +++--- 11 files changed, 414 insertions(+), 497 deletions(-) diff --git a/plugins/include/dbi.inc b/plugins/include/dbi.inc index 1095f450..cd3a8851 100644 --- a/plugins/include/dbi.inc +++ b/plugins/include/dbi.inc @@ -1034,7 +1034,7 @@ native int SQL_AddQuery(Transaction txn, const char[] query, any data=0); * @param prio Priority queue to use. * @error An invalid handle. */ -native SQL_ExecuteTransaction( +native void SQL_ExecuteTransaction( Handle db, Transaction txn, SQLTxnSuccess onSuccess = INVALID_FUNCTION, diff --git a/plugins/include/files.inc b/plugins/include/files.inc index 9111ac78..72e5984d 100644 --- a/plugins/include/files.inc +++ b/plugins/include/files.inc @@ -593,7 +593,7 @@ native bool SetFilePermissions(const char[] path, int mode); * @param tmode Time mode. * @return Time value, or -1 on failure. */ -native GetFileTime(const char[] file, FileTimeMode tmode); +native int GetFileTime(const char[] file, FileTimeMode tmode); /** * Same as LogToFile(), except uses an open file Handle. The file must diff --git a/plugins/include/sdktools_functions.inc b/plugins/include/sdktools_functions.inc index 45e25a86..c0e42e6b 100644 --- a/plugins/include/sdktools_functions.inc +++ b/plugins/include/sdktools_functions.inc @@ -44,7 +44,7 @@ * @error Invalid client or entity, lack of mod support, or client not in * game. */ -native bool:RemovePlayerItem(client, item); +native bool RemovePlayerItem(int client, int item); /** * Gives a named item to a player. @@ -55,7 +55,7 @@ native bool:RemovePlayerItem(client, item); * @return Entity index on success, or -1 on failure. * @error Invalid client or client not in game, or lack of mod support. */ -native GivePlayerItem(client, const String:item[], iSubType=0); +native int GivePlayerItem(int client, const char[] item, int iSubType=0); /** * Returns the weapon in a player's slot. @@ -65,7 +65,7 @@ native GivePlayerItem(client, const String:item[], iSubType=0); * @return Entity index on success, -1 if no weapon existed. * @error Invalid client or client not in game, or lack of mod support. */ -native GetPlayerWeaponSlot(client, slot); +native int GetPlayerWeaponSlot(int client, int slot); /** * Ignites an entity on fire. @@ -75,19 +75,17 @@ native GetPlayerWeaponSlot(client, slot); * @param npc True to only affect NPCs. * @param size Unknown. * @param level Unknown. - * @noreturn * @error Invalid entity or client not in game, or lack of mod support. */ -native IgniteEntity(entity, Float:time, bool:npc=false, Float:size=0.0, bool:level=false); +native void IgniteEntity(int entity, float time, bool npc=false, float size=0.0, bool level=false); /** * Extinguishes an entity that is on fire. * * @param entity Entity index. - * @noreturn * @error Invalid entity or client not in game, or lack of mod support. */ -native ExtinguishEntity(entity); +native void ExtinguishEntity(int entity); /** * Teleports an entity. @@ -96,19 +94,17 @@ native ExtinguishEntity(entity); * @param origin New origin, or NULL_VECTOR for no change. * @param angles New angles, or NULL_VECTOR for no change. * @param velocity New velocity, or NULL_VECTOR for no change. - * @noreturn * @error Invalid entity or client not in game, or lack of mod support. */ -native TeleportEntity(entity, const Float:origin[3], const Float:angles[3], const Float:velocity[3]); +native void TeleportEntity(int entity, const float origin[3], const float angles[3], const float velocity[3]); /** * Forces a player to commit suicide. * * @param client Client index. - * @noreturn * @error Invalid client or client not in game, or lack of mod support. */ -native ForcePlayerSuicide(client); +native void ForcePlayerSuicide(int client); /** * Slaps a player in a random direction. @@ -116,10 +112,9 @@ native ForcePlayerSuicide(client); * @param client Client index. * @param health Health to subtract. * @param sound False to disable the sound effects. - * @noreturn * @error Invalid client or client not in game, or lack of mod support. */ -native SlapPlayer(client, health=5, bool:sound=true); +native void SlapPlayer(int client, int health=5, bool sound=true); /** * Searches for an entity by classname. @@ -130,7 +125,7 @@ native SlapPlayer(client, health=5, bool:sound=true); * @return Entity index >= 0 if found, -1 otherwise. * @error Lack of mod support. */ -native FindEntityByClassname(startEnt, const String:classname[]); +native int FindEntityByClassname(int startEnt, const char[] classname); /** * Returns the client's eye angles. @@ -140,7 +135,7 @@ native FindEntityByClassname(startEnt, const String:classname[]); * @return True on success, false on failure. * @error Invalid client index, client not in game, or no mod support. */ -native bool:GetClientEyeAngles(client, Float:ang[3]); +native bool GetClientEyeAngles(int client, float ang[3]); /** * Creates an entity by string name, but does not spawn it (see DispatchSpawn). @@ -152,7 +147,7 @@ native bool:GetClientEyeAngles(client, Float:ang[3]); * @return Entity index on success, or -1 on failure. * @error Invalid edict index, or no mod support. */ -native CreateEntityByName(const String:classname[], ForceEdictIndex=-1); +native int CreateEntityByName(const char[] classname, int ForceEdictIndex=-1); /** * Spawns an entity into the game. @@ -161,7 +156,7 @@ native CreateEntityByName(const String:classname[], ForceEdictIndex=-1); * @return True on success, false otherwise. * @error Invalid entity index, or no mod support. */ -native bool:DispatchSpawn(entity); +native bool DispatchSpawn(int entity); /** * Dispatches a KeyValue into given entity using a string value. @@ -172,7 +167,7 @@ native bool:DispatchSpawn(entity); * @return True on success, false otherwise. * @error Invalid entity index, or no mod support. */ -native bool:DispatchKeyValue(entity, const String:keyName[], const String:value[]); +native bool DispatchKeyValue(int entity, const char[] keyName, const char[] value); /** * Dispatches a KeyValue into given entity using a floating point value. @@ -183,7 +178,7 @@ native bool:DispatchKeyValue(entity, const String:keyName[], const String:value[ * @return True on success, false otherwise. * @error Invalid entity index, or no mod support. */ -native bool:DispatchKeyValueFloat(entity, const String:keyName[], Float:value); +native bool DispatchKeyValueFloat(int entity, const char[] keyName, float value); /** * Dispatches a KeyValue into given entity using a vector value. @@ -194,7 +189,7 @@ native bool:DispatchKeyValueFloat(entity, const String:keyName[], Float:value); * @return True on success, false otherwise. * @error Invalid entity index, or no mod support. */ -native bool:DispatchKeyValueVector(entity, const String:keyName[], const Float:vec[3]); +native bool DispatchKeyValueVector(int entity, const char[] keyName, const float vec[3]); /** * Returns the entity a client is aiming at. @@ -206,7 +201,7 @@ native bool:DispatchKeyValueVector(entity, const String:keyName[], const Float:v * -2 if the function is not supported. * @error Invalid client index or client not in game. */ -native GetClientAimTarget(client, bool:only_clients=true); +native int GetClientAimTarget(int client, bool only_clients=true); /** * Returns the total number of teams in a game. @@ -214,7 +209,7 @@ native GetClientAimTarget(client, bool:only_clients=true); * * @return Total number of teams. */ -native GetTeamCount(); +native int GetTeamCount(); /** * Retrieves the team name based on a team index. @@ -223,10 +218,9 @@ native GetTeamCount(); * @param index Team index. * @param name Buffer to store string in. * @param maxlength Maximum length of string buffer. - * @noreturn * @error Invalid team index. */ -native GetTeamName(index, String:name[], maxlength); +native void GetTeamName(int index, char[] name, int maxlength); /** * Returns the score of a team based on a team index. @@ -236,7 +230,7 @@ native GetTeamName(index, String:name[], maxlength); * @return Score. * @error Invalid team index. */ -native GetTeamScore(index); +native int GetTeamScore(int index); /** * Sets the score of a team based on a team index. @@ -244,10 +238,9 @@ native GetTeamScore(index); * * @param index Team index. * @param value New score value. - * @return Score. * @error Invalid team index. */ -native SetTeamScore(index, value); +native void SetTeamScore(int index, int value); /** * Retrieves the number of players in a certain team. @@ -257,7 +250,7 @@ native SetTeamScore(index, value); * @return Number of players in the team. * @error Invalid team index. */ -native GetTeamClientCount(index); +native int GetTeamClientCount(int index); /** * Returns the entity index of a team. @@ -273,10 +266,9 @@ native int GetTeamEntity(int teamIndex); * * @param entity Entity index. * @param model Model name. - * @noreturn * @error Invalid entity index, or no mod support. */ -native SetEntityModel(entity, const String:model[]); +native void SetEntityModel(int entity, const char[] model); /** * Retrieves the decal file name associated with a given client. @@ -287,7 +279,7 @@ native SetEntityModel(entity, const String:model[]); * @return True on success, otherwise false. * @error Invalid client or client not in game. */ -native bool:GetPlayerDecalFile(client, String:hex[], maxlength); +native bool GetPlayerDecalFile(int client, char[] hex, int maxlength); /** * Retrieves the jingle file name associated with a given client. @@ -298,36 +290,33 @@ native bool:GetPlayerDecalFile(client, String:hex[], maxlength); * @return True on success, otherwise false. * @error Invalid client or client not in game. */ -native bool:GetPlayerJingleFile(client, String:hex[], maxlength); +native bool GetPlayerJingleFile(int client, char[] hex, int maxlength); /** * Returns the average server network traffic in bytes/sec. * * @param in Buffer to store the input traffic velocity. * @param out Buffer to store the output traffic velocity. - * @noreturn */ -native GetServerNetStats(&Float:inAmount, &Float:outAmout); +native void GetServerNetStats(float &inAmount, float &outAmout); /** * Equip's a player's weapon. * * @param client Client index. * @param weapon CBaseCombatWeapon entity index. - * @noreturn * @error Invalid client or entity, lack of mod support, or client not in * game. */ -native EquipPlayerWeapon(client, weapon); +native void EquipPlayerWeapon(int client, int weapon); /** * Activates an entity (CBaseAnimating::Activate) * * @param entity Entity index. - * @noreturn * @error Invalid entity or lack of mod support. */ -native ActivateEntity(entity); +native void ActivateEntity(int entity); /** * Sets values to client info buffer keys and notifies the engine of the change. @@ -336,10 +325,9 @@ native ActivateEntity(entity); * @param client Player's index. * @param key Key string. * @param value Value string. - * @noreturn * @error Invalid client index, or client not connected. */ -native SetClientInfo(client, const String:key[], const String:value[]); +native void SetClientInfo(int client, const char[] key, const char[] value); /** * Changes a client's name. @@ -361,4 +349,4 @@ native void SetClientName(int client, const char[] name); * * @return Amount of ammo actually given. */ -native GivePlayerAmmo(client, amount, ammotype, bool:suppressSound=false); +native int GivePlayerAmmo(int client, int amount, int ammotype, bool suppressSound=false); diff --git a/plugins/include/sdktools_sound.inc b/plugins/include/sdktools_sound.inc index a68d8c31..aceeafd6 100644 --- a/plugins/include/sdktools_sound.inc +++ b/plugins/include/sdktools_sound.inc @@ -125,9 +125,8 @@ enum * Prefetches a sound. * * @param name Sound file name relative to the "sounds" folder. - * @noreturn */ -native PrefetchSound(const String:name[]); +native void PrefetchSound(const char[] name); /** * This function is not known to work, and may crash. You should @@ -137,7 +136,7 @@ native PrefetchSound(const String:name[]); * @return Duration in seconds. */ #pragma deprecated Does not work, may crash. -native Float:GetSoundDuration(const String:name[]); +native float GetSoundDuration(const char[] name); /** * Emits an ambient sound. @@ -150,16 +149,15 @@ native Float:GetSoundDuration(const String:name[]); * @param vol Volume (from 0.0 to 1.0). * @param pitch Pitch (from 0 to 255). * @param delay Play delay. - * @noreturn */ -native EmitAmbientSound(const String:name[], - const Float:pos[3], - entity = SOUND_FROM_WORLD, - level = SNDLEVEL_NORMAL, - flags = SND_NOFLAGS, - Float:vol = SNDVOL_NORMAL, - pitch = SNDPITCH_NORMAL, - Float:delay = 0.0); +native void EmitAmbientSound(const char[] name, + const float pos[3], + int entity = SOUND_FROM_WORLD, + int level = SNDLEVEL_NORMAL, + int flags = SND_NOFLAGS, + float vol = SNDVOL_NORMAL, + int pitch = SNDPITCH_NORMAL, + float delay = 0.0); /** * Fades a client's volume level toward silence or a given percentage. @@ -169,10 +167,9 @@ native EmitAmbientSound(const String:name[], * @param outtime Fade out time, in seconds. * @param holdtime Hold time, in seconds. * @param intime Fade in time, in seconds. - * @noreturn * @error Invalid client index or client not in game. */ -native FadeClientVolume(client, Float:percent, Float:outtime, Float:holdtime, Float:intime); +native void FadeClientVolume(int client, float percent, float outtime, float holdtime, float intime); /** * Stops a sound. @@ -180,9 +177,8 @@ native FadeClientVolume(client, Float:percent, Float:outtime, Float:holdtime, Fl * @param entity Entity index. * @param channel Channel number. * @param name Sound file name relative to the "sounds" folder. - * @noreturn */ -native StopSound(entity, channel, const String:name[]); +native void StopSound(int entity, int channel, const char[] name); /** * Emits a sound to a list of clients. @@ -202,24 +198,23 @@ native StopSound(entity, channel, const String:name[]); * @param updatePos Unknown (updates positions?) * @param soundtime Alternate time to play sound for. * @param ... Optional list of Float[3] arrays to specify additional origins. - * @noreturn * @error Invalid client index. */ -native EmitSound(const clients[], - numClients, - const String:sample[], - entity = SOUND_FROM_PLAYER, - channel = SNDCHAN_AUTO, - level = SNDLEVEL_NORMAL, - flags = SND_NOFLAGS, - Float:volume = SNDVOL_NORMAL, - pitch = SNDPITCH_NORMAL, - speakerentity = -1, - const Float:origin[3] = NULL_VECTOR, - const Float:dir[3] = NULL_VECTOR, - bool:updatePos = true, - Float:soundtime = 0.0, - any:...); +native void EmitSound(const int[] clients, + int numClients, + const char[] sample, + int entity = SOUND_FROM_PLAYER, + int channel = SNDCHAN_AUTO, + int level = SNDLEVEL_NORMAL, + int flags = SND_NOFLAGS, + float volume = SNDVOL_NORMAL, + int pitch = SNDPITCH_NORMAL, + int speakerentity = -1, + const float origin[3] = NULL_VECTOR, + const float dir[3] = NULL_VECTOR, + bool updatePos = true, + float soundtime = 0.0, + any ...); /** * Emits a sound or game sound to a list of clients using the latest version of the engine sound interface. @@ -242,26 +237,25 @@ native EmitSound(const clients[], * @param updatePos Unknown (updates positions?) * @param soundtime Alternate time to play sound for. * @param ... Optional list of Float[3] arrays to specify additional origins. - * @noreturn * @error Invalid client index. */ -native EmitSoundEntry(const clients[], - numClients, - const String:soundEntry[], - const String:sample[], - entity = SOUND_FROM_PLAYER, - channel = SNDCHAN_AUTO, - level = SNDLEVEL_NORMAL, - seed = 0, - flags = SND_NOFLAGS, - Float:volume = SNDVOL_NORMAL, - pitch = SNDPITCH_NORMAL, - speakerentity = -1, - const Float:origin[3] = NULL_VECTOR, - const Float:dir[3] = NULL_VECTOR, - bool:updatePos = true, - Float:soundtime = 0.0, - any:...); +native void EmitSoundEntry(const int[] clients, + int numClients, + const char[] soundEntry, + const char[] sample, + int entity = SOUND_FROM_PLAYER, + int channel = SNDCHAN_AUTO, + int level = SNDLEVEL_NORMAL, + int seed = 0, + int flags = SND_NOFLAGS, + float volume = SNDVOL_NORMAL, + int pitch = SNDPITCH_NORMAL, + int speakerentity = -1, + const float origin[3] = NULL_VECTOR, + const float dir[3] = NULL_VECTOR, + bool updatePos = true, + float soundtime = 0.0, + any ...); /** * Emits a sentence to a list of clients. @@ -281,33 +275,32 @@ native EmitSoundEntry(const clients[], * @param updatePos Unknown (updates positions?) * @param soundtime Alternate time to play sound for. * @param ... Optional list of Float[3] arrays to specify additional origins. - * @noreturn * @error Invalid client index. */ -native EmitSentence(const clients[], - numClients, - sentence, - entity, - channel = SNDCHAN_AUTO, - level = SNDLEVEL_NORMAL, - flags = SND_NOFLAGS, - Float:volume = SNDVOL_NORMAL, - pitch = SNDPITCH_NORMAL, - speakerentity = -1, - const Float:origin[3] = NULL_VECTOR, - const Float:dir[3] = NULL_VECTOR, - bool:updatePos = true, - Float:soundtime = 0.0, - any:...); +native void EmitSentence(const int[] clients, + int numClients, + int sentence, + int entity, + int channel = SNDCHAN_AUTO, + int level = SNDLEVEL_NORMAL, + int flags = SND_NOFLAGS, + float volume = SNDVOL_NORMAL, + int pitch = SNDPITCH_NORMAL, + int speakerentity = -1, + const float origin[3] = NULL_VECTOR, + const float dir[3] = NULL_VECTOR, + bool updatePos = true, + float soundtime = 0.0, + any ...); /** - *Calculates gain of sound on given distance with given sound level in decibel + * Calculates gain of sound on given distance with given sound level in decibel * * @param soundlevel decibel of sound, like SNDLEVEL_NORMAL or integer value * @param distance distance of sound to calculate, not meter or feet, but Source Engine`s normal Coordinate unit * @return gain of sound. you can multiply this with original sound`s volume to calculate volume on given distance */ -native Float:GetDistGainFromSoundLevel(soundlevel, Float:distance); +native float GetDistGainFromSoundLevel(int soundlevel, float distance); /** * Called when an ambient sound is about to be emitted to one or more clients. @@ -372,37 +365,33 @@ typeset NormalSHook * Hooks all played ambient sounds. * * @param hook Function to use as a hook. - * @noreturn * @error Invalid function hook. */ -native AddAmbientSoundHook(AmbientSHook:hook); +native void AddAmbientSoundHook(AmbientSHook hook); /** * Hooks all played normal sounds. * * @param hook Function to use as a hook. - * @noreturn * @error Invalid function hook. */ -native AddNormalSoundHook(NormalSHook:hook); +native void AddNormalSoundHook(NormalSHook hook); /** * Unhooks all played ambient sounds. * * @param hook Function used for the hook. - * @noreturn * @error Invalid function hook. */ -native RemoveAmbientSoundHook(AmbientSHook:hook); +native void RemoveAmbientSoundHook(AmbientSHook hook); /** * Unhooks all played normal sounds. * * @param hook Function used for the hook. - * @noreturn * @error Invalid function hook. */ -native RemoveNormalSoundHook(NormalSHook:hook); +native void RemoveNormalSoundHook(NormalSHook hook); /** * Wrapper to emit sound to one client. @@ -420,24 +409,23 @@ native RemoveNormalSoundHook(NormalSHook:hook); * @param dir Sound direction. * @param updatePos Unknown (updates positions?) * @param soundtime Alternate time to play sound for. - * @noreturn * @error Invalid client index. */ -stock EmitSoundToClient(client, - const String:sample[], - entity = SOUND_FROM_PLAYER, - channel = SNDCHAN_AUTO, - level = SNDLEVEL_NORMAL, - flags = SND_NOFLAGS, - Float:volume = SNDVOL_NORMAL, - pitch = SNDPITCH_NORMAL, - speakerentity = -1, - const Float:origin[3] = NULL_VECTOR, - const Float:dir[3] = NULL_VECTOR, - bool:updatePos = true, - Float:soundtime = 0.0) +stock void EmitSoundToClient(int client, + const char[] sample, + int entity = SOUND_FROM_PLAYER, + int channel = SNDCHAN_AUTO, + int level = SNDLEVEL_NORMAL, + int flags = SND_NOFLAGS, + float volume = SNDVOL_NORMAL, + int pitch = SNDPITCH_NORMAL, + int speakerentity = -1, + const float origin[3] = NULL_VECTOR, + const float dir[3] = NULL_VECTOR, + bool updatePos = true, + float soundtime = 0.0) { - new clients[1]; + int clients[1]; clients[0] = client; /* Save some work for SDKTools and remove SOUND_FROM_PLAYER references */ entity = (entity == SOUND_FROM_PLAYER) ? client : entity; @@ -461,26 +449,25 @@ stock EmitSoundToClient(client, * @param dir Sound direction. * @param updatePos Unknown (updates positions?) * @param soundtime Alternate time to play sound for. - * @noreturn * @error Invalid client index. */ -stock EmitSoundToAll(const String:sample[], - entity = SOUND_FROM_PLAYER, - channel = SNDCHAN_AUTO, - level = SNDLEVEL_NORMAL, - flags = SND_NOFLAGS, - Float:volume = SNDVOL_NORMAL, - pitch = SNDPITCH_NORMAL, - speakerentity = -1, - const Float:origin[3] = NULL_VECTOR, - const Float:dir[3] = NULL_VECTOR, - bool:updatePos = true, - Float:soundtime = 0.0) +stock void EmitSoundToAll(const char[] sample, + int entity = SOUND_FROM_PLAYER, + int channel = SNDCHAN_AUTO, + int level = SNDLEVEL_NORMAL, + int flags = SND_NOFLAGS, + float volume = SNDVOL_NORMAL, + int pitch = SNDPITCH_NORMAL, + int speakerentity = -1, + const float origin[3] = NULL_VECTOR, + const float dir[3] = NULL_VECTOR, + bool updatePos = true, + float soundtime = 0.0) { - new clients[MaxClients]; - new total = 0; + int[] clients = new int[MaxClients]; + int total = 0; - for (new i=1; i<=MaxClients; i++) + for (int i=1; i<=MaxClients; i++) { if (IsClientInGame(i)) { @@ -505,7 +492,7 @@ stock EmitSoundToAll(const String:sample[], * @param attn Attenuation value. * @return Integer sound level. */ -stock ATTN_TO_SNDLEVEL(Float:attn) +stock int ATTN_TO_SNDLEVEL(float attn) { if (attn > 0.0) { @@ -534,14 +521,14 @@ stock ATTN_TO_SNDLEVEL(Float:attn) * @return True if the sound was successfully retrieved, false if it * was not found */ -native bool:GetGameSoundParams(const String:gameSound[], - &channel, - &soundLevel, - &Float:volume, - &pitch, - String:sample[], - maxlength, - entity=SOUND_FROM_PLAYER); +native bool GetGameSoundParams(const char[] gameSound, + int &channel, + int &soundLevel, + float &volume, + int &pitch, + char[] sample, + int maxlength, + int entity=SOUND_FROM_PLAYER); /** * Emits a game sound to a list of clients. @@ -565,22 +552,22 @@ native bool:GetGameSoundParams(const String:gameSound[], * @return True if the sound was played successfully, false if it failed * @error Invalid client index. */ -stock bool:EmitGameSound(const clients[], - numClients, - const String:gameSound[], - entity = SOUND_FROM_PLAYER, - flags = SND_NOFLAGS, - speakerentity = -1, - const Float:origin[3] = NULL_VECTOR, - const Float:dir[3] = NULL_VECTOR, - bool:updatePos = true, - Float:soundtime = 0.0) +stock bool EmitGameSound(const int[] clients, + int numClients, + const char[] gameSound, + int entity = SOUND_FROM_PLAYER, + int flags = SND_NOFLAGS, + int speakerentity = -1, + const float origin[3] = NULL_VECTOR, + const float dir[3] = NULL_VECTOR, + bool updatePos = true, + float soundtime = 0.0) { - new channel; - new level; - new Float:volume; - new pitch; - new String:sample[PLATFORM_MAX_PATH]; + int channel; + int level; + float volume; + int pitch; + char sample[PLATFORM_MAX_PATH]; if (GetGameSoundParams(gameSound, channel, level, volume, pitch, sample, sizeof(sample), entity)) { @@ -607,19 +594,18 @@ stock bool:EmitGameSound(const clients[], * @param entity Entity index to associate sound with. * @param flags Sound flags. * @param delay Play delay. - * @noreturn */ -stock bool:EmitAmbientGameSound(const String:gameSound[], - const Float:pos[3], - entity = SOUND_FROM_WORLD, - flags = SND_NOFLAGS, - Float:delay = 0.0) +stock bool EmitAmbientGameSound(const char[] gameSound, + const float pos[3], + int entity = SOUND_FROM_WORLD, + int flags = SND_NOFLAGS, + float delay = 0.0) { - new channel; // This is never actually used for Ambients, but it's a mandatory field to GetGameSoundParams - new level; - new Float:volume; - new pitch; - new String:sample[PLATFORM_MAX_PATH]; + int channel; // This is never actually used for Ambients, but it's a mandatory field to GetGameSoundParams + int level; + float volume; + int pitch; + char sample[PLATFORM_MAX_PATH]; if (GetGameSoundParams(gameSound, channel, level, volume, pitch, sample, sizeof(sample), entity)) { @@ -650,20 +636,19 @@ stock bool:EmitAmbientGameSound(const String:gameSound[], * @param dir Sound direction. * @param updatePos Unknown (updates positions?) * @param soundtime Alternate time to play sound for. - * @noreturn * @error Invalid client index. */ -stock bool:EmitGameSoundToClient(client, - const String:gameSound[], - entity = SOUND_FROM_PLAYER, - flags = SND_NOFLAGS, - speakerentity = -1, - const Float:origin[3] = NULL_VECTOR, - const Float:dir[3] = NULL_VECTOR, - bool:updatePos = true, - Float:soundtime = 0.0) +stock bool EmitGameSoundToClient(int client, + const char[] gameSound, + int entity = SOUND_FROM_PLAYER, + int flags = SND_NOFLAGS, + int speakerentity = -1, + const float origin[3] = NULL_VECTOR, + const float dir[3] = NULL_VECTOR, + bool updatePos = true, + float soundtime = 0.0) { - new clients[1]; + int clients[1]; clients[0] = client; /* Save some work for SDKTools and remove SOUND_FROM_PLAYER references */ entity = (entity == SOUND_FROM_PLAYER) ? client : entity; @@ -688,22 +673,21 @@ stock bool:EmitGameSoundToClient(client, * @param dir Sound direction. * @param updatePos Unknown (updates positions?) * @param soundtime Alternate time to play sound for. - * @noreturn * @error Invalid client index. */ -stock bool:EmitGameSoundToAll(const String:gameSound[], - entity = SOUND_FROM_PLAYER, - flags = SND_NOFLAGS, - speakerentity = -1, - const Float:origin[3] = NULL_VECTOR, - const Float:dir[3] = NULL_VECTOR, - bool:updatePos = true, - Float:soundtime = 0.0) +stock bool EmitGameSoundToAll(const char[] gameSound, + int entity = SOUND_FROM_PLAYER, + int flags = SND_NOFLAGS, + int speakerentity = -1, + const float origin[3] = NULL_VECTOR, + const float dir[3] = NULL_VECTOR, + bool updatePos = true, + float soundtime = 0.0) { - new clients[MaxClients]; - new total = 0; + int[] clients = new int[MaxClients]; + int total = 0; - for (new i=1; i<=MaxClients; i++) + for (int i=1; i<=MaxClients; i++) { if (IsClientInGame(i)) { @@ -738,4 +722,4 @@ stock bool:EmitGameSoundToAll(const String:gameSound[], * @return True if the game sound was found, false if sound did not exist * or had no files */ -native bool:PrecacheScriptSound(const String:soundname[]); +native bool PrecacheScriptSound(const char[] soundname); diff --git a/plugins/include/sdktools_tempents.inc b/plugins/include/sdktools_tempents.inc index 1a711a2e..c534cb4c 100644 --- a/plugins/include/sdktools_tempents.inc +++ b/plugins/include/sdktools_tempents.inc @@ -51,29 +51,26 @@ typedef TEHook = function Action (const char[] te_name, const int[] Players, int * * @param te_name TE name to hook. * @param hook Function to use as a hook. - * @noreturn * @error Temp Entity name not available or invalid function hook. */ -native AddTempEntHook(const String:te_name[], TEHook:hook); +native void AddTempEntHook(const char[] te_name, TEHook hook); /** * Removes a temp entity hook. * * @param te_name TE name to unhook. * @param hook Function used for the hook. - * @noreturn * @error Temp Entity name not available or invalid function hook. */ -native RemoveTempEntHook(const String:te_name[], TEHook:hook); +native void RemoveTempEntHook(const char[] te_name, TEHook hook); /** * Starts a temp entity transmission. * * @param te_name TE name. - * @noreturn * @error Temp Entity name not available. */ -native TE_Start(const String:te_name[]); +native void TE_Start(const char[] te_name); /** * Checks if a certain TE property exists. @@ -81,17 +78,16 @@ native TE_Start(const String:te_name[]); * @param prop Property to use. * @return True if the property exists, otherwise false. */ -native bool:TE_IsValidProp(const String:prop[]); +native bool TE_IsValidProp(const char[] prop); /** * Sets an integer value in the current temp entity. * * @param prop Property to use. * @param value Integer value to set. - * @noreturn * @error Property not found. */ -native TE_WriteNum(const String:prop[], value); +native void TE_WriteNum(const char[] prop, int value); /** * Reads an integer value in the current temp entity. @@ -100,56 +96,52 @@ native TE_WriteNum(const String:prop[], value); * @return Property value. * @error Property not found. */ -native TE_ReadNum(const String:prop[]); +native int TE_ReadNum(const char[] prop); /** * Sets a floating point number in the current temp entity. * * @param prop Property to use. * @param value Floating point number to set. - * @noreturn * @error Property not found. */ -native TE_WriteFloat(const String:prop[], Float:value); +native void TE_WriteFloat(const char[] prop, float value); /** * Reads a floating point number in the current temp entity. * * @param prop Property to use. - * @noreturn Property value. + * @return Property value. * @error Property not found. */ -native Float:TE_ReadFloat(const String:prop[]); +native float TE_ReadFloat(const char[] prop); /** * Sets a vector in the current temp entity. * * @param prop Property to use. * @param vector Vector to set. - * @noreturn * @error Property not found. */ -native TE_WriteVector(const String:prop[], const Float:vector[3]); +native void TE_WriteVector(const char[] prop, const float vector[3]); /** * Reads a vector in the current temp entity. * * @param prop Property to use. * @param vector Vector to read. - * @noreturn * @error Property not found. */ -native TE_ReadVector(const String:prop[], Float:vector[3]); +native void TE_ReadVector(const char[] prop, float vector[3]); /** * Sets a QAngle in the current temp entity. * * @param prop Property to use. * @param angles Angles to set. - * @return True on success, otherwise false. * @error Property not found. */ -native TE_WriteAngles(const String:prop[], const Float:angles[3]); +native void TE_WriteAngles(const char[] prop, const float angles[3]); /** * Sets an array of floats in the current temp entity. @@ -157,10 +149,9 @@ native TE_WriteAngles(const String:prop[], const Float:angles[3]); * @param prop Property to use. * @param array Array of values to copy. * @param arraySize Number of values to copy. - * @return True on success, otherwise false. * @error Property not found. */ -native TE_WriteFloatArray(const String:prop[], const Float:array[], arraySize); +native void TE_WriteFloatArray(const char[] prop, const float[] array, int arraySize); /** * Sends the current temp entity to one or more clients. @@ -168,10 +159,9 @@ native TE_WriteFloatArray(const String:prop[], const Float:array[], arraySize); * @param clients Array containing player indexes to broadcast to. * @param numClients Number of players in the array. * @param delay Delay in seconds to send the TE. - * @noreturn * @error Invalid client index or client not in game. */ -native TE_Send(const clients[], numClients, Float:delay=0.0); +native void TE_Send(const int[] clients, int numClients, float delay=0.0); /** * Sets an encoded entity index in the current temp entity. @@ -179,12 +169,11 @@ native TE_Send(const clients[], numClients, Float:delay=0.0); * * @param prop Property to use. * @param value Value to set. - * @noreturn * @error Property not found. */ -stock TE_WriteEncodedEnt(const String:prop[], value) +stock void TE_WriteEncodedEnt(const char[] prop, int value) { - new encvalue = (value & 0x0FFF) | ((1 & 0xF)<<12); + int encvalue = (value & 0x0FFF) | ((1 & 0xF)<<12); return TE_WriteNum(prop, encvalue); } @@ -193,13 +182,12 @@ stock TE_WriteEncodedEnt(const String:prop[], value) * @note See TE_Start(). * * @param delay Delay in seconds to send the TE. - * @noreturn */ -stock TE_SendToAll(Float:delay=0.0) +stock void TE_SendToAll(float delay=0.0) { - new total = 0; - new clients[MaxClients]; - for (new i=1; i<=MaxClients; i++) + int total = 0; + int[] clients = new int[MaxClients]; + for (int i=1; i<=MaxClients; i++) { if (IsClientInGame(i)) { @@ -215,12 +203,11 @@ stock TE_SendToAll(Float:delay=0.0) * * @param client Client to send to. * @param delay Delay in seconds to send the TE. - * @noreturn * @error Invalid client index or client not in game. */ -stock TE_SendToClient(client, Float:delay=0.0) +stock void TE_SendToClient(int client, float delay=0.0) { - new players[1]; + int players[1]; players[0] = client; @@ -236,11 +223,10 @@ stock TE_SendToClient(client, Float:delay=0.0) * @param origin Coordinates from which to test range. * @param rangeType Range type to use for filtering clients. * @param delay Delay in seconds to send the TE. - * @noreturn */ -stock TE_SendToAllInRange(float origin[3], ClientRangeType rangeType, float delay=0.0) +stock void TE_SendToAllInRange(float origin[3], ClientRangeType rangeType, float delay=0.0) { int[] clients = new int[MaxClients]; int total = GetClientsInRange(origin, rangeType, clients, MaxClients); return TE_Send(clients, total, delay); -} \ No newline at end of file +} diff --git a/plugins/include/sdktools_trace.inc b/plugins/include/sdktools_trace.inc index 667db776..3b9d5ee1 100644 --- a/plugins/include/sdktools_trace.inc +++ b/plugins/include/sdktools_trace.inc @@ -139,7 +139,7 @@ typeset TraceEntityFilter * @param entindex Entity index found at the given position (by reference). * @return Contents mask. */ -native TR_GetPointContents(const Float:pos[3], &entindex=-1); +native int TR_GetPointContents(const float pos[3], int &entindex=-1); /** * Get the point contents testing only the given entity index. @@ -148,7 +148,7 @@ native TR_GetPointContents(const Float:pos[3], &entindex=-1); * @param pos World position. * @return Contents mask. */ -native TR_GetPointContentsEnt(entindex, const Float:pos[3]); +native int TR_GetPointContentsEnt(int entindex, const float pos[3]); /** * Starts up a new trace ray using a global trace result. @@ -158,12 +158,11 @@ native TR_GetPointContentsEnt(entindex, const Float:pos[3]); * ending point, or the direction angle. * @param flags Trace flags. * @param rtype Method to calculate the ray direction. - * @noreturn */ -native TR_TraceRay(const Float:pos[3], - const Float:vec[3], - flags, - RayType:rtype); +native void TR_TraceRay(const float pos[3], + const float vec[3], + int flags, + RayType rtype); /** * Starts up a new trace hull using a global trace result. @@ -173,13 +172,12 @@ native TR_TraceRay(const Float:pos[3], * @param mins Hull minimum size. * @param maxs Hull maximum size. * @param flags Trace flags. - * @noreturn */ -native TR_TraceHull(const Float:pos[3], - const Float:vec[3], - const Float:mins[3], - const Float:maxs[3], - flags); +native void TR_TraceHull(const float pos[3], + const float vec[3], + const float mins[3], + const float maxs[3], + int flags); /** * Starts up a new trace ray using a global trace result and a customized @@ -196,14 +194,13 @@ native TR_TraceHull(const Float:pos[3], * @param filter Function to use as a filter. * @param data Arbitrary data value to pass through to the filter * function. - * @noreturn */ -native TR_TraceRayFilter(const Float:pos[3], - const Float:vec[3], - flags, - RayType:rtype, - TraceEntityFilter:filter, - any:data=0); +native void TR_TraceRayFilter(const float pos[3], + const float vec[3], + int flags, + RayType rtype, + TraceEntityFilter filter, + any data=0); /** * Starts up a new trace hull using a global trace result and a customized @@ -221,15 +218,14 @@ native TR_TraceRayFilter(const Float:pos[3], * @param filter Function to use as a filter. * @param data Arbitrary data value to pass through to the filter * function. - * @noreturn */ -native TR_TraceHullFilter(const Float:pos[3], - const Float:vec[3], - const Float:mins[3], - const Float:maxs[3], - flags, - TraceEntityFilter:filter, - any:data=0); +native void TR_TraceHullFilter(const float pos[3], + const float vec[3], + const float mins[3], + const float maxs[3], + int flags, + TraceEntityFilter filter, + any data=0); /** * Starts up a new trace ray using a new trace result. @@ -241,10 +237,10 @@ native TR_TraceHullFilter(const Float:pos[3], * @param rtype Method to calculate the ray direction. * @return Ray trace handle, which must be closed via CloseHandle(). */ -native Handle:TR_TraceRayEx(const Float:pos[3], - const Float:vec[3], - flags, - RayType:rtype); +native Handle TR_TraceRayEx(const float pos[3], + const float vec[3], + int flags, + RayType rtype); /** * Starts up a new trace hull using a new trace result. @@ -256,11 +252,11 @@ native Handle:TR_TraceRayEx(const Float:pos[3], * @param flags Trace flags. * @return Ray trace handle, which must be closed via CloseHandle(). */ -native Handle:TR_TraceHullEx(const Float:pos[3], - const Float:vec[3], - const Float:mins[3], - const Float:maxs[3], - flags); +native Handle TR_TraceHullEx(const float pos[3], + const float vec[3], + const float mins[3], + const float maxs[3], + int flags); /** * Starts up a new trace ray using a new trace result and a customized @@ -278,12 +274,12 @@ native Handle:TR_TraceHullEx(const Float:pos[3], * @param data Arbitrary data value to pass through to the filter function. * @return Ray trace handle, which must be closed via CloseHandle(). */ -native Handle:TR_TraceRayFilterEx(const Float:pos[3], - const Float:vec[3], - flags, - RayType:rtype, - TraceEntityFilter:filter, - any:data=0); +native Handle TR_TraceRayFilterEx(const float pos[3], + const float vec[3], + int flags, + RayType rtype, + TraceEntityFilter filter, + any data=0); /** * Starts up a new trace hull using a new trace result and a customized @@ -301,13 +297,13 @@ native Handle:TR_TraceRayFilterEx(const Float:pos[3], * @param data Arbitrary data value to pass through to the filter function. * @return Ray trace handle, which must be closed via CloseHandle(). */ -native Handle:TR_TraceHullFilterEx(const Float:pos[3], - const Float:vec[3], - const Float:mins[3], - const Float:maxs[3], - flags, - TraceEntityFilter:filter, - any:data=0); +native Handle TR_TraceHullFilterEx(const float pos[3], + const float vec[3], + const float mins[3], + const float maxs[3], + int flags, + TraceEntityFilter filter, + any data=0); /** * Returns the time fraction from a trace result (1.0 means no collision). @@ -316,17 +312,16 @@ native Handle:TR_TraceHullFilterEx(const Float:pos[3], * @return Time fraction value of the trace. * @error Invalid Handle. */ -native Float:TR_GetFraction(Handle:hndl=INVALID_HANDLE); +native float TR_GetFraction(Handle hndl=INVALID_HANDLE); /** * Returns the collision position of a trace result. * * @param pos Vector buffer to store data in. * @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result. - * @noreturn * @error Invalid Handle. */ -native TR_GetEndPosition(Float:pos[3], Handle:hndl=INVALID_HANDLE); +native void TR_GetEndPosition(float pos[3], Handle hndl=INVALID_HANDLE); /** * Returns the entity index that collided with the trace. @@ -335,7 +330,7 @@ native TR_GetEndPosition(Float:pos[3], Handle:hndl=INVALID_HANDLE); * @return Entity index or -1 for no collision. * @error Invalid Handle. */ -native TR_GetEntityIndex(Handle:hndl=INVALID_HANDLE); +native int TR_GetEntityIndex(Handle hndl=INVALID_HANDLE); /** * Returns if there was any kind of collision along the trace ray. @@ -344,7 +339,7 @@ native TR_GetEntityIndex(Handle:hndl=INVALID_HANDLE); * @return True if any collision found, otherwise false. * @error Invalid Handle. */ -native bool:TR_DidHit(Handle:hndl=INVALID_HANDLE); +native bool TR_DidHit(Handle hndl=INVALID_HANDLE); /** * Returns in which body hit group the trace collided if any. @@ -353,17 +348,16 @@ native bool:TR_DidHit(Handle:hndl=INVALID_HANDLE); * @return Body hit group. * @error Invalid Handle. */ -native TR_GetHitGroup(Handle:hndl=INVALID_HANDLE); +native int TR_GetHitGroup(Handle hndl=INVALID_HANDLE); /** * Find the normal vector to the collision plane of a trace. * * @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result. * @param normal Vector buffer to store the vector normal to the collision plane - * @noreturn * @error Invalid Handle */ -native TR_GetPlaneNormal(Handle:hndl, Float:normal[3]); +native void TR_GetPlaneNormal(Handle hndl, float normal[3]); /** * Tests a point to see if it's outside any playable area @@ -371,4 +365,4 @@ native TR_GetPlaneNormal(Handle:hndl, Float:normal[3]); * @param pos Vector buffer to store data in. * @return True if outside world, otherwise false. */ -native TR_PointOutsideWorld(Float:pos[3]); +native bool TR_PointOutsideWorld(float pos[3]); diff --git a/plugins/include/sourcemod.inc b/plugins/include/sourcemod.inc index f8d1b68a..023e3af5 100644 --- a/plugins/include/sourcemod.inc +++ b/plugins/include/sourcemod.inc @@ -91,8 +91,6 @@ enum APLRes * * If any run-time error is thrown during this callback, the plugin will be marked * as failed. - * - * @noreturn */ forward void OnPluginStart(); @@ -102,7 +100,7 @@ forward void OnPluginStart(); * not be called, but old plugins with only AskPluginLoad() will work. */ #pragma deprecated Use AskPluginLoad2() instead -forward bool:AskPluginLoad(Handle:myself, bool:late, String:error[], err_max); +forward bool AskPluginLoad(Handle myself, bool late, char[] error, int err_max); /** * Called before OnPluginStart, in case the plugin wants to check for load failure. @@ -123,7 +121,7 @@ forward bool:AskPluginLoad(Handle:myself, bool:late, String:error[], err_max); * @param err_max Maximum number of characters for error message buffer. * @return APLRes_Success for load success, APLRes_Failure or APLRes_SilentFailure otherwise */ -forward APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max); +forward APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max); /** * Called when the plugin is about to be unloaded. @@ -131,8 +129,6 @@ forward APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) * It is not necessary to close any handles or remove hooks in this function. * SourceMod guarantees that plugin shutdown automatically and correctly releases * all resources. - * - * @noreturn */ forward void OnPluginEnd(); @@ -140,9 +136,8 @@ forward void OnPluginEnd(); * Called when the plugin's pause status is changing. * * @param pause True if the plugin is being paused, false otherwise. - * @noreturn */ -forward void OnPluginPauseChange(bool:pause); +forward void OnPluginPauseChange(bool pause); /** * Called before every server frame. Note that you should avoid @@ -170,8 +165,6 @@ forward void OnMapEnd(); * * @note This will always be called once and only once per map. It will be * called after OnMapStart(). - * - * @noreturn */ forward void OnConfigsExecuted(); @@ -187,8 +180,6 @@ forward void OnConfigsExecuted(); * * Unlike OnMapStart() and OnConfigsExecuted(), this is not called on * late loads that occur after OnMapStart(). - * - * @noreturn */ forward void OnAutoConfigsBuffered(); @@ -210,7 +201,7 @@ forward void OnAllPluginsLoaded(); * * @return Handle of the calling plugin. */ -native Handle:GetMyHandle(); +native Handle GetMyHandle(); /** * Returns an iterator that can be used to search through plugins. @@ -219,7 +210,7 @@ native Handle:GetMyHandle(); * CloseHandle(). * @error Invalid Handle. */ -native Handle:GetPluginIterator(); +native Handle GetPluginIterator(); /** * Returns whether there are more plugins available in the iterator. @@ -228,7 +219,7 @@ native Handle:GetPluginIterator(); * @return True on more plugins, false otherwise. * @error Invalid Handle. */ -native bool:MorePlugins(Handle:iter); +native bool MorePlugins(Handle iter); /** * Returns the current plugin in the iterator and advances the iterator. @@ -238,7 +229,7 @@ native bool:MorePlugins(Handle:iter); * the iterator is advanced. * @error Invalid Handle. */ -native Handle:ReadPlugin(Handle:iter); +native Handle ReadPlugin(Handle iter); /** * Returns a plugin's status. @@ -247,7 +238,7 @@ native Handle:ReadPlugin(Handle:iter); * @return Status code for the plugin. * @error Invalid Handle. */ -native PluginStatus:GetPluginStatus(Handle:plugin); +native PluginStatus GetPluginStatus(Handle plugin); /** * Retrieves a plugin's file name relative to the plugins folder. @@ -255,10 +246,9 @@ native PluginStatus:GetPluginStatus(Handle:plugin); * @param plugin Plugin Handle (INVALID_HANDLE uses the calling plugin). * @param buffer Buffer to the store the file name. * @param maxlength Maximum length of the name buffer. - * @noreturn * @error Invalid Handle. */ -native GetPluginFilename(Handle:plugin, String:buffer[], maxlength); +native void GetPluginFilename(Handle plugin, char[] buffer, int maxlength); /** * Retrieves whether or not a plugin is being debugged. @@ -267,7 +257,7 @@ native GetPluginFilename(Handle:plugin, String:buffer[], maxlength); * @return True if being debugged, false otherwise. * @error Invalid Handle. */ -native bool:IsPluginDebugging(Handle:plugin); +native bool IsPluginDebugging(Handle plugin); /** * Retrieves a plugin's public info. @@ -279,7 +269,7 @@ native bool:IsPluginDebugging(Handle:plugin); * @return True on success, false if property is not available. * @error Invalid Handle. */ -native bool:GetPluginInfo(Handle:plugin, PluginInfo:info, String:buffer[], maxlength); +native bool GetPluginInfo(Handle plugin, PluginInfo info, char[] buffer, int maxlength); /** * Finds a plugin by its order in the list from the "plugins list" server @@ -291,7 +281,7 @@ native bool:GetPluginInfo(Handle:plugin, PluginInfo:info, String:buffer[], maxle * @return Plugin Handle on success, INVALID_HANDLE if no plugin * matches the given number. */ -native Handle:FindPluginByNumber(order_num); +native Handle FindPluginByNumber(int order_num); /** * Causes the plugin to enter a failed state. An error will be thrown and @@ -308,10 +298,9 @@ native Handle:FindPluginByNumber(order_num); * * @param string Format specifier string. * @param ... Formatting arguments. - * @noreturn * @error Always throws SP_ERROR_ABORT. */ -native SetFailState(const String:string[], any:...); +native void SetFailState(const char[] string, any ...); /** * Aborts the current callback and throws an error. This function @@ -319,10 +308,9 @@ native SetFailState(const String:string[], any:...); * * @param fmt String format. * @param ... Format arguments. - * @noreturn * @error Always! */ -native ThrowError(const String:fmt[], any:...); +native void ThrowError(const char[] fmt, any ...); /** * Gets the system time as a unix timestamp. @@ -330,7 +318,7 @@ native ThrowError(const String:fmt[], any:...); * @param bigStamp Optional array to store the 64bit timestamp in. * @return 32bit timestamp (number of seconds since unix epoch). */ -native GetTime(bigStamp[2]={0,0}); +native int GetTime(int bigStamp[2]={0,0}); /** * Produces a date and/or time string value for a timestamp. @@ -342,10 +330,9 @@ native GetTime(bigStamp[2]={0,0}); * @param maxlength Maximum length of output string buffer. * @param format Formatting rules (passing NULL_STRING will use the rules defined in sm_datetime_format). * @param stamp Optional time stamp. - * @noreturn * @error Buffer too small or invalid time format. */ -native FormatTime(String:buffer[], maxlength, const String:format[], stamp=-1); +native void FormatTime(char[] buffer, int maxlength, const char[] format, int stamp=-1); /** * Loads a game config file. @@ -354,7 +341,7 @@ native FormatTime(String:buffer[], maxlength, const String:format[], stamp=-1); * and the extension should be omitted. * @return A handle to the game config file or INVALID_HANDLE in failure. */ -native Handle:LoadGameConfigFile(const String:file[]); +native Handle LoadGameConfigFile(const char[] file); /** * Returns an offset value. @@ -363,7 +350,7 @@ native Handle:LoadGameConfigFile(const String:file[]); * @param key Key to retrieve from the offset section. * @return An offset, or -1 on failure. */ -native GameConfGetOffset(Handle:gc, const String:key[]); +native int GameConfGetOffset(Handle gc, const char[] key); /** * Gets the value of a key from the "Keys" section. @@ -374,7 +361,7 @@ native GameConfGetOffset(Handle:gc, const String:key[]); * @param maxlen Maximum length of output string buffer. * @return True if key existed, false otherwise. */ -native bool:GameConfGetKeyValue(Handle:gc, const String:key[], String:buffer[], maxlen); +native bool GameConfGetKeyValue(Handle gc, const char[] key, char[] buffer, int maxlen); /** * Finds an address calculation in a GameConfig file, @@ -384,7 +371,7 @@ native bool:GameConfGetKeyValue(Handle:gc, const String:key[], String:buffer[], * @param name Name of the property to find. * @return An address calculated on success, or 0 on failure. */ -native Address:GameConfGetAddress(Handle:gameconf, const String:name[]); +native Address GameConfGetAddress(Handle gameconf, const char[] name); /** * Returns the operating system's "tick count," which is a number of @@ -393,7 +380,7 @@ native Address:GameConfGetAddress(Handle:gameconf, const String:name[]); * * @return Tick count in milliseconds. */ -native GetSysTickCount(); +native int GetSysTickCount(); /** * Specifies that the given config file should be executed after plugin load. @@ -406,18 +393,16 @@ native GetSysTickCount(); * @param name Name of the config file, excluding the .cfg extension. * If empty, is assumed. * @param folder Folder under cfg/ to use. By default this is "sourcemod." - * @noreturn */ -native AutoExecConfig(bool:autoCreate=true, const String:name[]="", const String:folder[]="sourcemod"); +native void AutoExecConfig(bool autoCreate=true, const char[] name="", const char[] folder="sourcemod"); /** * Registers a library name for identifying as a dependency to * other plugins. * * @param name Library name. - * @noreturn */ -native RegPluginLibrary(const String:name[]); +native void RegPluginLibrary(const char[] name); /** * Returns whether a library exists. This function should be considered @@ -428,7 +413,7 @@ native RegPluginLibrary(const String:name[]); * @param name Library name of a plugin or extension. * @return True if exists, false otherwise. */ -native bool:LibraryExists(const String:name[]); +native bool LibraryExists(const char[] name); /** * Returns the status of an extension, by filename. @@ -441,7 +426,7 @@ native bool:LibraryExists(const String:name[]); * 0 if the extension loaded but reported an error. * 1 if the extension is running without error. */ -native GetExtensionFileStatus(const String:name[], String:error[]="", maxlength=0); +native int GetExtensionFileStatus(const char[] name, char[] error="", int maxlength=0); /** * Called after a library is added that the current plugin references @@ -450,7 +435,7 @@ native GetExtensionFileStatus(const String:name[], String:error[]="", maxlength= * * @param name Library name. */ -forward void OnLibraryAdded(const String:name[]); +forward void OnLibraryAdded(const char[] name); /** * Called right before a library is removed that the current plugin references @@ -459,7 +444,7 @@ forward void OnLibraryAdded(const String:name[]); * * @param name Library name. */ -forward void OnLibraryRemoved(const String:name[]); +forward void OnLibraryRemoved(const char[] name); #define MAPLIST_FLAG_MAPSFOLDER (1<<0) /**< On failure, use all maps in the maps folder. */ #define MAPLIST_FLAG_CLEARARRAY (1<<1) /**< If an input array is specified, clear it before adding. */ @@ -513,10 +498,10 @@ forward void OnLibraryRemoved(const String:name[]); * least one item. The serial number is updated to a positive number. * @error Invalid array Handle that is not INVALID_HANDLE. */ -native Handle:ReadMapList(Handle:array=INVALID_HANDLE, - &serial=-1, - const String:str[]="default", - flags=MAPLIST_FLAG_CLEARARRAY); +native Handle ReadMapList(Handle array=INVALID_HANDLE, + int &serial=-1, + const char[] str="default", + int flags=MAPLIST_FLAG_CLEARARRAY); /** * Makes a compatibility binding for map lists. For example, if a function previously used @@ -525,9 +510,8 @@ native Handle:ReadMapList(Handle:array=INVALID_HANDLE, * * @param name Configuration name that would be used with ReadMapList(). * @param file Default file to use. - * @noreturn */ -native SetMapListCompatBind(const String:name[], const String:file[]); +native void SetMapListCompatBind(const char[] name, const char[] file); /** * Called when a client has sent chat text. This must return either true or @@ -539,7 +523,7 @@ native SetMapListCompatBind(const String:name[], const String:file[]); * @param client Client index. The server (0) will never be passed. * @return True if client is spamming the server, false otherwise. */ -forward bool:OnClientFloodCheck(client); +forward bool OnClientFloodCheck(int client); /** * Called after a client's flood check has been computed. This can be used @@ -551,9 +535,8 @@ forward bool:OnClientFloodCheck(client); * * @param client Client index. The server (0) will never be passed. * @param blocked True if client flooded last "say", false otherwise. - * @noreturn */ -forward void OnClientFloodResult(client, bool:blocked); +forward void OnClientFloodResult(int client, bool blocked); /** * Feature types. @@ -603,7 +586,7 @@ enum FeatureStatus * * @return True if GetFeatureStatus will work, false otherwise. */ -stock bool:CanTestFeatures() +stock bool CanTestFeatures() { return LibraryExists("__CanTestFeatures__"); } @@ -615,7 +598,7 @@ stock bool:CanTestFeatures() * @param name Feature name. * @return Feature status. */ -native FeatureStatus:GetFeatureStatus(FeatureType:type, const String:name[]); +native FeatureStatus GetFeatureStatus(FeatureType type, const char[] name); /** * Requires that a given feature is available. If it is not, SetFailState() @@ -625,10 +608,9 @@ native FeatureStatus:GetFeatureStatus(FeatureType:type, const String:name[]); * @param name Feature name. * @param fmt Message format string, or empty to use default. * @param ... Message format parameters, if any. - * @noreturn */ -native RequireFeature(FeatureType:type, const String:name[], - const String:fmt[]="", any:...); +native void RequireFeature(FeatureType type, const char[] name, + const char[] fmt="", any ...); /** * Represents how many bytes we can read from an address with one load @@ -652,7 +634,7 @@ enum Address * @param size How many bytes should be read. * @return The value that is stored at that address. */ -native LoadFromAddress(Address:addr, NumberType:size); +native int LoadFromAddress(Address addr, NumberType size); /** * Store up to 4 bytes to a memory address. @@ -660,11 +642,9 @@ native LoadFromAddress(Address:addr, NumberType:size); * @param addr Address to a memory location. * @param data Value to store at the address. * @param size How many bytes should be written. - * @noreturn */ -native StoreToAddress(Address:addr, data, NumberType:size); +native void StoreToAddress(Address addr, int data, NumberType size); #include #include #include - diff --git a/plugins/include/string.inc b/plugins/include/string.inc index 923fdc84..177631f4 100644 --- a/plugins/include/string.inc +++ b/plugins/include/string.inc @@ -48,7 +48,7 @@ * @param str String to check. * @return Number of valid character bytes in the string. */ -native strlen(const String:str[]); +native int strlen(const char[] str); /** * Tests whether a string is found inside another string. @@ -60,7 +60,7 @@ native strlen(const String:str[]); * @return -1 on failure (no match found). Any other value * indicates a position in the string where the match starts. */ -native StrContains(const String:str[], const String:substr[], bool:caseSensitive=true); +native int StrContains(const char[] str, const char[] substr, bool caseSensitive=true); /** * Compares two strings lexographically. @@ -73,7 +73,7 @@ native StrContains(const String:str[], const String:substr[], bool:caseSensitive * 0 if str1 == str2 * 1 if str1 > str2 */ -native strcmp(const String:str1[], const String:str2[], bool:caseSensitive=true); +native int strcmp(const char[] str1, const char[] str2, bool caseSensitive=true); /** * Compares two strings parts lexographically. @@ -87,14 +87,14 @@ native strcmp(const String:str1[], const String:str2[], bool:caseSensitive=true) * 0 if str1 == str2 * 1 if str1 > str2 */ -native strncmp(const String:str1[], const String:str2[], num, bool:caseSensitive=true); +native int strncmp(const char[] str1, const char[] str2, int num, bool caseSensitive=true); /** * Backwards compatible stock - StrCompare is now strcmp * @deprecated Renamed to strcmp */ #pragma deprecated Use strcmp() instead -stock StrCompare(const String:str1[], const String:str2[], bool:caseSensitive=true) +stock int StrCompare(const char[] str1, const char[] str2, bool caseSensitive=true) { return strcmp(str1, str2, caseSensitive); } @@ -108,7 +108,7 @@ stock StrCompare(const String:str1[], const String:str2[], bool:caseSensitive=tr * If false, comparison is case insensitive. * @return True if equal, false otherwise. */ -stock bool:StrEqual(const String:str1[], const String:str2[], bool:caseSensitive=true) +stock bool StrEqual(const char[] str1, const char[] str2, bool caseSensitive=true) { return (strcmp(str1, str2, caseSensitive) == 0); } @@ -123,14 +123,14 @@ stock bool:StrEqual(const String:str1[], const String:str2[], bool:caseSensitive * @param source Source string buffer to copy from. * @return Number of cells written. */ -native strcopy(String:dest[], destLen, const String:source[]); +native int strcopy(char[] dest, int destLen, const char[] source); /** * Backwards compatibility stock - use strcopy * @deprecated Renamed to strcopy */ #pragma deprecated Use strcopy() instead -stock StrCopy(String:dest[], destLen, const String:source[]) +stock int StrCopy(char[] dest, int destLen, const char[] source) { return strcopy(dest, destLen, source); } @@ -144,7 +144,7 @@ stock StrCopy(String:dest[], destLen, const String:source[]) * @param ... Variable number of format parameters. * @return Number of cells written. */ -native Format(String:buffer[], maxlength, const String:format[], any:...); +native int Format(char[] buffer, int maxlength, const char[] format, any ...); /** * Formats a string according to the SourceMod format rules (see documentation). @@ -158,7 +158,7 @@ native Format(String:buffer[], maxlength, const String:format[], any:...); * @param ... Variable number of format parameters. * @return Number of cells written. */ -native FormatEx(String:buffer[], maxlength, const String:format[], any:...); +native int FormatEx(char[] buffer, int maxlength, const char[] format, any ...); /** * Formats a string according to the SourceMod format rules (see documentation). @@ -173,7 +173,7 @@ native FormatEx(String:buffer[], maxlength, const String:format[], any:...); * Note: Arguments start at 1. * @return Number of bytes written. */ -native VFormat(String:buffer[], maxlength, const String:format[], varpos); +native int VFormat(char[] buffer, int maxlength, const char[] format, int varpos); /** * Converts a string to an integer. @@ -182,7 +182,7 @@ native VFormat(String:buffer[], maxlength, const String:format[], varpos); * @param nBase Numerical base to use. 10 is default. * @return Integer conversion of string, or 0 on failure. */ -native StringToInt(const String:str[], nBase=10); +native int StringToInt(const char[] str, int nBase=10); /** * Converts a string to an integer with some more options. @@ -192,7 +192,7 @@ native StringToInt(const String:str[], nBase=10); * @param nBase Numerical base to use. 10 is default. * @return Number of characters consumed. */ -native StringToIntEx(const String:str[], &result, nBase=10); +native int StringToIntEx(const char[] str, int &result, int nBase=10); /** * Converts an integer to a string. @@ -202,7 +202,7 @@ native StringToIntEx(const String:str[], &result, nBase=10); * @param maxlength Maximum length of string buffer. * @return Number of cells written to buffer. */ -native IntToString(num, String:str[], maxlength); +native int IntToString(int num, char[] str, int maxlength); /** * Converts a string to a floating point number. @@ -210,7 +210,7 @@ native IntToString(num, String:str[], maxlength); * @param str String to convert to a float. * @return Floating point result, or 0.0 on error. */ -native Float:StringToFloat(const String:str[]); +native float StringToFloat(const char[] str); /** * Converts a string to a floating point number with some more options. @@ -219,7 +219,7 @@ native Float:StringToFloat(const String:str[]); * @param result Variable to store result in. * @return Number of characters consumed. */ -native StringToFloatEx(const String:str[], &Float:result); +native int StringToFloatEx(const char[] str, float &result); /** * Converts a floating point number to a string. @@ -229,7 +229,7 @@ native StringToFloatEx(const String:str[], &Float:result); * @param maxlength Maximum length of string buffer. * @return Number of cells written to buffer. */ -native FloatToString(Float:num, String:str[], maxlength); +native int FloatToString(float num, char[] str, int maxlength); /** * Finds the first "argument" in a string; either a set of space @@ -243,14 +243,14 @@ native FloatToString(Float:num, String:str[], maxlength); * @param argLen Maximum length of argument buffer. * @return Index to next piece of string, or -1 if none. */ -native BreakString(const String:source[], String:arg[], argLen); +native int BreakString(const char[] source, char[] arg, int argLen); /** * Backwards compatibility stock - use BreakString * @deprecated Renamed to BreakString. */ #pragma deprecated Use BreakString() instead -stock StrBreak(const String:source[], String:arg[], argLen) +stock int StrBreak(const char[] source, char[] arg, int argLen) { return BreakString(source, arg, argLen); } @@ -261,7 +261,7 @@ stock StrBreak(const String:source[], String:arg[], argLen) * @param str The string to trim. * @return Number of bytes written (UTF-8 safe). */ -native TrimString(String:str[]); +native int TrimString(char[] str); /** * Returns text in a string up until a certain character sequence is reached. @@ -274,7 +274,7 @@ native TrimString(String:str[]); * marking the first index after the searched text. The * index is always relative to the start of the input string. */ -native SplitString(const String:source[], const String:split[], String:part[], partLen); +native int SplitString(const char[] source, const char[] split, char[] part, int partLen); /** * Given a string, replaces all occurrences of a search string with a @@ -287,7 +287,7 @@ native SplitString(const String:source[], const String:split[], String:part[], p * @param caseSensitive If true (default), search is case sensitive. * @return Number of replacements that were performed. */ -native ReplaceString(String:text[], maxlength, const String:search[], const String:replace[], bool:caseSensitive=true); +native int ReplaceString(char[] text, int maxlength, const char[] search, const char[] replace, bool caseSensitive=true); /** * Given a string, replaces the first occurrence of a search string with a @@ -306,7 +306,7 @@ native ReplaceString(String:text[], maxlength, const String:search[], const Stri * the last replacement ended, or -1 if no replacements were * made. */ -native ReplaceStringEx(String:text[], maxlength, const String:search[], const String:replace[], searchLen=-1, replaceLen=-1, bool:caseSensitive=true); +native int ReplaceStringEx(char[] text, int maxlength, const char[] search, const char[] replace, int searchLen=-1, int replaceLen=-1, bool caseSensitive=true); /** * Returns the number of bytes a character is using. This is @@ -316,7 +316,7 @@ native ReplaceStringEx(String:text[], maxlength, const String:search[], const St * @param source Source input string. * @return Number of bytes the current character uses. */ -native GetCharBytes(const String:source[]); +native int GetCharBytes(const char[] source); /** * Returns whether a character is an ASCII alphabet character. @@ -326,7 +326,7 @@ native GetCharBytes(const String:source[]); * @param chr Character to test. * @return True if character is alphabetical, otherwise false. */ -native bool:IsCharAlpha(chr); +native bool IsCharAlpha(int chr); /** * Returns whether a character is numeric. @@ -336,7 +336,7 @@ native bool:IsCharAlpha(chr); * @param chr Character to test. * @return True if character is numeric, otherwise false. */ -native bool:IsCharNumeric(chr); +native bool IsCharNumeric(int chr); /** * Returns whether a character is whitespace. @@ -346,7 +346,7 @@ native bool:IsCharNumeric(chr); * @param chr Character to test. * @return True if character is whitespace, otherwise false. */ -native bool:IsCharSpace(chr); +native bool IsCharSpace(int chr); /** * Returns if a character is multi-byte or not. @@ -355,7 +355,7 @@ native bool:IsCharSpace(chr); * @return 0 for a normal 7-bit ASCII character, * otherwise number of bytes in multi-byte character. */ -native IsCharMB(chr); +native int IsCharMB(int chr); /** * Returns whether an alphabetic character is uppercase. @@ -365,7 +365,7 @@ native IsCharMB(chr); * @param chr Character to test. * @return True if character is uppercase, otherwise false. */ -native bool:IsCharUpper(chr); +native bool IsCharUpper(int chr); /** * Returns whether an alphabetic character is lowercase. @@ -375,7 +375,7 @@ native bool:IsCharUpper(chr); * @param chr Character to test. * @return True if character is lowercase, otherwise false. */ -native bool:IsCharLower(chr); +native bool IsCharLower(int chr); /** * Strips a quote pair off a string if it exists. That is, the following @@ -389,7 +389,7 @@ native bool:IsCharLower(chr); * @return True if string was modified, false if there was no * set of quotes. */ -native bool:StripQuotes(String:text[]); +native bool StripQuotes(char[] text); /** * Returns an uppercase character to a lowercase character. @@ -398,7 +398,7 @@ native bool:StripQuotes(String:text[]); * @return Lowercase character on success, * no change on failure. */ -stock CharToUpper(chr) +stock int CharToUpper(int chr) { if (IsCharLower(chr)) { @@ -414,7 +414,7 @@ stock CharToUpper(chr) * @return Uppercase character on success, * no change on failure. */ -stock CharToLower(chr) +stock int CharToLower(int chr) { if (IsCharUpper(chr)) { @@ -460,9 +460,9 @@ stock int FindCharInString(const char[] str, char c, bool reverse = false) * @param source Source string to concatenate. * @return Number of bytes written. */ -stock StrCat(String:buffer[], maxlength, const String:source[]) +stock int StrCat(char[] buffer, int maxlength, const char[] source) { - new len = strlen(buffer); + int len = strlen(buffer); if (len >= maxlength) { return 0; @@ -483,10 +483,10 @@ stock StrCat(String:buffer[], maxlength, const String:source[]) * delimiters after last piece. * @return Number of strings retrieved. */ -stock ExplodeString(const String:text[], const String:split[], String:buffers[][], maxStrings, - maxStringLength, bool:copyRemainder = false) +stock int ExplodeString(const char[] text, const char[] split, char[][] buffers, int maxStrings, + int maxStringLength, bool copyRemainder = false) { - new reloc_idx, idx, total; + int reloc_idx, idx, total; if (maxStrings < 1 || !split[0]) { @@ -522,11 +522,11 @@ stock ExplodeString(const String:text[], const String:split[], String:buffers[][ * @param maxLength Maximum length of the output buffer. * @return Number of bytes written to the output buffer. */ -stock ImplodeStrings(const String:strings[][], numStrings, const String:join[], String:buffer[], maxLength) +stock int ImplodeStrings(const char[][] strings, int numStrings, const char[] join, char[] buffer, int maxLength) { - new total, length, part_length; - new join_length = strlen(join); - for (new i=0; i(GetClientTeam(client)); } /** @@ -353,12 +353,11 @@ stock TFTeam:TF2_GetClientTeam(client) * * @param client Client index. * @param team TFTeam team symbol. - * @noreturn * @error Invalid client index. */ -stock TF2_ChangeClientTeam(client, TFTeam:team) +stock void TF2_ChangeClientTeam(int client, TFTeam team) { - ChangeClientTeam(client, _:team); + ChangeClientTeam(client, view_as(team)); } /** @@ -368,9 +367,9 @@ stock TF2_ChangeClientTeam(client, TFTeam:team) * @return Current TFClassType of player. * @error Invalid client index. */ -stock TFClassType:TF2_GetPlayerClass(client) +stock TFClassType TF2_GetPlayerClass(int client) { - return TFClassType:GetEntProp(client, Prop_Send, "m_iClass"); + return view_as(GetEntProp(client, Prop_Send, "m_iClass")); } /** @@ -382,16 +381,15 @@ stock TFClassType:TF2_GetPlayerClass(client) * @param classType TFClassType class symbol. * @param weapons This parameter is ignored. * @param persistent If true, changes the player's desired class so the change stays after death. - * @noreturn * @error Invalid client index. */ -stock TF2_SetPlayerClass(client, TFClassType:classType, bool:weapons=true, bool:persistent=true) +stock void TF2_SetPlayerClass(int client, TFClassType classType, bool weapons=true, bool persistent=true) { - SetEntProp(client, Prop_Send, "m_iClass", _:classType); + SetEntProp(client, Prop_Send, "m_iClass", view_as(classType)); if (persistent) { - SetEntProp(client, Prop_Send, "m_iDesiredPlayerClass", _:classType); + SetEntProp(client, Prop_Send, "m_iDesiredPlayerClass", view_as(classType)); } } @@ -404,21 +402,21 @@ stock TF2_SetPlayerClass(client, TFClassType:classType, bool:weapons=true, bool: * @error Invalid client index, client not in game or failed to find resource entity. */ #pragma deprecated Use GetPlayerResourceEntity and GetEntProp instead -stock TF2_GetPlayerResourceData(client, TFResourceType:type) +stock int TF2_GetPlayerResourceData(int client, TFResourceType type) { if (!IsClientConnected(client)) { return -1; } - new offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]); + int offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]); if (offset < 1) { return -1; } - new entity = TF2_GetResourceEntity(); + int entity = TF2_GetResourceEntity(); if (entity == -1) { @@ -440,21 +438,21 @@ stock TF2_GetPlayerResourceData(client, TFResourceType:type) * @error Invalid client index, client not in game or failed to find resource entity. */ #pragma deprecated Use GetPlayerResourceEntity and SetEntProp instead -stock bool:TF2_SetPlayerResourceData(client, TFResourceType:type, any:value) +stock bool TF2_SetPlayerResourceData(int client, TFResourceType type, any value) { if (!IsClientConnected(client)) { return false; } - new offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]); + int offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]); if (offset < 1) { return false; } - new entity = TF2_GetResourceEntity(); + int entity = TF2_GetResourceEntity(); if (entity == -1) { @@ -471,17 +469,16 @@ stock bool:TF2_SetPlayerResourceData(client, TFResourceType:type, any:value) * * @param client Player's index. * @param slot Slot index (0-5) - * @noreturn * @error Invalid client, invalid slot or lack of mod support */ -stock TF2_RemoveWeaponSlot(client, slot) +stock void TF2_RemoveWeaponSlot(int client, int slot) { - new weaponIndex; + int weaponIndex; while ((weaponIndex = GetPlayerWeaponSlot(client, slot)) != -1) { // bug #6206 // papering over a valve bug where a weapon's extra wearables aren't properly removed from the weapon's owner - new extraWearable = GetEntPropEnt(weaponIndex, Prop_Send, "m_hExtraWearable"); + int extraWearable = GetEntPropEnt(weaponIndex, Prop_Send, "m_hExtraWearable"); if (extraWearable != -1) { TF2_RemoveWearable(client, extraWearable); @@ -502,11 +499,10 @@ stock TF2_RemoveWeaponSlot(client, slot) * Removes all weapons from a client * * @param client Player's index. - * @noreturn */ -stock TF2_RemoveAllWeapons(client) +stock void TF2_RemoveAllWeapons(int client) { - for (new i = 0; i <= 5; i++) + for (int i = 0; i <= 5; i++) { TF2_RemoveWeaponSlot(client, i); } @@ -519,7 +515,7 @@ stock TF2_RemoveAllWeapons(client) * @return Player's condition bits */ #pragma deprecated Use TF2_IsPlayerInCondition instead. -stock TF2_GetPlayerConditionFlags(client) +stock int TF2_GetPlayerConditionFlags(int client) { return GetEntProp(client, Prop_Send, "m_nPlayerCond")|GetEntProp(client, Prop_Send, "_condition_bits"); } @@ -531,12 +527,12 @@ stock TF2_GetPlayerConditionFlags(client) * @param cond TFCond constant * @return True if set, false otherwise */ -stock bool:TF2_IsPlayerInCondition(client, TFCond:cond) +stock bool TF2_IsPlayerInCondition(int client, TFCond cond) { // Conditions are stored across two netprops now, one for each 32-bit segment. - if (_:cond < 32) + if (view_as(cond) < 32) { - new bit = 1 << _:cond; + int bit = 1 << view_as(cond); if ((GetEntProp(client, Prop_Send, "m_nPlayerCond") & bit) == bit) { return true; @@ -547,17 +543,17 @@ stock bool:TF2_IsPlayerInCondition(client, TFCond:cond) return true; } } - else if (_:cond < 64) + else if (view_as(cond) < 64) { - new bit = (1 << (_:cond - 32)); + int bit = (1 << (view_as(cond) - 32)); if ((GetEntProp(client, Prop_Send, "m_nPlayerCondEx") & bit) == bit) { return true; } } - else if (_:cond < 96) + else if (view_as(cond) < 96) { - new bit = (1 << (_:cond - 64)); + int bit = (1 << (view_as(cond) - 64)); if ((GetEntProp(client, Prop_Send, "m_nPlayerCondEx2") & bit) == bit) { return true; @@ -565,7 +561,7 @@ stock bool:TF2_IsPlayerInCondition(client, TFCond:cond) } else { - new bit = (1 << (_:cond - 96)); + int bit = (1 << (view_as(cond) - 96)); if ((GetEntProp(client, Prop_Send, "m_nPlayerCondEx3") & bit) == bit) { return true; @@ -582,16 +578,16 @@ stock bool:TF2_IsPlayerInCondition(client, TFCond:cond) * @return Current TFObjectType of entity. * @error Invalid entity index. */ -stock TFObjectType:TF2_GetObjectType(entity) +stock TFObjectType TF2_GetObjectType(int entity) { - new offset = GetEntSendPropOffs(entity, "m_iObjectType"); + int offset = GetEntSendPropOffs(entity, "m_iObjectType"); if (offset <= 0) { ThrowError("Entity index %d is not an object", entity); } - return TFObjectType:GetEntData(entity, offset); + return view_as(GetEntData(entity, offset)); } /** @@ -601,14 +597,14 @@ stock TFObjectType:TF2_GetObjectType(entity) * @return Current TFObjectMode of entity. * @error Invalid entity index. */ -stock TFObjectMode:TF2_GetObjectMode(entity) +stock TFObjectMode TF2_GetObjectMode(int entity) { - new offset = GetEntSendPropOffs(entity, "m_iObjectMode"); + int offset = GetEntSendPropOffs(entity, "m_iObjectMode"); if (offset <= 0) { ThrowError("Entity index %d is not an object", entity); } - return TFObjectMode:GetEntData(entity, offset); + return view_as(GetEntData(entity, offset)); }