Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

Fix a lot of missing and outdated stuff #135

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.vscode/

addons/sourcemod/scripting/surftimer-api.sp
addons/sourcemod/scripting/surftimer-api.smx
addons/sourcemod/scripting/surftimer-api.smx
addons/sourcemod/scripting/compile.dat
addons/sourcemod/scripting/include/compile.dat
addons/sourcemod/scripting/compiled/*
Binary file added addons/sourcemod/extensions/SteamWorks.ext.so
Binary file not shown.
Binary file modified addons/sourcemod/extensions/dhooks.ext.dll
Binary file not shown.
Binary file added addons/sourcemod/extensions/socket.ext.dll
Binary file not shown.
Binary file added addons/sourcemod/extensions/socket.ext.so
Binary file not shown.
22 changes: 11 additions & 11 deletions addons/sourcemod/gamedata/dhooks-test.games.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@
}
"GetMaxs"
{
"windows" "338"
"linux" "339"
"windows" "339"
"linux" "340"
}
"CanUse"
{
"windows" "259"
"linux" "260"
"windows" "260"
"linux" "261"
}
"CanHaveAmmo"
{
"windows" "97"
"linux" "97"
"windows" "98"
"linux" "98"
}
"SetModel"
{
Expand All @@ -49,13 +49,13 @@
}
"GetMaxPlayerSpeed"
{
"windows" "437"
"linux" "438"
"windows" "438"
"linux" "439"
}
"GiveAmmo"
{
"windows" "251"
"linux" "252"
"windows" "252"
"linux" "253"
}
"OnTakeDamage"
{
Expand All @@ -74,4 +74,4 @@
}
}
}
}
}
Binary file added addons/sourcemod/plugins/ckSurf-telefinder.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/discord_api.smx
Binary file not shown.
Binary file added addons/sourcemod/plugins/nextmap.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/surftimer.smx
Binary file not shown.
10 changes: 5 additions & 5 deletions addons/sourcemod/scripting/SurfTimer.sp
Original file line number Diff line number Diff line change
Expand Up @@ -1701,7 +1701,7 @@ public void OnMapStart()
CreateTimer(1.0, CKTimer2, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE | TIMER_REPEAT);
CreateTimer(60.0, AttackTimer, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE | TIMER_REPEAT);
CreateTimer(600.0, PlayerRanksTimer, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE | TIMER_REPEAT);
g_hZoneTimer = CreateTimer(GetConVarFloat(g_hChecker), BeamBoxAll, _, TIMER_REPEAT);
g_hZoneTimer = CreateTimer(GetConVarFloat(g_hChecker), BeamBoxAll, _, TIMER_FLAG_NO_MAPCHANGE | TIMER_REPEAT);

// AutoBhop
if (GetConVarBool(g_hAutoBhopConVar))
Expand Down Expand Up @@ -2663,7 +2663,7 @@ public void OnSettingChanged(Handle convar, const char[] oldValue, const char[]
g_hZoneTimer = INVALID_HANDLE;
}

g_hZoneTimer = CreateTimer(GetConVarFloat(g_hChecker), BeamBoxAll, _, TIMER_REPEAT);
g_hZoneTimer = CreateTimer(GetConVarFloat(g_hChecker), BeamBoxAll, _, TIMER_FLAG_NO_MAPCHANGE | TIMER_REPEAT);
}

public void OnPluginStart()
Expand Down Expand Up @@ -2938,8 +2938,8 @@ public int Native_GetMapStages(Handle plugin, int numParams)
return stages;
}

public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max){

RegPluginLibrary("surftimer");
CreateNative("surftimer_GetTimerStatus", Native_GetTimerStatus);
CreateNative("surftimer_StopTimer", Native_StopTimer);
Expand All @@ -2958,7 +2958,7 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
CreateNative("surftimer_IsClientVip", Native_IsClientVip);
MarkNativeAsOptional("Store_GetClientCredits");
MarkNativeAsOptional("Store_SetClientCredits");
g_bLateLoaded = late;
/* g_bLateLoaded = late;*/
return APLRes_Success;
}

Expand Down
99 changes: 0 additions & 99 deletions addons/sourcemod/scripting/ckSurf-telefinder.sp

This file was deleted.

94 changes: 94 additions & 0 deletions addons/sourcemod/scripting/discord/DiscordRequest.sp
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
stock Handle PrepareRequest(DiscordBot bot, char[] url, EHTTPMethod method=k_EHTTPMethodGET, Handle hJson=null, SteamWorksHTTPDataReceived DataReceived = INVALID_FUNCTION, SteamWorksHTTPRequestCompleted RequestCompleted = INVALID_FUNCTION) {
static char stringJson[16384];
stringJson[0] = '\0';
if(hJson != null) {
json_dump(hJson, stringJson, sizeof(stringJson), 0, true);
}

//Format url
static char turl[128];
FormatEx(turl, sizeof(turl), "https://discordapp.com/api/%s", url);

Handle request = SteamWorks_CreateHTTPRequest(method, turl);
if(request == null) {
return null;
}

if(bot != null) {
BuildAuthHeader(request, bot);
}

SteamWorks_SetHTTPRequestRawPostBody(request, "application/json; charset=UTF-8", stringJson, strlen(stringJson));

SteamWorks_SetHTTPRequestNetworkActivityTimeout(request, 30);

if(RequestCompleted == INVALID_FUNCTION) {
//I had some bugs previously where it wouldn't send request and return code 0 if I didn't set request completed.
//This is just a safety then, my issue could have been something else and I will test more later on
RequestCompleted = HTTPCompleted;
}

if(DataReceived == INVALID_FUNCTION) {
//Need to close the request handle
DataReceived = HTTPDataReceive;
}

SteamWorks_SetHTTPCallbacks(request, RequestCompleted, HeadersReceived, DataReceived);
if(hJson != null) delete hJson;

return request;
}
*/

methodmap DiscordRequest < Handle {
public DiscordRequest(char[] url, EHTTPMethod method) {
Handle request = SteamWorks_CreateHTTPRequest(method, url);
return view_as<DiscordRequest>(request);
}

public void SetJsonBody(Handle hJson) {
static char stringJson[16384];
stringJson[0] = '\0';
if(hJson != null) {
json_dump(hJson, stringJson, sizeof(stringJson), 0, true);
}
SteamWorks_SetHTTPRequestRawPostBody(this, "application/json; charset=UTF-8", stringJson, strlen(stringJson));
if(hJson != null) delete hJson;
}

public void SetJsonBodyEx(Handle hJson) {
static char stringJson[16384];
stringJson[0] = '\0';
if(hJson != null) {
json_dump(hJson, stringJson, sizeof(stringJson), 0, true);
}
SteamWorks_SetHTTPRequestRawPostBody(this, "application/json; charset=UTF-8", stringJson, strlen(stringJson));
}

property int Timeout {
public set(int timeout) {
SteamWorks_SetHTTPRequestNetworkActivityTimeout(this, timeout);
}
}

public void SetCallbacks(SteamWorksHTTPRequestCompleted OnComplete, SteamWorksHTTPDataReceived DataReceived) {
SteamWorks_SetHTTPCallbacks(this, OnComplete, HeadersReceived, DataReceived);
}

public void SetContextValue(any data1, any data2) {
SteamWorks_SetHTTPRequestContextValue(this, data1, data2);
}

public void SetData(any data1, char[] route) {
SteamWorks_SetHTTPRequestContextValue(this, data1, UrlToDP(route));
}

public void SetBot(DiscordBot bot) {
BuildAuthHeader(this, bot);
}

public void Send(char[] route) {
DiscordSendRequest(this, route);
}
}
Loading