• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] how to load every user.ini in scriptfiles using YINI
#5
(2021-02-12, 08:57 PM)Radical Wrote: Save gang members to a file.

Then load them all name through fread and set them level...



If you do not understand, see this:

Code:
new File: handle = fopen("gang_members.txt", io_read), string[28], nick[24], INI: file; if(handle) { while(fread(handle, nick)) { ? ? ? ? ? ? format(string, 28, "Users/%s.ini", nick); ? ? ? ? ? ? file = INI_Open(string); ? ? ? ? ? ? INI_WriteInt(file, "p_level", 100); ? ? ? ? ? ? INI_Close(file); ? ? ? ? } fclose(handle); } else { print("The file \"gang_members.txt\" does not exists, or can't be opened."); } // Notice : The names of the members you have saved in the file 'gang_members.txt' should be the name of each one in a new line



If you use MySQL, you can do this easily with just one query.

Code:
UPDATE `users` SET `level` = `level` 100 WHERE `gangid` = 1



i guess i should've elaborated a bit on the gang part. that gang thing is made out of just commands, like "/gangmembers" or "/setganglevel" simple stuff. what you're doing is actually close but i'd like an example which has to do with loading every account from the scriptfiles folder. i could elaborate more on the scriptfiles part if you don't understand.
  Reply


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