• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] how to load every user.ini in scriptfiles using YINI
#7
(2021-02-13, 12:53 AM)Radical Wrote:
(2021-02-12, 10:04 PM)mems Wrote: 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.



To do this we need the readdir() (Read a Directory) function that does not exist in the SA-MP library.



But I still have a way for you to do it. look:



When a new player registered,?add him name to the 'allusers.txt' file.

Code:
new File: handle = fopen("allusers.txt", io_write), Name[28];

GetPlayerName(playerid, Name, 24);

format(Name, 28, "%s\r\n", Name);

fwrite(handle, Name);

fclose(handle);



Now with the previous code I gave, like that, you can load all the players data or you can set or give?all players level or something.

Code:
new File: handle = fopen("allusers.txt", io_read), nick[24];



if(handle)

{

while(fread(handle, nick)) {

? ? ? ? ? ? // things ...

? ? ? ? }

fclose(handle);

} else {

print("The file \"allusers.txt\" does not exists, or can't be opened.");

}



I hope it works for you.



mind also showing me that readdir way?
  Reply


Messages In This Thread
RE: how to load every user.ini in scriptfiles using YINI - by mems - 2021-02-13, 01:05 AM

Forum Jump: