24.12.2013, 15:46
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