stock UpdateFileDetails2(Float: times[5], players[5][MAX_PLAYER_NAME+1])
{
iniFile = INI_Open(fileToWrite);
INI_SetTag(iniFile, "times");
new sValue[10];
for(new i = 0; i < 5; i++)
{
valstr(sValue, i);
INI_WriteFloat(iniFile, sValue, times[i], 4);
}
INI_SetTag(iniFile, "players");
new arr[] = {"1st", "2nd", "2rd", "4th", "5th"};
for(new m = 0; m < 5; m++) INI_WriteString(iniFile, arr[m], players[m]);
INI_Close(iniFile);
}
ERRORS: MyCode.pwn(84) : error 035: argument type mismatch (argument 1) // UpdateFileDetails2(10.0, 10.0, 10.0, 10.0, 10.0, "N/A", "N/A", "N/A", "N/A", "N/A"); MyCode.pwn(85) : error 047: array sizes do not match, or destination array is too small // UpdateFileDetails2(ccount[3][playerid], tops[0], tops[1], tops[2], tops[3], pName[playerid], usrtops[0], usrtops[1], usrtops[2], usrtops[3]);
new Float: ccount[4][MAX_PLAYERS], Float: tops[5], usrtops[5][MAX_PLAYER_NAME + 1] ;
UpdateFileDetails(key, value, key, value);
enum KeysUpdateTypes { Float: times[5], players[5][MAX_PLAYER_NAME + 1] };
stock UpdateFileDetails({KeysUpdateTypes}:...)
{
iniFile = INI_Open(fileToWrite);
for(new i = 0, n = numargs(); i < n; i++) switch(getarg(i))
{
case times[0]: INI_WriteFloat(iniFile, "0", getarg(i+1), 4);
// another times cases.
case players[0]: INI_WriteString(iniFile, "1st", getarg(i+1));
}
INI_Close(iniFile);
return 1;
}
new array1[5] = {10.0, ...};
new array2[5][MAX_PLAYER_NAME+1] = { "N/A", "N/A", "N/A", "N/A", "N/A" };
UpdateFileDetails2(array1, array2);
UpdateFileDetails2({10.0, 10.0, 10.0, 10.0, 10.0}, {"N/A", "N/A", "N/A", "N/A", "N/A"});
|
If the function expects an array then you must pass an array. For example:
pawn Код:
pawn Код:
|
new Float: times[5] = {0.0, ...};
new players[5][MAX_PLAYER_NAME+1] = { "N/A", "N/A", "N/A", "N/A", "N/A" };
stock UpdateFileDetails2(times, players)
{
iniFile = INI_Open(fileToWrite);
INI_SetTag(iniFile, "times");
new sValue[10], i = 0;
for(i = 0; i < 5; i++)
{
valstr(sValue, i);
INI_WriteFloat(iniFile, sValue, times[i], 4);
}
INI_SetTag(iniFile, "players");
new arr[] = {"1st", "2nd", "2rd", "4th", "5th"};
for(i = 0; i < 5; i++) INI_WriteString(iniFile, arr[i], players[i]);
INI_Close(iniFile);
}
stock UpdateFileDetails2(Float:times[], players[][])