From fba9b23b3fb4f73b292cb0a527b52d43f433f84d Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Tue, 15 Nov 2016 23:17:53 -0700 Subject: [PATCH] Update include and example plugin to transitional syntax --- sourcetv_test.sp | 158 ++++++++++++++++++++++---------------------- sourcetvmanager.inc | 122 +++++++++++++++------------------- 2 files changed, 131 insertions(+), 149 deletions(-) diff --git a/sourcetv_test.sp b/sourcetv_test.sp index bf943c7..eb656de 100644 --- a/sourcetv_test.sp +++ b/sourcetv_test.sp @@ -1,7 +1,7 @@ //#undef REQUIRE_EXTENSIONS #include "sourcetvmanager" -public OnPluginStart() +public void OnPluginStart() { LoadTranslations("common.phrases"); @@ -39,17 +39,17 @@ public OnPluginStart() RegConsoleCmd("sm_spectitle", Cmd_SetTVTitle); } -public SourceTV_OnStartRecording(instance, const String:filename[]) +public void SourceTV_OnStartRecording(int instance, const char[] filename) { PrintToServer("Started recording sourcetv #%d demo to %s", instance, filename); } -public SourceTV_OnStopRecording(instance, const String:filename[], recordingtick) +public void SourceTV_OnStopRecording(int instance, const char[] filename, int recordingtick) { PrintToServer("Stopped recording sourcetv #%d demo to %s (%d ticks)", instance, filename, recordingtick); } -public bool:SourceTV_OnSpectatorPreConnect(const String:name[], String:password[255], const String:ip[], String:rejectReason[255]) +public bool SourceTV_OnSpectatorPreConnect(const char[] name, char password[255], const char[] ip, char rejectReason[255]) { PrintToServer("SourceTV spectator is connecting! Name: %s, pw: %s, ip: %s", name, password, ip); if (StrEqual(password, "nope", false)) @@ -60,54 +60,54 @@ public bool:SourceTV_OnSpectatorPreConnect(const String:name[], String:password[ return true; } -public SourceTV_OnServerStart(instance) +public void SourceTV_OnServerStart(int instance) { PrintToServer("SourceTV instance %d started.", instance); } -public SourceTV_OnServerShutdown(instance) +public void SourceTV_OnServerShutdown(int instance) { PrintToServer("SourceTV instance %d shutdown.", instance); } -public SourceTV_OnSpectatorConnected(client) +public void SourceTV_OnSpectatorConnected(int client) { PrintToServer("SourceTV client %d connected. (isconnected %d)", client, SourceTV_IsClientConnected(client)); } -public SourceTV_OnSpectatorPutInServer(client) +public void SourceTV_OnSpectatorPutInServer(int client) { PrintToServer("SourceTV client %d put in server.", client); } -public SourceTV_OnSpectatorDisconnect(client, String:reason[255]) +public void SourceTV_OnSpectatorDisconnect(int client, char reason[255]) { PrintToServer("SourceTV client %d is disconnecting (isconnected %d) with reason -> %s.", client, SourceTV_IsClientConnected(client), reason); } -public SourceTV_OnSpectatorDisconnected(client, const String:reason[255]) +public void SourceTV_OnSpectatorDisconnected(int client, const char reason[255]) { PrintToServer("SourceTV client %d disconnected (isconnected %d) with reason -> %s.", client, SourceTV_IsClientConnected(client), reason); } -public Action:SourceTV_OnSpectatorChatMessage(client, String:message[255], String:chatgroup[255]) +public Action SourceTV_OnSpectatorChatMessage(int client, char message[255], char chatgroup[255]) { PrintToServer("SourceTV client %d (chatgroup \"%s\") writes: %s", client, chatgroup, message); return Plugin_Continue; } -public SourceTV_OnSpectatorChatMessage_Post(client, const String:message[], const String:chatgroup[]) +public void SourceTV_OnSpectatorChatMessage_Post(int client, const char[] message, const char[] chatgroup) { PrintToServer("SourceTV client %d (chatgroup \"%s\") wrote: %s", client, chatgroup, message); } -public Action:Cmd_GetServerCount(client, args) +public Action Cmd_GetServerCount(int client, int args) { ReplyToCommand(client, "SourceTV server count: %d", SourceTV_GetServerInstanceCount()); return Plugin_Handled; } -public Action:Cmd_SelectServer(client, args) +public Action Cmd_SelectServer(int client, int args) { if (args < 1) { @@ -115,56 +115,56 @@ public Action:Cmd_SelectServer(client, args) return Plugin_Handled; } - new String:sArg[12]; + char sArg[12]; GetCmdArg(1, sArg, sizeof(sArg)); - new iInstance = StringToInt(sArg); + int iInstance = StringToInt(sArg); SourceTV_SelectServerInstance(iInstance); ReplyToCommand(client, "SourceTV selecting server: %d", iInstance); return Plugin_Handled; } -public Action:Cmd_GetSelectedServer(client, args) +public Action Cmd_GetSelectedServer(int client, int args) { ReplyToCommand(client, "SourceTV selected server: %d", SourceTV_GetSelectedServerInstance()); return Plugin_Handled; } -public Action:Cmd_IsMasterProxy(client, args) +public Action Cmd_IsMasterProxy(int client, int args) { ReplyToCommand(client, "SourceTV is master proxy: %d", SourceTV_IsMasterProxy()); return Plugin_Handled; } -public Action:Cmd_GetServerIP(client, args) +public Action Cmd_GetServerIP(int client, int args) { - new String:sIP[32]; - new bool:bSuccess = SourceTV_GetServerIP(sIP, sizeof(sIP)); + char sIP[32]; + bool bSuccess = SourceTV_GetServerIP(sIP, sizeof(sIP)); ReplyToCommand(client, "SourceTV server ip (ret %d): %s", bSuccess, sIP); return Plugin_Handled; } -public Action:Cmd_GetServerPort(client, args) +public Action Cmd_GetServerPort(int client, int args) { ReplyToCommand(client, "SourceTV server port: %d", SourceTV_GetServerPort()); return Plugin_Handled; } -public Action:Cmd_GetBotIndex(client, args) +public Action Cmd_GetBotIndex(int client, int args) { ReplyToCommand(client, "SourceTV bot index: %d", SourceTV_GetBotIndex()); return Plugin_Handled; } -public Action:Cmd_GetBroadcastTick(client, args) +public Action Cmd_GetBroadcastTick(int client, int args) { ReplyToCommand(client, "SourceTV broadcast tick: %d", SourceTV_GetBroadcastTick()); return Plugin_Handled; } -public Action:Cmd_Localstats(client, args) +public Action Cmd_Localstats(int client, int args) { - new proxies, slots, specs; + int proxies, slots, specs; if (!SourceTV_GetLocalStats(proxies, slots, specs)) { ReplyToCommand(client, "SourceTV local stats: no server selected :("); @@ -174,9 +174,9 @@ public Action:Cmd_Localstats(client, args) return Plugin_Handled; } -public Action:Cmd_Globalstats(client, args) +public Action Cmd_Globalstats(int client, int args) { - new proxies, slots, specs; + int proxies, slots, specs; if (!SourceTV_GetGlobalStats(proxies, slots, specs)) { ReplyToCommand(client, "SourceTV global stats: no server selected :("); @@ -186,17 +186,17 @@ public Action:Cmd_Globalstats(client, args) return Plugin_Handled; } -public Action:Cmd_GetDelay(client, args) +public Action Cmd_GetDelay(int client, int args) { ReplyToCommand(client, "SourceTV delay: %f", SourceTV_GetDelay()); return Plugin_Handled; } -public Action:Cmd_Spectators(client, args) +public Action Cmd_Spectators(int client, int args) { ReplyToCommand(client, "SourceTV spectator count: %d/%d", SourceTV_GetSpectatorCount(), SourceTV_GetClientCount()); - new String:sName[64], String:sIP[16], String:sPassword[256]; - for (new i=1;i<=SourceTV_GetClientCount();i++) + char sName[64], sIP[16], sPassword[256]; + for (int i=1;i<=SourceTV_GetClientCount();i++) { if (!SourceTV_IsClientConnected(i)) continue; @@ -209,7 +209,7 @@ public Action:Cmd_Spectators(client, args) return Plugin_Handled; } -public Action:Cmd_SendHintMessage(client, args) +public Action Cmd_SendHintMessage(int client, int args) { if (args < 1) { @@ -217,16 +217,16 @@ public Action:Cmd_SendHintMessage(client, args) return Plugin_Handled; } - new String:sMsg[1024]; + char sMsg[1024]; GetCmdArgString(sMsg, sizeof(sMsg)); StripQuotes(sMsg); - new bool:bSent = SourceTV_BroadcastScreenMessage(BTarget_Everyone, "%s", sMsg); + bool bSent = SourceTV_BroadcastScreenMessage(BTarget_Everyone, "%s", sMsg); ReplyToCommand(client, "SourceTV sending hint message (success %d): %s", bSent, sMsg); return Plugin_Handled; } -public Action:Cmd_SendMessage(client, args) +public Action Cmd_SendMessage(int client, int args) { if (args < 1) { @@ -234,16 +234,16 @@ public Action:Cmd_SendMessage(client, args) return Plugin_Handled; } - new String:sMsg[1024]; + char sMsg[1024]; GetCmdArgString(sMsg, sizeof(sMsg)); StripQuotes(sMsg); - new bool:bSent = SourceTV_BroadcastConsoleMessage("%s", sMsg); + bool bSent = SourceTV_BroadcastConsoleMessage("%s", sMsg); ReplyToCommand(client, "SourceTV sending console message (success %d): %s", bSent, sMsg); return Plugin_Handled; } -public Action:Cmd_SendChatMessage(client, args) +public Action Cmd_SendChatMessage(int client, int args) { if (args < 1) { @@ -251,16 +251,16 @@ public Action:Cmd_SendChatMessage(client, args) return Plugin_Handled; } - new String:sMsg[128]; + char sMsg[128]; GetCmdArgString(sMsg, sizeof(sMsg)); StripQuotes(sMsg); - new bool:bSent = SourceTV_BroadcastChatMessage(BTarget_Everyone, "%s", sMsg); + bool bSent = SourceTV_BroadcastChatMessage(BTarget_Everyone, "%s", sMsg); ReplyToCommand(client, "SourceTV sending chat message to all spectators (including relays) (success %d): %s", bSent, sMsg); return Plugin_Handled; } -public Action:Cmd_SendChatMessageLocal(client, args) +public Action Cmd_SendChatMessageLocal(int client, int args) { if (args < 1) { @@ -268,30 +268,30 @@ public Action:Cmd_SendChatMessageLocal(client, args) return Plugin_Handled; } - new String:sMsg[128]; + char sMsg[128]; GetCmdArgString(sMsg, sizeof(sMsg)); StripQuotes(sMsg); - new bool:bSent = SourceTV_BroadcastChatMessage(BTarget_OnlyLocal, "%s", sMsg); + bool bSent = SourceTV_BroadcastChatMessage(BTarget_OnlyLocal, "%s", sMsg); ReplyToCommand(client, "SourceTV sending chat message to local spectators (success %d): %s", bSent, sMsg); return Plugin_Handled; } -public Action:Cmd_GetViewEntity(client, args) +public Action Cmd_GetViewEntity(int client, int args) { ReplyToCommand(client, "SourceTV view entity: %d", SourceTV_GetViewEntity()); return Plugin_Handled; } -public Action:Cmd_GetViewOrigin(client, args) +public Action Cmd_GetViewOrigin(int client, int args) { - new Float:pos[3]; + float pos[3]; SourceTV_GetViewOrigin(pos); ReplyToCommand(client, "SourceTV view origin: %f %f %f", pos[0], pos[1], pos[2]); return Plugin_Handled; } -public Action:Cmd_ForceChaseCameraShot(client, args) +public Action Cmd_ForceChaseCameraShot(int client, int args) { if (args < 1) { @@ -299,17 +299,17 @@ public Action:Cmd_ForceChaseCameraShot(client, args) return Plugin_Handled; } - new String:sTarget[PLATFORM_MAX_PATH]; + char sTarget[PLATFORM_MAX_PATH]; GetCmdArg(1, sTarget, sizeof(sTarget)); StripQuotes(sTarget); - new iTarget = FindTarget(client, sTarget, false, false); + int iTarget = FindTarget(client, sTarget, false, false); if (iTarget == -1) return Plugin_Handled; - new bool:bInEye; + bool bInEye; if (args >= 2) { - new String:sInEye[16]; + char sInEye[16]; GetCmdArg(2, sInEye, sizeof(sInEye)); StripQuotes(sInEye); bInEye = sInEye[0] == '1'; @@ -320,7 +320,7 @@ public Action:Cmd_ForceChaseCameraShot(client, args) return Plugin_Handled; } -public Action:Cmd_StartRecording(client, args) +public Action Cmd_StartRecording(int client, int args) { if (args < 1) { @@ -328,7 +328,7 @@ public Action:Cmd_StartRecording(client, args) return Plugin_Handled; } - new String:sFilename[PLATFORM_MAX_PATH]; + char sFilename[PLATFORM_MAX_PATH]; GetCmdArgString(sFilename, sizeof(sFilename)); StripQuotes(sFilename); @@ -342,34 +342,34 @@ public Action:Cmd_StartRecording(client, args) return Plugin_Handled; } -public Action:Cmd_StopRecording(client, args) +public Action Cmd_StopRecording(int client, int args) { ReplyToCommand(client, "SourceTV stopped recording %d", SourceTV_StopRecording()); return Plugin_Handled; } -public Action:Cmd_IsRecording(client, args) +public Action Cmd_IsRecording(int client, int args) { ReplyToCommand(client, "SourceTV is recording: %d", SourceTV_IsRecording()); return Plugin_Handled; } -public Action:Cmd_GetDemoFileName(client, args) +public Action Cmd_GetDemoFileName(int client, int args) { - new String:sFileName[PLATFORM_MAX_PATH]; + char sFileName[PLATFORM_MAX_PATH]; ReplyToCommand(client, "SourceTV demo file name (%d): %s", SourceTV_GetDemoFileName(sFileName, sizeof(sFileName)), sFileName); return Plugin_Handled; } -public Action:Cmd_GetRecordTick(client, args) +public Action Cmd_GetRecordTick(int client, int args) { ReplyToCommand(client, "SourceTV recording tick: %d", SourceTV_GetRecordingTick()); return Plugin_Handled; } -public Action:Cmd_SpecStatus(client, args) +public Action Cmd_SpecStatus(int client, int args) { - new iSourceTV = SourceTV_GetBotIndex(); + int iSourceTV = SourceTV_GetBotIndex(); if (!iSourceTV) return Plugin_Handled; FakeClientCommand(iSourceTV, "status"); @@ -377,7 +377,7 @@ public Action:Cmd_SpecStatus(client, args) return Plugin_Handled; } -public Action:Cmd_PrintDemoConsole(client, args) +public Action Cmd_PrintDemoConsole(int client, int args) { if (args < 1) { @@ -385,16 +385,16 @@ public Action:Cmd_PrintDemoConsole(client, args) return Plugin_Handled; } - new String:sMsg[1024]; + char sMsg[1024]; GetCmdArgString(sMsg, sizeof(sMsg)); StripQuotes(sMsg); - new bool:bSent = SourceTV_PrintToDemoConsole("%s", sMsg); + bool bSent = SourceTV_PrintToDemoConsole("%s", sMsg); ReplyToCommand(client, "SourceTV printing to demo console (success %d): %s", bSent, sMsg); return Plugin_Handled; } -public Action:Cmd_ExecuteStringCommand(client, args) +public Action Cmd_ExecuteStringCommand(int client, int args) { if (args < 1) { @@ -402,11 +402,11 @@ public Action:Cmd_ExecuteStringCommand(client, args) return Plugin_Handled; } - new String:sCmd[1024]; + char sCmd[1024]; GetCmdArgString(sCmd, sizeof(sCmd)); StripQuotes(sCmd); - new iSourceTV = SourceTV_GetBotIndex(); + int iSourceTV = SourceTV_GetBotIndex(); if (!iSourceTV) return Plugin_Handled; FakeClientCommand(iSourceTV, sCmd); @@ -414,7 +414,7 @@ public Action:Cmd_ExecuteStringCommand(client, args) return Plugin_Handled; } -public Action:Cmd_KickClient(client, args) +public Action Cmd_KickClient(int client, int args) { if (args < 2) { @@ -422,19 +422,19 @@ public Action:Cmd_KickClient(client, args) return Plugin_Handled; } - new String:sIndex[16], String:sMsg[1024]; + char sIndex[16], sMsg[1024]; GetCmdArg(1, sIndex, sizeof(sIndex)); StripQuotes(sIndex); GetCmdArg(2, sMsg, sizeof(sMsg)); StripQuotes(sMsg); - new iTarget = StringToInt(sIndex); + int iTarget = StringToInt(sIndex); SourceTV_KickClient(iTarget, sMsg); ReplyToCommand(client, "SourceTV kicking spectator %d with reason %s", iTarget, sMsg); return Plugin_Handled; } -public Action:Cmd_PrintToChat(client, args) +public Action Cmd_PrintToChat(int client, int args) { if (args < 2) { @@ -442,19 +442,19 @@ public Action:Cmd_PrintToChat(client, args) return Plugin_Handled; } - new String:sIndex[16], String:sMsg[1024]; + char sIndex[16], sMsg[1024]; GetCmdArg(1, sIndex, sizeof(sIndex)); StripQuotes(sIndex); GetCmdArg(2, sMsg, sizeof(sMsg)); StripQuotes(sMsg); - new iTarget = StringToInt(sIndex); + int iTarget = StringToInt(sIndex); SourceTV_PrintToChat(iTarget, "%s", sMsg); ReplyToCommand(client, "SourceTV sending chat message to spectator %d: %s", iTarget, sMsg); return Plugin_Handled; } -public Action:Cmd_PrintToConsole(client, args) +public Action Cmd_PrintToConsole(int client, int args) { if (args < 2) { @@ -462,19 +462,19 @@ public Action:Cmd_PrintToConsole(client, args) return Plugin_Handled; } - new String:sIndex[16], String:sMsg[1024]; + char sIndex[16], sMsg[1024]; GetCmdArg(1, sIndex, sizeof(sIndex)); StripQuotes(sIndex); GetCmdArg(2, sMsg, sizeof(sMsg)); StripQuotes(sMsg); - new iTarget = StringToInt(sIndex); + int iTarget = StringToInt(sIndex); SourceTV_PrintToConsole(iTarget, "%s", sMsg); ReplyToCommand(client, "SourceTV sending console message to spectator %d: %s", iTarget, sMsg); return Plugin_Handled; } -public Action:Cmd_SetTVTitle(client, args) +public Action Cmd_SetTVTitle(int client, int args) { if (args < 2) { @@ -482,13 +482,13 @@ public Action:Cmd_SetTVTitle(client, args) return Plugin_Handled; } - new String:sIndex[16], String:sMsg[1024]; + char sIndex[16], sMsg[1024]; GetCmdArg(1, sIndex, sizeof(sIndex)); StripQuotes(sIndex); GetCmdArg(2, sMsg, sizeof(sMsg)); StripQuotes(sMsg); - new iTarget = StringToInt(sIndex); + int iTarget = StringToInt(sIndex); SourceTV_SetClientTVTitle(iTarget, "%s", sMsg); ReplyToCommand(client, "SourceTV set stream title of spectator %d to %s", iTarget, sMsg); return Plugin_Handled; diff --git a/sourcetvmanager.inc b/sourcetvmanager.inc index 57dd556..a04db4e 100644 --- a/sourcetvmanager.inc +++ b/sourcetvmanager.inc @@ -21,7 +21,7 @@ enum SourceTVBroadcastTarget { * * @return SourceTV instance number count. */ -native SourceTV_GetServerInstanceCount(); +native int SourceTV_GetServerInstanceCount(); /** * Select a SourceTV instance to operate the rest of the natives on. @@ -30,47 +30,44 @@ native SourceTV_GetServerInstanceCount(); * which can have 2 instances running. * * @param instance The SourceTV instance number. - * @noreturn * @error Invalid SourceTV instance number. */ -native SourceTV_SelectServerInstance(instance); +native void SourceTV_SelectServerInstance(int instance); /** * Get the index of the currently selected SourceTV server instance. * * @return Index of the selected SourceTV instance number or -1 if no SourceTV enabled. */ -native SourceTV_GetSelectedServerInstance(); +native int SourceTV_GetSelectedServerInstance(); /** * Called when a SourceTV is initialized. * * @param instance The SourceTV instance number. - * @noreturn */ -forward SourceTV_OnServerStart(instance); +forward void SourceTV_OnServerStart(int instance); /** * Called when a SourceTV server instance is shutdown. * * @param instance The SourceTV instance number. - * @noreturn */ -forward SourceTV_OnServerShutdown(instance); +forward void SourceTV_OnServerShutdown(int instance); /** * Returns whether this SourceTV instance is currently broadcasting. * * @return True if SourceTV instance is broadcasting, false otherwise. */ -native bool:SourceTV_IsActive(); +native bool SourceTV_IsActive(); /** * Returns whether this SourceTV instance is a master proxy or relay. * * @return True if SourceTV instance is master proxy, false otherwise. */ -native bool:SourceTV_IsMasterProxy(); +native bool SourceTV_IsMasterProxy(); /** * Get the local ip of the SourceTV server. @@ -79,7 +76,7 @@ native bool:SourceTV_IsMasterProxy(); * @param maxlen Maximum length of the buffer. * @return True if IP written, false otherwise. */ -native bool:SourceTV_GetServerIP(String:ip[], maxlen); +native bool SourceTV_GetServerIP(char[] ip, int maxlen); /** * Get the UDP port of the SourceTV server. @@ -87,14 +84,14 @@ native bool:SourceTV_GetServerIP(String:ip[], maxlen); * * @return SourceTV server UDP port. */ -native SourceTV_GetServerPort(); +native int SourceTV_GetServerPort(); /** * Get the client index of the SourceTV bot. * * @return Client index of SourceTV bot. */ -native SourceTV_GetBotIndex(); +native int SourceTV_GetBotIndex(); /** * Get stats of the local SourceTV instance. @@ -107,9 +104,9 @@ native SourceTV_GetBotIndex(); * @param proxies Number of SourceTV proxies connected to this server. * @param slots Number of maximal available SourceTV spectator slots. * @param specs Number of currently connected SourceTV spectators. - * @noreturn + * @return True if stats were retrieved, false otherwise. */ -native bool:SourceTV_GetLocalStats(&proxies, &slots, &specs); +native bool SourceTV_GetLocalStats(int &proxies, int &slots, int &specs); /** * Get stats of this SourceTV network. @@ -123,9 +120,9 @@ native bool:SourceTV_GetLocalStats(&proxies, &slots, &specs); * @param proxies Number of SourceTV proxies connected to all servers. * @param slots Number of maximal available SourceTV spectator slots on all servers. * @param specs Number of currently connected SourceTV spectators on all servers. - * @noreturn + * @return True if stats were retrieved, false otherwise. */ -native bool:SourceTV_GetGlobalStats(&proxies, &slots, &specs); +native bool SourceTV_GetGlobalStats(int &proxies, int &slots, int &specs); /** * Current broadcasted tick. Can be lower than the actual server tick, @@ -133,14 +130,14 @@ native bool:SourceTV_GetGlobalStats(&proxies, &slots, &specs); * * @return Current broadcast tick from director. */ -native SourceTV_GetBroadcastTick(); +native int SourceTV_GetBroadcastTick(); /** * Returns current delay in seconds. (tv_delay) * * @return Current delay in seconds. */ -native Float:SourceTV_GetDelay(); +native float SourceTV_GetDelay(); /** * Print a center message to all SourceTV spectators for ~2 seconds. @@ -151,7 +148,7 @@ native Float:SourceTV_GetDelay(); * @param ... Variable number of format string arguments. * @return True if message was sent, false otherwise. */ -native bool:SourceTV_BroadcastScreenMessage(SourceTVBroadcastTarget:target, const String:format[], any:...); +native bool SourceTV_BroadcastScreenMessage(SourceTVBroadcastTarget target, const char[] format, any ...); /** * Prints text to the console of all connected SourceTV spectators. @@ -160,7 +157,7 @@ native bool:SourceTV_BroadcastScreenMessage(SourceTVBroadcastTarget:target, cons * @param ... Variable number of format string arguments. * @return True if message was sent, false otherwise. */ -native bool:SourceTV_BroadcastConsoleMessage(const String:format[], any:...); +native bool SourceTV_BroadcastConsoleMessage(const char[] format, any ...); /** * Print a chat message to all SourceTV spectators. @@ -170,7 +167,7 @@ native bool:SourceTV_BroadcastConsoleMessage(const String:format[], any:...); * @param ... Variable number of format string arguments. * @return True if message was sent, false otherwise. */ -native bool:SourceTV_BroadcastChatMessage(SourceTVBroadcastTarget:target, const String:format[], any:...); +native bool SourceTV_BroadcastChatMessage(SourceTVBroadcastTarget target, const char[] format, any ...); /******************************************************************************** @@ -184,15 +181,14 @@ native bool:SourceTV_BroadcastChatMessage(SourceTVBroadcastTarget:target, const * * @return Current view entity index, 0 if coords are used. */ -native SourceTV_GetViewEntity(); +native int SourceTV_GetViewEntity(); /** * Get origin of current view point if view entity is 0. * * @param view Vector to store view position in. - * @noreturn */ -native SourceTV_GetViewOrigin(Float:view[3]); +native void SourceTV_GetViewOrigin(float view[3]); /** * Force the auto director to show a certain camera angle. @@ -205,7 +201,7 @@ native SourceTV_GetViewOrigin(Float:view[3]); * @return True if shot was created, false otherwise. * @error Invalid target entity. */ -native bool:SourceTV_ForceFixedCameraShot(Float:pos[], Float:angle[], iTarget, Float:fov, Float:fDuration = DEF_SHOT_LENGTH); +native bool SourceTV_ForceFixedCameraShot(float[] pos, float[] angle, int iTarget, float fov, float fDuration = DEF_SHOT_LENGTH); /** * Force the auto director to show a player. @@ -220,7 +216,7 @@ native bool:SourceTV_ForceFixedCameraShot(Float:pos[], Float:angle[], iTarget, F * @return True if shot was created, false otherwise. * @error Invalid target1 or target2 entity */ -native bool:SourceTV_ForceChaseCameraShot(iTarget1, iTarget2, distance, phi, theta, bool:bInEye, Float:fDuration = DEF_SHOT_LENGTH); +native bool SourceTV_ForceChaseCameraShot(int iTarget1, int iTarget2, int distance, int phi, int theta, bool bInEye, float fDuration = DEF_SHOT_LENGTH); @@ -236,21 +232,21 @@ native bool:SourceTV_ForceChaseCameraShot(iTarget1, iTarget2, distance, phi, the * @param sFilename Filename of the demo file. * @return True if recording started, false otherwise. */ -native bool:SourceTV_StartRecording(const String:sFilename[]); +native bool SourceTV_StartRecording(const char[] sFilename); /** * Stops recording a SourceTV demo. * * @return True if recording stopped, false otherwise. */ -native bool:SourceTV_StopRecording(); +native bool SourceTV_StopRecording(); /** * Returns whether the SourceTV server is currently recording a demo. * * @return True if currently recording a SourceTV demo, false otherwise. */ -native bool:SourceTV_IsRecording(); +native bool SourceTV_IsRecording(); /** * Get the filename of the currently recorded demo. @@ -259,14 +255,14 @@ native bool:SourceTV_IsRecording(); * @param maxlen Maximal length of the buffer. * @return True if filename was written, false otherwise. */ -native bool:SourceTV_GetDemoFileName(String:sFilename[], maxlen); +native bool SourceTV_GetDemoFileName(char[] sFilename, int maxlen); /** * Get current tick in the demofile. * * @return Current recording tick in the demofle. */ -native SourceTV_GetRecordingTick(); +native int SourceTV_GetRecordingTick(); /** * Print text to the demo console. @@ -277,7 +273,7 @@ native SourceTV_GetRecordingTick(); * * @return True if message was printed, false otherwise. */ -native bool:SourceTV_PrintToDemoConsole(const String:format[], any:...); +native bool SourceTV_PrintToDemoConsole(const char[] format, any ...); /** * Called when a SourceTV demo starts being recorded. @@ -285,9 +281,8 @@ native bool:SourceTV_PrintToDemoConsole(const String:format[], any:...); * * @param instance The SourceTV instance of server recording. * @param filename The filename of the demo. - * @noreturn */ -forward SourceTV_OnStartRecording(instance, const String:filename[]); +forward void SourceTV_OnStartRecording(int instance, const char[] filename); /** * Called when a SourceTV demo stops being recorded. @@ -296,9 +291,8 @@ forward SourceTV_OnStartRecording(instance, const String:filename[]); * @param instance The SourceTV instance of server recording. * @param filename The filename of the demo. * @param recordingtick The tick length of the demo. - * @noreturn */ -forward SourceTV_OnStopRecording(instance, const String:filename[], recordingtick); +forward void SourceTV_OnStopRecording(int instance, const char[] filename, int recordingtick); @@ -312,14 +306,14 @@ forward SourceTV_OnStopRecording(instance, const String:filename[], recordingtic * * @return SourceTV spectator count. */ -native SourceTV_GetSpectatorCount(); +native int SourceTV_GetSpectatorCount(); /** * Get the current client limit. * * @return Maximal possible spectator count. */ -native SourceTV_GetMaxClients(); +native int SourceTV_GetMaxClients(); /** * Get number of client slots (used & unused) @@ -328,7 +322,7 @@ native SourceTV_GetMaxClients(); * * @return Number of client slots (used & unused) */ -native SourceTV_GetClientCount(); +native int SourceTV_GetClientCount(); /** * Returns if the spectator is connected. @@ -337,7 +331,7 @@ native SourceTV_GetClientCount(); * @return True if client is connected, false otherwise. * @error Invalid client index. */ -native bool:SourceTV_IsClientConnected(client); +native bool SourceTV_IsClientConnected(int client); /** * Returns if the spectator is a relay proxy. @@ -346,7 +340,7 @@ native bool:SourceTV_IsClientConnected(client); * @return True if client is a proxy, false otherwise. * @error Invalid client index. */ -native bool:SourceTV_IsClientProxy(client); +native bool SourceTV_IsClientProxy(int client); /** * Get the name of a SourceTV spectator client. @@ -354,10 +348,9 @@ native bool:SourceTV_IsClientProxy(client); * @param client The spectator client index. * @param name Buffer for the client name. * @param maxlen Maximal length of the buffer. - * @noreturn * @error Invalid client index or not connected. */ -native SourceTV_GetClientName(client, String:name[], maxlen); +native void SourceTV_GetClientName(int client, char[] name, int maxlen); /** * Get the IP of a SourceTV spectator client. @@ -365,10 +358,9 @@ native SourceTV_GetClientName(client, String:name[], maxlen); * @param client The spectator client index. * @param name Buffer for the client ip. * @param maxlen Maximal length of the buffer. - * @noreturn * @error Invalid client index or not connected. */ -native SourceTV_GetClientIP(client, String:ip[], maxlen); +native void SourceTV_GetClientIP(int client, char[] ip, int maxlen); /** * Get the password of a SourceTV spectator client. @@ -378,20 +370,18 @@ native SourceTV_GetClientIP(client, String:ip[], maxlen); * @param client The spectator client index. * @param name Buffer for the client ip. * @param maxlen Maximal length of the buffer. - * @noreturn * @error Invalid client index or not connected. */ -native SourceTV_GetClientPassword(client, String:password[], maxlen); +native void SourceTV_GetClientPassword(int client, char[] password, int maxlen); /** * Kick a SourceTV spectator client. * * @param client The spectator client index. * @param sReason The kick reason. - * @noreturn * @error Invalid client index or not connected. */ -native SourceTV_KickClient(client, const String:sReason[]); +native void SourceTV_KickClient(int client, const char[] sReason); /** * Print a message to a single client's chat. @@ -399,10 +389,9 @@ native SourceTV_KickClient(client, const String:sReason[]); * @param client The spectator client index. * @param format The format string. * @param ... Variable number of format string arguments. - * @noreturn * @error Invalid client index or not connected. */ -native SourceTV_PrintToChat(client, const String:format[], any:...); +native void SourceTV_PrintToChat(int client, const char[] format, any ...); /** * Print a message to a single client's console. @@ -410,10 +399,9 @@ native SourceTV_PrintToChat(client, const String:format[], any:...); * @param client The spectator client index. * @param format The format string. * @param ... Variable number of format string arguments. - * @noreturn * @error Invalid client index or not connected. */ -native SourceTV_PrintToConsole(client, const String:format[], any:...); +native void SourceTV_PrintToConsole(int client, const char[] format, any ...); /** * Change the stream title only for one spectator. @@ -423,10 +411,9 @@ native SourceTV_PrintToConsole(client, const String:format[], any:...); * @param client The spectator client index. * @param format The format string. * @param ... Variable number of format string arguments. - * @noreturn * @error Invalid client index or not connected. */ -native SourceTV_SetClientTVTitle(client, const String:format[], any:...); +native void SourceTV_SetClientTVTitle(int client, const char[] format, any ...); /** * Called when a spectator wants to connect to the SourceTV server. @@ -439,41 +426,37 @@ native SourceTV_SetClientTVTitle(client, const String:format[], any:...); * @param rejectReason Buffer to write the reject reason to, if you want to reject the client from connecting. * @return True to allow the client to connect, false to reject him with the given reason. */ -forward bool:SourceTV_OnSpectatorPreConnect(const String:name[], String:password[255], const String:ip[], String:rejectReason[255]); +forward bool SourceTV_OnSpectatorPreConnect(const char[] name, char password[255], const char[] ip, char rejectReason[255]); /** * Called when a spectator client connected to the SourceTV server. * * @param client The spectator client index. - * @noreturn */ -forward SourceTV_OnSpectatorConnected(client); +forward void SourceTV_OnSpectatorConnected(int client); /** * Called when a spectator client is about to disconnect. * * @param client The spectator client index. * @param reason The reason for the disconnect. Can be overwritten. - * @noreturn */ -forward SourceTV_OnSpectatorDisconnect(client, String:reason[255]); +forward void SourceTV_OnSpectatorDisconnect(int client, char reason[255]); /** * Called after a spectator client disconnected. * * @param client The spectator client index. * @param reason The reason for the disconnect. - * @noreturn */ -forward SourceTV_OnSpectatorDisconnected(client, const String:reason[255]); +forward void SourceTV_OnSpectatorDisconnected(int client, const char reason[255]); /** * Called when a spectator client is entering the game. * * @param client The spectator client index. - * @noreturn */ -forward SourceTV_OnSpectatorPutInServer(client); +forward void SourceTV_OnSpectatorPutInServer(int client); /** * Called before a spectator's chat message is sent. @@ -485,7 +468,7 @@ forward SourceTV_OnSpectatorPutInServer(client); * @param chatgroup The chatgroup this message is sent to (tv_chatgroup). * @return >= Plugin_Handled to block the message, Plugin_Continue to let it through. */ -forward Action:SourceTV_OnSpectatorChatMessage(client, String:message[255], String:chatgroup[255]); +forward Action SourceTV_OnSpectatorChatMessage(int client, char message[255], char chatgroup[255]); /** * Called after a spectator wrote a chat message. @@ -494,14 +477,13 @@ forward Action:SourceTV_OnSpectatorChatMessage(client, String:message[255], Stri * @param client The spectator client index. * @param message The message the client typed. * @param chatgroup The chatgroup this message is sent to (tv_chatgroup). - * @noreturn */ -forward SourceTV_OnSpectatorChatMessage_Post(client, const String:message[], const String:chatgroup[]); +forward void SourceTV_OnSpectatorChatMessage_Post(int client, const char[] message, const char[] chatgroup); /** * Do not edit below this line! */ -public Extension:__ext_stvmngr = +public Extension __ext_stvmngr = { name = "SourceTV Manager", file = "sourcetvmanager.ext", @@ -518,7 +500,7 @@ public Extension:__ext_stvmngr = }; #if !defined REQUIRE_EXTENSIONS -public __ext_stvmngr_SetNTVOptional() +public void __ext_stvmngr_SetNTVOptional() { MarkNativeAsOptional("SourceTV_GetServerInstanceCount"); MarkNativeAsOptional("SourceTV_SelectServerInstance");