• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] how to load every user.ini in scriptfiles using YINI
#13
(2021-02-14, 11:57 AM)Kwarde Wrote: Cannot open or create file:

===

scriptfiles/Users/mems

.in

===

Seems it is read as "scriptfiles/Users/mems\n.in"



While reading your code just now:

Quote:format(string, 28, "scriptfiles/Users/%s.ini", nick);

Length of "scriptfiles/Users/.ini" is 22. Max player's name length is 24. 22 = 46. You're formatting with maxlength 28. It checks out:

"scriptfiles/Users/mems\n.in" is 27 characters.



When reading an entire line in a file it includes characters such as "new line" and "reset carrier". In this case, "mems" is actually "mems\r\n"



You've gotta make sure:

- The array you hold the file location in can hold all the data

- y_ini is relative to ./scriptfiles -- So when trying to open "scriptfiles/somefile.txt" it actually tries to open (relative to your samp executable file): scriptfiles/scriptfiles/somefile.txt -- You only can access below scriptfiles through plugins (like with FileManager)

^- when that's fixed you no longer actually need to focus on the first point

- You remove characters \r and \n

- Don't run that command in a production environment (live server) when there's alot of user account files.



i fixed the length of the string so that `.in` thing becomes `.ini` and now almost everything is working fine, with 2 more problems to solve.



1. i removed these \r and \n characters you told me to, but it still did not work.

2. not really a problem, more like a question. is it possible to make if statements when scanning for specific stuff?
  Reply


Messages In This Thread
RE: how to load every user.ini in scriptfiles using YINI - by mems - 2021-02-14, 12:12 PM

Forum Jump: