Skip to content

Commit 4f6494b

Browse files
v9.3
- Fix name load with "\n" issue - Fix name cannot be saved with space issue
1 parent 4d5d1d8 commit 4f6494b

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

plugins/TF2Sandbox-SaveSystem.smx

180 Bytes
Binary file not shown.

scripting/TF2Sandbox-SaveSystem.sp

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#define DEBUG
1818

1919
#define PLUGIN_AUTHOR "Battlefield Duck"
20-
#define PLUGIN_VERSION "9.2"
20+
#define PLUGIN_VERSION "9.3"
2121

2222
#include <sourcemod>
2323
#include <sdktools>
@@ -33,7 +33,7 @@ public Plugin myinfo =
3333
author = PLUGIN_AUTHOR,
3434
description = "Save System for TF2SandBox",
3535
version = PLUGIN_VERSION,
36-
url = "http://steamcommunity.com/id/battlefieldduck/"
36+
url = "https://github.com/tf2-sandbox-studio/Module-SaveSystem"
3737
};
3838

3939
Handle g_hFileEditting[MAXPLAYERS + 1] = INVALID_HANDLE;
@@ -1228,11 +1228,11 @@ public Action Timer_LoadProps(Handle timer, Handle dp)
12281228
bool LoadProps(int loader, char[] szLoadString)
12291229
{
12301230
float fOrigin[3], fAngles[3], fSize;
1231-
char szModel[128], szClass[64], szFormatStr[255], DoorIndex[5], szBuffer[20][255], szName[128];
1231+
char szModel[128], szClass[64], szFormatStr[255], DoorIndex[5], szBuffer[30][255], szName[128];
12321232
int Obj_LoadEntity, iCollision, iRed, iGreen, iBlue, iAlpha, iRenderFx, iRandom, iSkin;
12331233
RenderFx FxRender = RENDERFX_NONE;
12341234

1235-
ExplodeString(szLoadString, " ", szBuffer, 20, 255);
1235+
ExplodeString(szLoadString, " ", szBuffer, 30, 255);
12361236
Format(szClass, sizeof(szClass), "%s", szBuffer[1]);
12371237
Format(szModel, sizeof(szModel), "%s", szBuffer[2]);
12381238
fOrigin[0] = StringToFloat(szBuffer[3]);
@@ -1250,7 +1250,19 @@ bool LoadProps(int loader, char[] szLoadString)
12501250
iRenderFx = StringToInt(szBuffer[15]);
12511251
iSkin = StringToInt(szBuffer[16]);
12521252
Format(szName, sizeof(szName), "%s", szBuffer[17]);
1253-
1253+
1254+
for (int i = 18; i < 30; i++)
1255+
{
1256+
if (!StrEqual(szBuffer[i], ""))
1257+
{
1258+
Format(szName, sizeof(szName), "%s %s", szName, szBuffer[i]);
1259+
}
1260+
else
1261+
{
1262+
break;
1263+
}
1264+
}
1265+
12541266
if (strlen(szBuffer[9]) == 0)
12551267
iCollision = 5;
12561268
if (strlen(szBuffer[10]) == 0)
@@ -1321,7 +1333,10 @@ bool LoadProps(int loader, char[] szLoadString)
13211333
}
13221334
SetEntityRenderFx(Obj_LoadEntity, FxRender);
13231335
SetEntProp(Obj_LoadEntity, Prop_Send, "m_nSkin", iSkin);
1336+
1337+
ReplaceString(szName, sizeof(szName), "\n", "", false);
13241338
SetEntPropString(Obj_LoadEntity, Prop_Data, "m_iName", szName);
1339+
13251340
//SetVariantInt(iHealth);
13261341
//AcceptEntityInput(Obj_LoadEntity, "sethealth", -1);
13271342
//AcceptEntityInput(Obj_LoadEntity, "disablemotion", -1);

0 commit comments

Comments
 (0)