Skip to content

Commit

Permalink
Fix RequestFile for CS:GO
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolo001-Aha authored Apr 22, 2023
1 parent d667cb3 commit c109564
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions scripting/filenetwork.sp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ char CurrentlySending[MAXPLAYERS+1][PLATFORM_MAX_PATH];
// Requesting
ArrayList RequestListing;

EngineVersion g_EngineVersion;

methodmap CNetChan
{
public CNetChan(int client)
Expand All @@ -47,16 +49,17 @@ methodmap CNetChan
}
public int RequestFile(const char[] filename)
{
return SDKCall(SDKRequestFile, this, filename);
if(g_EngineVersion == Engine_CSGO) //CS:GO has a 2nd param for RequestFile.
return SDKCall(SDKRequestFile, this, filename, false);
else
return SDKCall(SDKRequestFile, this, filename);
}
public bool IsFileInWaitingList(const char[] filename)
{
return SDKCall(SDKIsFileInWaitingList, this, filename);
}
}

EngineVersion g_EngineVersion;

public Plugin myinfo =
{
name = "File Network",
Expand Down Expand Up @@ -129,6 +132,9 @@ public void OnPluginStart()
StartPrepSDKCall(SDKCall_Raw);
PrepSDKCall_SetFromConf(gamedata, SDKConf_Signature, "CNetChan::RequestFile");
PrepSDKCall_AddParameter(SDKType_String, SDKPass_Pointer);
if(g_EngineVersion == Engine_CSGO)
PrepSDKCall_AddParameter(SDKType_Bool, SDKPass_ByValue);

PrepSDKCall_SetReturnInfo(SDKType_PlainOldData, SDKPass_ByValue);
SDKRequestFile = EndPrepSDKCall();
if(!SDKRequestFile)
Expand Down Expand Up @@ -277,7 +283,6 @@ public void OnClientDisconnect_Post(int client)
public MRESReturn OnFileReceived(Address address, DHookParam param)
{
int id = param.Get(2);

CNetChan chan;

chan = SDKCall(SDKGetNetChannel, address);
Expand Down

0 comments on commit c109564

Please sign in to comment.