fwrite
#1

Any possibility of saving permanently into a userfile with fwrite?

Код:
new members;
			for(new i; i<MAX_PLAYERS; i++)
			{
			    if(PlayerInfo[i][pMember] == 9 || PlayerInfo[i][pLeader] == 9)  { members++; }
			    if(members > 0)
			    {
			    if(AdMade[playerid] == 1) { SendClientMessage(playerid, COLOR_GRAD2, "Continue your /ad before attempting to create a new one");return 1;}
			        OnPlayerSave(playerid);
			        new name[MAX_PLAYER_NAME];
     				GetPlayerName(playerid, name, sizeof(name));
         			new file[32];
					format(file, sizeof(file), "users/%s.ini",name);
					new File: hFile = fopen(file, io_append);
   					if(hFile)
					{
					new var[50];
				 	format(var, 50, "AdName=%s\n", name);fwrite(hFile, var);
					format(var, 50, "AdMessage=%s\n", result);fwrite(hFile, var);
					fclose(hFile);
					}
			        SendClientMessage(playerid, COLOR_EXC, "Please don't forget to choose your color and the price (( /adoptions ))");
			        format(string, sizeof(string), "%s is setting up an advertisement for the local newspaper",sendername);
                	SendFamilyMessage(9,COLOR_LIGHTRED, string);
                	if(PlayerInfo[playerid][pAdmin] < 4){SetTimer("AddsOn", addtimer, 0);adds = 0;}
                	AdMade[playerid] = 1;
                	return 1;
				}
Problem is, once OnPlayerSave gets called by the global timer (2 minutes) the AdName + AdMessage totally disappears from the userfile and obviously the /ad won't work.


Any ideas?
Reply
#2

LEarn mySQL its much faster and fun :P all my things on my gm saves when i want
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)