21.01.2014, 21:55
I get repair saving error
pawn Код:
warning 202: number of arguments does not match definition
warning 203: symbol is never used: "RepairPlaceFile_Load"
warning 203: symbol is never used: "RepairPlace_LoadAll"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
3 Warnings.
pawn Код:
COMMAND:createrepairplace(playerid, params[])
{
new Float:x, Float:y, Float:z, Float:Angle, file[100], File:PFile, LineForFile[100], Msg[128], MaxRepairPlace, ReapirID, MAX_RepairPlace;
SendAdminText(playerid, "/createcamera", params);
if (APlayerData[playerid][LoggedIn] == true)
{
if (APlayerData[playerid][PlayerAdmin] >= 2)
{
if (sscanf(params, "i", MaxRepairPlace)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /createrepairplace [create]");
else
{
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, Angle);
z = z - 1.0;
SetPlayerPos(playerid, x, y + 1.0, z + 1.0);
for (new RepairID; ReapirID < MAX_RepairPlace; RepairID++)
{
AddARepairPickups(ReapirID, x, y, z);
format(file, sizeof(file), RepairPlaceFile, RepairID);
PFile = fopen(file, io_write);
format(LineForFile, 100, "ReapirX %f\r\n", x);
fwrite(PFile, LineForFile);
format(LineForFile, 100, "RepairY %f\r\n", y);
fwrite(PFile, LineForFile);
format(LineForFile, 100, "RepairZ %f\r\n", z);
fwrite(PFile, LineForFile);
format(LineForFile, 100, "RepairAngle %f\r\n", Angle);
fwrite(PFile, LineForFile);
fclose(PFile);
format(Msg, 128, "You have created a repair place with ID: %i", ReapirID);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
return 1;
}
format(Msg, 128, "You can't create more than %i RepairPlaces", MAX_RepairPlace);
SendClientMessage(playerid, COLOUR, Msg);
}
}
else
return 0;
}
else
return 0;
return 1;
}
pawn Код:
RepairPlaceFile_Load(ReapirID)
{
// Setup local variables
new file[100], File:CFile, LineFromFile[100], ParameterName[50], ParameterValue[50];
new Float:x, Float:y, Float:z, Float:rot;
format(file, sizeof(file), RepairPlaceFile, ReapirID); // Construct the complete filename for this camera-file
if (fexist(file))
{
CFile = fopen(file, io_read); // Open the camerafile for reading
fread(CFile, LineFromFile); // Read the first line of the file
// Keep reading until the end of the file is found (no more data)
while (strlen(LineFromFile) > 0)
{
StripNewLine(LineFromFile); // Strip any newline characters from the LineFromFile
sscanf(LineFromFile, "s[50]s[50]", ParameterName, ParameterValue); // Extract parametername and parametervalue
// Store the proper value in the proper place
if (strcmp(ParameterName, "ReapirX", false) == 0) // If the parametername is correct ("CamX")
x = floatstr(ParameterValue); // Store the CamX
if (strcmp(ParameterName, "ReapirY", false) == 0) // If the parametername is correct ("CamY")
y = floatstr(ParameterValue); // Store the CamY
if (strcmp(ParameterName, "ReapirZ", false) == 0) // If the parametername is correct ("CamZ")
z = floatstr(ParameterValue); // Store the CamZ
if (strcmp(ParameterName, "ReapirAngle", false) == 0) // If the parametername is correct ("CamAngle")
rot = floatstr(ParameterValue); // Store the CamAngle
fread(CFile, LineFromFile); // Read the next line of the file
}
fclose(CFile); // Close the file
AddARepairPickups(ReapirID, x, y, z);
return 1; // Return that the file was read correctly
}
else
return 0; // Return 0 if the file couldn't be read (doesn't exist)
}
pawn Код:
RepairPlace_LoadAll()
{
// Loop through all cameras and try to load them
for (new RepairID; RepairID < MAX_RepairPlace; Repair++)
{
// Try to load the file and check if it was succesfully loaded (file exists)
if (RepairPlaceFile_Load(RepairID) == 1)
{
// Save the number of camera's that have been loaded, so it can be displayed
TotalRepair++;
}
}
return 1;
}