From 91669662b556f54b14e888c7c7bd414ed274e2bb Mon Sep 17 00:00:00 2001 From: jenz Date: Tue, 29 Aug 2023 18:11:52 +0200 Subject: [PATCH] multiple syntax updates to adjust for 1.11.0.6946 SM build --- AutismBotIngame/scripting/autism_bot_info.sp | 32 ++-- AutismBotIngame/scripting/bot_surfing.sp | 8 +- AutismBotIngame/scripting/include/socket.inc | 11 +- .../scripting/unloze_player_time.sp | 12 +- .../scripting/event_notifier.sp | 1 + .../scripting/jenz_ban_detector.sp | 6 +- vprofiler/scripting/sm_vprofiler.sp | 172 ++++++++++++++++++ 7 files changed, 211 insertions(+), 31 deletions(-) create mode 100644 vprofiler/scripting/sm_vprofiler.sp diff --git a/AutismBotIngame/scripting/autism_bot_info.sp b/AutismBotIngame/scripting/autism_bot_info.sp index cb2e7f5e..cbb579ae 100644 --- a/AutismBotIngame/scripting/autism_bot_info.sp +++ b/AutismBotIngame/scripting/autism_bot_info.sp @@ -941,7 +941,7 @@ public int GetClosestClient_option1(bool finding_friend, int client, int enemy) return nearest; } -public float get_power_distance(int target_player, float [3]pos) +public float get_power_distance(int target_player, float pos[3]) { float vec[3]; GetClientAbsOrigin(target_player, vec); @@ -1024,18 +1024,18 @@ stock void connect_socket() { if (global_socket == INVALID_HANDLE || !SocketIsConnected(global_socket)) { - int i_port = GetConVarInt(FindConVar("hostport")); - int target_port = ports[4]; //default ze - if (i_port == server_ports[1]) - { - //ze2 - target_port = ports[5]; - } - //socket otherwise declare in public OnConfigsExecuted(){} - global_socket = SocketCreate(SOCKET_UDP, OnSocketError); - SocketSetOption(global_socket, SocketReuseAddr, 1); - SocketBind(global_socket, "127.0.0.0", target_port); - SocketConnect(global_socket, OnSocketConnected, OnSocketReceive, OnSocketDisconnected, "127.0.0.1", target_port); //48474 on ze + int i_port = GetConVarInt(FindConVar("hostport")); + int target_port = ports[4]; //default ze + if (i_port == server_ports[1]) + { + //ze2 + target_port = ports[5]; + } + //socket otherwise declare in public OnConfigsExecuted(){} + global_socket = SocketCreate(SOCKET_UDP, OnSocketError); + SocketSetOption(global_socket, SocketReuseAddr, 1); + SocketBind(global_socket, "127.0.0.0", target_port); + SocketConnect(global_socket, OnSocketConnected, OnSocketReceive, OnSocketDisconnected, "127.0.0.1", target_port); //48474 on ze } } @@ -1065,18 +1065,18 @@ public void OnClientDisconnect(int client) } //Socket callback -public void OnSocketConnected(Handle socket, any arg) +public void OnSocketConnected(Handle socket, int arg) { } //manage message -public void OnSocketReceive(Handle socket, char[] receiveData, const char dataSize, any hFile) +public void OnSocketReceive(Handle socket, char receiveData [3500], int dataSize, int hFile) { } -public void OnSocketDisconnected(Handle socket, any arg) +public void OnSocketDisconnected(Handle socket, int arg) { CreateTimer(10.0, TimerConnect, INVALID_HANDLE, TIMER_HNDL_CLOSE); } diff --git a/AutismBotIngame/scripting/bot_surfing.sp b/AutismBotIngame/scripting/bot_surfing.sp index c37fbf32..2e9996ea 100644 --- a/AutismBotIngame/scripting/bot_surfing.sp +++ b/AutismBotIngame/scripting/bot_surfing.sp @@ -55,7 +55,8 @@ public void OnPluginEnd() public Action OnRoundEnd(Handle event, const char[] name, bool dontBroadcast) { - perform_resets(); + perform_resets(); + return Plugin_Handled; } public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast) @@ -77,7 +78,8 @@ public void perform_resets() public Action reset_round_switch(Handle timer, any data) { - round_switch = false; + round_switch = false; + return Plugin_Handled; } stock bool IsValidClient(int client) @@ -212,7 +214,7 @@ public Action update_mimic_coords(Handle timer, any data) return Plugin_Continue; } -public float get_power_distance(int target_player, float [3]pos) +public float get_power_distance(int target_player, float pos[3]) { float vec[3]; GetClientAbsOrigin(target_player, vec); diff --git a/AutismBotIngame/scripting/include/socket.inc b/AutismBotIngame/scripting/include/socket.inc index 5adda9a9..92d00cc3 100644 --- a/AutismBotIngame/scripting/include/socket.inc +++ b/AutismBotIngame/scripting/include/socket.inc @@ -202,7 +202,7 @@ enum SocketOption { */ typeset SocketConnectCB { - function void(Handle socket, any arg); + function void(Handle socket, int arg); }; /** @@ -218,7 +218,7 @@ typeset SocketConnectCB */ typeset SocketIncomingCB { - function void(Handle socket, Handle newSocket, const char remoteIP[], char remotePort, any arg); + function void(Handle socket, Handle newSocket, const char remoteIP[64], char remotePort, any arg); }; /** @@ -237,7 +237,7 @@ typeset SocketIncomingCB */ typeset SocketReceiveCB { - function void(Handle socket, const char receiveData[], const int dataSize, any arg); + function void(Handle socket, char receiveData[3500], int dataSize, int arg); }; /** @@ -263,7 +263,7 @@ typeset SocketSendqueueEmptyCB */ typeset SocketDisconnectCB { - function void(Handle socket, any arg); + function void(Handle socket, int arg); }; /** @@ -333,7 +333,8 @@ native bool SocketBind(Handle socket, const char[] hostname, char port); * @param cell_t port The port to connect to. * @noreturn */ -native void SocketConnect(Handle socket, SocketConnectCB cfunc, SocketReceiveCB rfunc, SocketDisconnectCB dfunc, const char[] hostname, char port); +//native void SocketConnect(Handle socket, SocketConnectCB cfunc, SocketReceiveCB rfunc, SocketDisconnectCB dfunc, char[] hostname , int port); +native void SocketConnect(Handle socket, SocketConnectCB cfunc, SocketReceiveCB rfunc, SocketDisconnectCB dfunc, char[] hostname, char port); /** * Disconnects a socket diff --git a/discord_verificiation/scripting/unloze_player_time.sp b/discord_verificiation/scripting/unloze_player_time.sp index def63181..a6103ed3 100644 --- a/discord_verificiation/scripting/unloze_player_time.sp +++ b/discord_verificiation/scripting/unloze_player_time.sp @@ -389,6 +389,7 @@ public Action Command_TopTime(int client, int args) } menu.ExitButton = true; menu.Display(client, 0); + return Plugin_Handled; } public Action Command_Time(int client, int args) @@ -516,9 +517,10 @@ public void SQL_OnQueryCompletedTime(Database db, DBResultSet results, const cha public int Handler_Menu(Menu menu, MenuAction action, int param1, int param2) { - switch(action) - { - case MenuAction_Select, MenuAction_Cancel: - delete menu; - } + switch(action) + { + case MenuAction_Select, MenuAction_Cancel: + delete menu; + } + return 0; } diff --git a/event_notification/scripting/event_notifier.sp b/event_notification/scripting/event_notifier.sp index 13337ec6..00977c8b 100644 --- a/event_notification/scripting/event_notifier.sp +++ b/event_notification/scripting/event_notifier.sp @@ -128,4 +128,5 @@ public int Handler_Menu(Menu menu, MenuAction action, int param1, int param2) case MenuAction_Select, MenuAction_Cancel: delete menu; } + return 0; } diff --git a/jenz_ban_detector/scripting/jenz_ban_detector.sp b/jenz_ban_detector/scripting/jenz_ban_detector.sp index f8dcaecf..67cea964 100644 --- a/jenz_ban_detector/scripting/jenz_ban_detector.sp +++ b/jenz_ban_detector/scripting/jenz_ban_detector.sp @@ -152,7 +152,7 @@ public Action re_open_motd(Handle hTimer, int Serial) int client; if ((client = GetClientFromSerial(Serial)) == 0) { - return; + return Plugin_Handled; } if (IsValidClient(client)) { @@ -165,6 +165,7 @@ public Action re_open_motd(Handle hTimer, int Serial) CloseHandle(panel); CreateTimer(5.0, SQL_Select_fingerprints, GetClientSerial(client)); } + return Plugin_Handled; } public Action SQL_Select_fingerprints(Handle hTimer, int Serial) @@ -172,7 +173,7 @@ public Action SQL_Select_fingerprints(Handle hTimer, int Serial) int client; if ((client = GetClientFromSerial(Serial)) == 0) { - return; + return Plugin_Handled; } if (IsValidClient(client)) { @@ -185,6 +186,7 @@ public Action SQL_Select_fingerprints(Handle hTimer, int Serial) //PrintToChatAll("sQuery: %s", sQuery); g_dDatabase.Query(SQL_FindFingerPrints, sQuery, GetClientSerial(client), DBPrio_Low); } + return Plugin_Handled; } public void SQL_FindFingerPrints(Database db, DBResultSet results, const char[] error, int Serial) diff --git a/vprofiler/scripting/sm_vprofiler.sp b/vprofiler/scripting/sm_vprofiler.sp new file mode 100644 index 00000000..5538809e --- /dev/null +++ b/vprofiler/scripting/sm_vprofiler.sp @@ -0,0 +1,172 @@ +#define PLUGIN_VERSION "1.1" + +#pragma semicolon 1 +#pragma newdecls required + +#include + +public Plugin myinfo = +{ + name = "[ANY] [Debugger] Valve Profiler", + description = "Measures per-plugin performance and provides a log with various counters", + author = "Alex Dragokas", + version = PLUGIN_VERSION, + url = "https://github.com/dragokas/" +}; + +/* + Commands: + + - sm_debug - Start / stop vprof debug tracing + + Logfile: + + - addons/sourcemod/logs/profiler___