Skip to content

Commit e7a0acf

Browse files
ziggimaddinat0r
authored andcommitted
Fix name array size
1 parent c2d3c91 commit e7a0acf

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

sscanf2.inc

+13-13
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ static stock
110110
if (!SSCANF_g_sPlayers{i})
111111
{
112112
new
113-
name[MAX_PLAYER_NAME];
114-
GetPlayerName(i, name, sizeof (name));
113+
name[MAX_PLAYER_NAME + 1];
114+
GetPlayerName(i, name, sizeof(name));
115115
// We have no way to know if they are an NPC or not!
116116
SSCANF_Join(i, name, 0);
117117
SSCANF_g_sPlayers{i} = 1;
@@ -140,21 +140,21 @@ static stock
140140
public OnFilterScriptInit()
141141
{
142142
new
143-
name[MAX_PLAYER_NAME];
144-
143+
name[MAX_PLAYER_NAME + 1];
144+
145145
SSCANF_Init(GetMaxPlayers(), INVALID_PLAYER_ID, MAX_PLAYER_NAME);
146146
SSCANF_gInit = true;
147-
147+
148148
// Check if there are any players that aren't initialized.
149149
for (new i = 0; i < MAX_PLAYERS; i ++)
150150
{
151151
if (IsPlayerConnected(i) && !SSCANF_IsConnected(i))
152152
{
153-
GetPlayerName(i, name, MAX_PLAYER_NAME);
153+
GetPlayerName(i, name, sizeof(name));
154154
SSCANF_Join(i, name, IsPlayerNPC(i));
155155
}
156156
}
157-
157+
158158
#if defined SSCANF_OnFilterScriptInit
159159
SSCANF_OnFilterScriptInit();
160160
#endif
@@ -184,17 +184,17 @@ static stock
184184
if (!SSCANF_gInit)
185185
{
186186
new
187-
name[MAX_PLAYER_NAME];
188-
187+
name[MAX_PLAYER_NAME + 1];
188+
189189
SSCANF_Init(GetMaxPlayers(), INVALID_PLAYER_ID, MAX_PLAYER_NAME);
190190
SSCANF_gInit = true;
191-
191+
192192
// Check if there are any players that aren't initialized.
193193
for (new i = 0; i < MAX_PLAYERS; i ++)
194194
{
195195
if (IsPlayerConnected(i) && !SSCANF_IsConnected(i))
196196
{
197-
GetPlayerName(i, name, MAX_PLAYER_NAME);
197+
GetPlayerName(i, name, sizeof(name));
198198
SSCANF_Join(i, name, IsPlayerNPC(i));
199199
}
200200
}
@@ -227,8 +227,8 @@ static stock
227227
public OnPlayerConnect(playerid)
228228
{
229229
new
230-
name[MAX_PLAYER_NAME];
231-
GetPlayerName(playerid, name, sizeof (name));
230+
name[MAX_PLAYER_NAME + 1];
231+
GetPlayerName(playerid, name, sizeof(name));
232232
SSCANF_Join(playerid, name, IsPlayerNPC(playerid));
233233
#if defined SSCANF_OnPlayerConnect
234234
SSCANF_OnPlayerConnect(playerid);

0 commit comments

Comments
 (0)