Changing value in a file - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Changing value in a file (
/showthread.php?tid=386349)
Changing value in a file -
GTXcube - 20.10.2012
Hello everybody. I need help because i have no idea how to do that. I have registration and login system for players. I know how to read and write to the file, but i don't know how to change value of something. For example when player die to change fatals=0 to fatals=1. I am talking about number of deaths of player and my file is like ..sc/NICK.cfg
Can anybody help me with that ? Thanks
Re: Changing value in a file -
HyDrAtIc - 20.10.2012
Could you show us the enum,please?
Re: Changing value in a file -
_Khaled_ - 20.10.2012
Do you use Y_INI?
if so
PHP код:
//I Rather use those.
PlayerInfo[playerid][pDeath] = PlayerInfo[playerid][pDeath]+1;
PlayerInfo[killerid][pKills] = PlayerInfo[killerid][pKills]+1;
//OR, as in default.
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
EDIT: You know, changing values in general..
PHP код:
PlayerInfo[playerid][pDeaths] =0; //SETS IT TO 0.
PlayerInfo[playerid][pDeath] = PlayerInfo[playerid][pDeath]-1; //Minus 1. If 10, it's gonna be 9
Like that
Re: Changing value in a file -
GTXcube - 20.10.2012
Enum:
Код:
enum INFO_NAME
{
Fatals
}
Re: Changing value in a file -
_Khaled_ - 20.10.2012
just copy paste the stuff I posted, and instead of pDeaths and pKills, do Fatals.