fremove, little help please?
#4

Just an example of how it would look like.

Код:
//Your enum names or whatever you're "storing" the data in temporarily
enum PlayerInformation
{
	pString,
	pInt,
	pFloat
}
new playerInfo[MAX_PLAYERS][PlayerInformation];


CMD:change(playerid, params[])
{
	new str[128], id, Float:double;
	new playerToChangeSomethingOn;
	if(sscanf(params, "us[128]if, playerToChangeSomethingOn, str, integer, double)) return SCM(playerid, color, "use this instead: /change [player u want to change something on] [string] [integer] [float]");
	
	//Two ways you can do it:
	//Directly change in the file:
	new userPath[128], annoyingString[128];
	GetPlayerName(playerToChangeSoemthingOn, annoyingString, sizeof(annoyingString));
	format(userPath, sizeof(userPath), "/Users/%s.ini", annoyingString);
	new INI:fileChange = INI_Open(userPath);
	INI_WriteInt(fileChange, "YourIntTitle", integer);
	INI_WriteFloat(fileChange, "YourFloatTitle", double);
	INI_WriteString(fileChange, "YourStringTitle", str);
	INI_Close(fileChange);
	
	//The other way is to store the data in enums, variables or whatever you're using to temporarily store hopefully you have a way to load them as well...
	playerInfo[playerToChangeSomethingOn][pString] = str;
	playerInfo[playerToChangeSomethingOn][pInt] = integer;
	playerInfo[playerToChangeSomethingOn][pFloat] = double;
	
	return 1;
}

//The second way won't be "saving" into the file directly but when the player possibly disconnects or wherever you have your "INI_Parse",
//which I really hope you have one as you're using different-user based system
Reply


Messages In This Thread
FWRITE, little help please? - by Runn3R - 23.12.2013, 21:32
Re: fremove, little help please? - by Runn3R - 24.12.2013, 07:46
Re: fremove, little help please? - by Runn3R - 24.12.2013, 14:06
Re: fremove, little help please? - by Hansrutger - 24.12.2013, 15:46

Forum Jump:


Users browsing this thread: 1 Guest(s)