Y_INI, Reading from files
#1

Yes, yes I know there is documentation on how to do this on the release thread but it didn't work for my needs so I need a little bit of assistance.

If I save a string to a player file (%s.ini) and then want to load it as a string ("%s", PlayerInfo[playerid][pString]), how do I call it? I've tried a few methods but all have failed and I can't find a way around it. I've tried looking through other scripts to find methods like it, but still nothing. If I save an integer to a file, and call it, it's easy, but if it's a string it just doesn't work the same way. I'm new when it comes to saving files and loading them, so excuse me if I've missed something basic.

Thanks
Reply
#2

Bump
Reply
#3

You mean how to show the stored string PlayerInfo[playerid][pString], for example in ClientMessage?
Reply
#4

Yeah
Reply
#5

pawn Код:
new string[256];
format(string, sizeof(string), "Test the string: %s", PlayerInfo[playerid][pString]);
SendClientMessage(playerid, -1, string);
Reply
#6

That doesn't work, I've tried it. You need to read it from the file, but I have no idea how.
Reply
#7

Which save/load file system are you using?
Reply
#8

Код:
INI_String("MyVariable", PlayerInfo[playerid][String], sizeof(PlayerInfo[playerid][String]));
You need the name of the 'thingy' that it's stored under in the file, the thing you want it to save it to, then the size of the string. It has an extra parameter compared to INI_Int.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)