fremove, little help please? - 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: fremove, little help please? (
/showthread.php?tid=483022)
FWRITE, little help please? -
Runn3R - 23.12.2013
Код:
CMD:changeplayer(playerid, params[])
{
new pName[MAX_PLAYER_NAME], str[50];
if(sscanf(params, "u", pName))SendClientMessage(playerid, RED, "runn3r: /changeplayer [NAME]");
GetPlayerName(playerid, pName, sizeof pName);
format(str, sizeof str, "/accounts/%s.ini", pName);
fremove(str);
return 1;
}
How can i put this like i type /changeplayer %s and it opens the user file and writes something in that %s.ini file that i want?
I want to use FWRITE!
If you have time please help me...
Re: fremove, little help please? -
Runn3R - 24.12.2013
Nobody? :/
Re: fremove, little help please? -
Runn3R - 24.12.2013
Help me i need this fast!
Re: fremove, little help please? -
Hansrutger - 24.12.2013
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