Help with fwrite -
Proxus - 10.02.2019
I probably sound kinda dumb using fwrite and I'll probably convert to mySQL or some other thing later on. However, how can I add more lines to the file? I've done it before but this time it won't let me.
Here is the code:
Код:
if (strcmp(ParameterName, "TruckerRank", false) == 0)
APlayerData[playerid][TruckerRank], 50, strval(ParameterValue);
if (strcmp(ParameterName, "PoliceRank", false) == 0)
APlayerData[playerid][PoliceRank], 50, strval(ParameterValue);
Код:
format(LineForFile, sizeof(LineForFile), "TruckerRank %s\r\n", APlayerData[playerid][TruckerRank]);"
fwrite(PFile, LineForFile); // And save it to the file
format(LineForFile, sizeof(LineForFile), "PoliceRank %s\r\n", APlayerData[playerid][PoliceRank]);"
fwrite(PFile, LineForFile); // And save it to the file
This is what it outputs when compiled:
undefined symbol "TruckerRank"
undefined symbol "PoliceRank"
undefined symbol "TruckerRank"
undefined symbol "PoliceRank"
What have I missed/done wrong? Thanks in advance.
Re: Help with fwrite -
NoteND - 10.02.2019
Show us how you define TruckerRank and PoliceRank
Re: Help with fwrite -
Proxus - 10.02.2019
I just fixed that, thanks. Now I have two more errors but I'm pretty sure I'm just missing something here.
Код:
if (strcmp(ParameterName, "TruckerRank", false) == 0)
APlayerData[playerid][TruckerRank], strval(ParameterValue); // line 101
if (strcmp(ParameterName, "PoliceRank", false) == 0)
APlayerData[playerid][PoliceRank], strval(ParameterValue); // line 103
compiles as:
warning 215: expression has no effect (line 101)
warning 215: expression has no effect (line 103)
Re: Help with fwrite -
DarkBr - 10.02.2019
"
Код:
format(LineForFile, sizeof(LineForFile), "TruckerRank %s\r\n", APlayerData[playerid][TruckerRank]);"
fwrite(PFile, LineForFile); // And save it to the file
format(LineForFile, sizeof(LineForFile), "PoliceRank %s\r\n", APlayerData[playerid][PoliceRank]);"
fwrite(PFile, LineForFile); // And save it to the file
Re: Help with fwrite -
Proxus - 10.02.2019
Quote:
Originally Posted by DarkBr
"
Код:
format(LineForFile, sizeof(LineForFile), "TruckerRank %s\r\n", APlayerData[playerid][TruckerRank]);"
fwrite(PFile, LineForFile); // And save it to the file
format(LineForFile, sizeof(LineForFile), "PoliceRank %s\r\n", APlayerData[playerid][PoliceRank]);"
fwrite(PFile, LineForFile); // And save it to the file
|
Nope, wasn't it. It created a lot of errors and none of my other fwrites have "'s where you put them.
Re: Help with fwrite -
ComDuck - 10.02.2019
Код:
APlayerData[playerid][TruckerRank], strval(ParameterValue); // line 101
APlayerData[playerid][PoliceRank], strval(ParameterValue); // line 103
What does this code do? What are you trying to call? You can't just call a variable directly, you have to do something with it.
Re: Help with fwrite -
Proxus - 10.02.2019
Quote:
Originally Posted by ComDuck
Код:
APlayerData[playerid][TruckerRank], strval(ParameterValue); // line 101
APlayerData[playerid][PoliceRank], strval(ParameterValue); // line 103
What does this code do? What are you trying to call? You can't just call a variable directly, you have to do something with it.
|
Checks if it exists and then saves it to APlayerData
Re: Help with fwrite -
Calisthenics - 10.02.2019
Equal sign is used for variable assignment.
pawn Код:
APlayerData[playerid][TruckerRank] = strval(ParameterValue);
APlayerData[playerid][PoliceRank] = strval(ParameterValue);
Re: Help with fwrite -
Proxus - 10.02.2019
Quote:
Originally Posted by Calisthenics
Equal sign is used for variable assignment.
pawn Код:
APlayerData[playerid][TruckerRank] = strval(ParameterValue); APlayerData[playerid][PoliceRank] = strval(ParameterValue);
|
Thanks! +repped both of you for your contributions and Calis, for your final answer.
Edit: Can't rep again, will do when I can
Re: Help with fwrite -
Proxus - 10.02.2019
Another thing:
TruckerRank
PoliceRank
are both empty in the player's .txt file.
Код:
new Rank[24];
Rank = "Newbie";
APlayerData[playerid][TruckerRank] = Rank;
That is the only piece of code I added ^^ (added it to the part where the player joins the class and gets a rank based on the amount of trucking missions he has done, etc)