25.02.2013, 23:11
i got Errors, how i save the helpers stats if a helper disconnects,
2 Errors.
The Error in dis code:
How to make it save
dis my commands:
Код:
C:\Users\pawno\include\PPC_FileOperations.inc(176) : error 001: expected token: ",", but found ";" C:\Users\pawno\include\PPC_FileOperations.inc(185) : error 001: expected token: ",", but found ";" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
The Error in dis code:
Код:
// This function will save all player-data (used when the player disconnects from the server) PlayerFile_Save(playerid) { new file[100], File:PFile, Name[24], LineForFile[100]; format(Name, sizeof(Name), APlayerData[playerid][PlayerName]); // Get the playername format(file, sizeof(file), PlayerFile, Name); // Construct the complete filename for this player's account format(Name, sizeof(Name), (!playerHelper[playerid]); // Get the playername format(file, sizeof(file), PlayerFile, Name); // Construct the complete filename for this player's account PFile = fopen(file, io_write); // Open the playerfile for writing format(LineForFile, 100, "Password %s\r\n", APlayerData[playerid][PlayerPassword]); // Construct the line: "Password <playerpassword>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "Level %i\r\n", APlayerData[playerid][PlayerLevel]); // Construct the line: "Level <playerlevel>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "Helper %i\r\n", (!playerHelper[playerid]); // Construct the line: "Level <playerlevel>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "Jailed %i\r\n", APlayerData[playerid][PlayerJailed]); // Construct the line: "Jailed <playerjailed>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "Wanted %i\r\n", GetPlayerWantedLevel(playerid)); // Construct the line: "Wanted <wantedlevel>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "Bans %i\r\n", APlayerData[playerid][Bans]); // Construct the line: "Bans <NumberOfBans>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "BanTime %i\r\n", APlayerData[playerid][BanTime]); // Construct the line: "BanTime <TimeToUnban>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "TruckerLicense %i\r\n", APlayerData[playerid][TruckerLicense]); // Construct the line: "TruckerLicense <playertruckerlicense>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "BusLicense %i\r\n", APlayerData[playerid][BusLicense]); // Construct the line: "BusLicense <playerbuslicense>" fwrite(PFile, LineForFile); // And save it to the file if (APlayerData[playerid][Muted] == true) // Check if the player is muted format(LineForFile, 100, "Muted Yes\r\n"); // Construct the line: "Muted <Yes>" else format(LineForFile, 100, "Muted No\r\n"); // Construct the line: "Muted <No>" fwrite(PFile, LineForFile); // And save it to the file if (APlayerData[playerid][RulesRead] == true) // Check if the player has accepted the rules format(LineForFile, 100, "RulesRead Yes\r\n"); // Construct the line: "RulesRead <Yes>" else format(LineForFile, 100, "RulesRead No\r\n"); // Construct the line: "RulesRead <No>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "StatsMetersDriven %f\r\n", APlayerData[playerid][StatsMetersDriven]); // Construct the line: "StatsMetersDriven <StatsMetersDriven>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "StatsTruckerJobs %i\r\n", APlayerData[playerid][StatsTruckerJobs]); // Construct the line: "StatsTruckerJobs <StatsTruckerJobs>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "StatsConvoyJobs %i\r\n", APlayerData[playerid][StatsConvoyJobs]); // Construct the line: "StatsConvoyJobs <StatsConvoyJobs>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "StatsBusDriverJobs %i\r\n", APlayerData[playerid][StatsBusDriverJobs]); // Construct the line: "StatsBusDriverJobs <StatsBusDriverJobs>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "StatsPilotJobs %i\r\n", APlayerData[playerid][StatsPilotJobs]); // Construct the line: "StatsPilotJobs <StatsPilotJobs>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "StatsMafiaJobs %i\r\n", APlayerData[playerid][StatsMafiaJobs]); // Construct the line: "StatsMafiaJobs <StatsMafiaJobs>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "StatsMafiaStolen %i\r\n", APlayerData[playerid][StatsMafiaStolen]); // Construct the line: "StatsMafiaStolen <StatsMafiaStolen>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "StatsPoliceFined %i\r\n", APlayerData[playerid][StatsPoliceFined]); // Construct the line: "StatsPoliceFined <StatsPoliceFined>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "StatsPoliceJailed %i\r\n", APlayerData[playerid][StatsPoliceJailed]); // Construct the line: "StatsPoliceJailed <StatsPoliceJailed>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "StatsAssistance %i\r\n", APlayerData[playerid][StatsAssistance]); // Construct the line: "StatsAssistance <StatsAssistance>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "StatsCourierJobs %i\r\n", APlayerData[playerid][StatsCourierJobs]); // Construct the line: "StatsCourierJobs <StatsCourierJobs>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "StatsRoadworkerJobs %i\r\n", APlayerData[playerid][StatsRoadworkerJobs]); // Construct the line: "StatsRoadworkerJobs <StatsRoadworkerJobs>" fwrite(PFile, LineForFile); // And save it to the file // Save all the valid house-id's for (new i; i < MAX_HOUSESPERPLAYER; i++) { // Check if there is a valid house-id in this slot if (APlayerData[playerid][Houses][i] != 0) { format(LineForFile, 100, "House %i\r\n", APlayerData[playerid][Houses][i]); // Construct the line: "House <HouseID>" fwrite(PFile, LineForFile); // And save it to the file } } // Save all the valid business-id's for (new i; i < MAX_BUSINESSPERPLAYER; i++) { // Check if there is a valid business-id in this slot if (APlayerData[playerid][Business][i] != 0) { format(LineForFile, 100, "Business %i\r\n", APlayerData[playerid][Business][i]); // Construct the line: "Business <BusinessID>" fwrite(PFile, LineForFile); // And save it to the file } } format(LineForFile, 100, "Money %i\r\n", APlayerData[playerid][PlayerMoney]); // Construct the line: "Money <playermoney>" fwrite(PFile, LineForFile); // And save it to the file format(LineForFile, 100, "Score %i\r\n", APlayerData[playerid][PlayerScore]); // Construct the line: "Score <playerscore>" fwrite(PFile, LineForFile); // And save it to the file fclose(PFile); // Close the file // Also save the houses that this player owns for (new i; i < MAX_HOUSESPERPLAYER; i++) { // Check if there is a valid house-id in this slot if (APlayerData[playerid][Houses][i] != 0) { // Save the house (and linked vehicles) HouseFile_Save(APlayerData[playerid][Houses][i]); } } // Save all the valid business-id's for (new i; i < MAX_BUSINESSPERPLAYER; i++) { // Check if there is a valid business-id in this slot if (APlayerData[playerid][Business][i] != 0) { // Save the business BusinessFile_Save(APlayerData[playerid][Business][i]); } } return 1; }

Код:
COMMAND:sethelper(playerid, params[]) { new pID, str[128]; if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Only admins can use this command."); if(sscanf(params,"u", pID)) return SendClientMessage(playerid,-1,"USAGE: /sethelper [PlayerID]"); if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, -1, "ERROR: Selected player is not connected."); if(playerHelper[pID]) return SendClientMessage(playerid, -1, "Selected player is a helper already."); new name[MAX_PLAYER_NAME+1], pName[MAX_PLAYER_NAME+1]; GetPlayerName(pID, name, sizeof name); GetPlayerName(playerid, pName, sizeof pName); playerHelper[pID] = true; format(str, sizeof str, "Admin %s made you a helper.", pName); SendClientMessage(pID, -1, str); format(str, sizeof str, "You made %s a helper.", name); SendClientMessage(playerid, -1, str); // Let the server know that this was a valid command return 1; } COMMAND:unsethelper(playerid, params[]) { new pID, str[128]; if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Only admins can use this command."); if(sscanf(params,"u", pID)) return SendClientMessage(playerid,-1,"USAGE: /unsethelper [PlayerID]"); if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, -1, "ERROR: Selected player is not connected."); if(!playerHelper[pID]) return SendClientMessage(playerid, -1, "Selected player is not helper."); new name[MAX_PLAYER_NAME+1], pName[MAX_PLAYER_NAME+1]; GetPlayerName(pID, name, sizeof name); GetPlayerName(playerid, pName, sizeof pName); playerHelper[pID] = false; format(str, sizeof str, "Admin %s made you a regular player.", pName); SendClientMessage(pID, -1, str); format(str, sizeof str, "You made %s a regular player.", name); SendClientMessage(playerid, -1, str); // Let the server know that this was a valid command return 1; }